Search in sources :

Example 1 with ButtonActionListener

use of org.csstudio.swt.widgets.figures.ActionButtonFigure.ButtonActionListener in project yamcs-studio by yamcs.

the class Draw2DButtonEditPartDelegate method hookMouseClickAction.

/* (non-Javadoc)
     * @see org.csstudio.opibuilder.widgets.editparts.IButtonEditPartDelegate#hookMouseClickAction()
     */
@Override
public void hookMouseClickAction() {
    ((ActionButtonFigure) editpart.getFigure()).addActionListener(new ButtonActionListener() {

        @Override
        public void actionPerformed(int mouseEventState) {
            List<AbstractWidgetAction> actions = editpart.getHookedActions();
            if (actions != null) {
                for (AbstractWidgetAction action : actions) {
                    if (action instanceof OpenDisplayAction)
                        ((OpenDisplayAction) action).runWithModifiers((mouseEventState & SWT.CONTROL) != 0, (mouseEventState & SWT.SHIFT) != 0);
                    else
                        action.run();
                }
            }
        }
    });
}
Also used : OpenDisplayAction(org.csstudio.opibuilder.widgetActions.OpenDisplayAction) List(java.util.List) ActionButtonFigure(org.csstudio.swt.widgets.figures.ActionButtonFigure) ButtonActionListener(org.csstudio.swt.widgets.figures.ActionButtonFigure.ButtonActionListener) AbstractWidgetAction(org.csstudio.opibuilder.widgetActions.AbstractWidgetAction)

Aggregations

List (java.util.List)1 AbstractWidgetAction (org.csstudio.opibuilder.widgetActions.AbstractWidgetAction)1 OpenDisplayAction (org.csstudio.opibuilder.widgetActions.OpenDisplayAction)1 ActionButtonFigure (org.csstudio.swt.widgets.figures.ActionButtonFigure)1 ButtonActionListener (org.csstudio.swt.widgets.figures.ActionButtonFigure.ButtonActionListener)1