Search in sources :

Example 11 with DeleteAction

use of org.eclipse.gef.ui.actions.DeleteAction in project yamcs-studio by yamcs.

the class OPIEditor method createActions.

@SuppressWarnings("unchecked")
@Override
protected void createActions() {
    super.createActions();
    getEditorSite().getService(IContextService.class).activateContext("org.csstudio.opibuilder.opiEditor");
    var registry = getActionRegistry();
    IAction action;
    action = new CopyTemplateAction(this);
    registry.registerAction(action);
    action = new MatchWidthAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new MatchHeightAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new DirectEditAction((IWorkbenchPart) this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    var id = ActionFactory.DELETE.getId();
    action = getActionRegistry().getAction(id);
    action.setActionDefinitionId("org.eclipse.ui.edit.delete");
    action = new PasteWidgetsAction(this);
    registry.registerAction(action);
    action = new CopyWidgetsAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new CutWidgetsAction(this, (DeleteAction) registry.getAction(ActionFactory.DELETE.getId()));
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new PrintDisplayAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    id = ActionFactory.SELECT_ALL.getId();
    action = getActionRegistry().getAction(id);
    action.setActionDefinitionId("org.eclipse.ui.edit.selectAll");
    id = ActionFactory.UNDO.getId();
    action = getActionRegistry().getAction(id);
    action.setActionDefinitionId("org.eclipse.ui.edit.undo");
    id = ActionFactory.REDO.getId();
    action = getActionRegistry().getAction(id);
    action.setActionDefinitionId("org.eclipse.ui.edit.redo");
    action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.LEFT);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.RIGHT);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.TOP);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.BOTTOM);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.CENTER);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.MIDDLE);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    for (var dt : DistributeType.values()) {
        action = new DistributeWidgetsAction(this, dt);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());
    }
    for (var orderType : OrderType.values()) {
        action = new ChangeOrderAction(this, orderType);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());
    }
    for (var orientationType : OrientationType.values()) {
        action = new ChangeOrientationAction(this, orientationType);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());
    }
    action = new RunOPIAction();
    registry.registerAction(action);
    var pastePropAction = new PastePropertiesAction(this);
    registry.registerAction(pastePropAction);
    getSelectionActions().add(pastePropAction.getId());
    action = new CopyPropertiesAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new ReplaceWidgetsAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
}
Also used : CutWidgetsAction(org.csstudio.opibuilder.actions.CutWidgetsAction) CopyPropertiesAction(org.csstudio.opibuilder.actions.CopyPropertiesAction) MatchHeightAction(org.eclipse.gef.ui.actions.MatchHeightAction) RunOPIAction(org.csstudio.opibuilder.actions.RunOPIAction) IAction(org.eclipse.jface.action.IAction) RunOPIAction(org.csstudio.opibuilder.actions.RunOPIAction) PasteWidgetsAction(org.csstudio.opibuilder.actions.PasteWidgetsAction) CopyTemplateAction(org.eclipse.gef.ui.actions.CopyTemplateAction) MatchWidthAction(org.eclipse.gef.ui.actions.MatchWidthAction) CopyWidgetsAction(org.csstudio.opibuilder.actions.CopyWidgetsAction) AlignmentAction(org.eclipse.gef.ui.actions.AlignmentAction) ReplaceWidgetsAction(org.csstudio.opibuilder.actions.ReplaceWidgetsAction) ChangeOrientationAction(org.csstudio.opibuilder.actions.ChangeOrientationAction) DistributeWidgetsAction(org.csstudio.opibuilder.actions.DistributeWidgetsAction) PastePropertiesAction(org.csstudio.opibuilder.actions.PastePropertiesAction) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) DirectEditAction(org.eclipse.gef.ui.actions.DirectEditAction) DeleteAction(org.eclipse.gef.ui.actions.DeleteAction) IContextService(org.eclipse.ui.contexts.IContextService) PrintDisplayAction(org.csstudio.opibuilder.actions.PrintDisplayAction) ChangeOrderAction(org.csstudio.opibuilder.actions.ChangeOrderAction)

Aggregations

DeleteAction (org.eclipse.gef.ui.actions.DeleteAction)11 Control (org.eclipse.swt.widgets.Control)4 ERDEditorPart (org.jkiss.dbeaver.erd.ui.editor.ERDEditorPart)4 ERDEditorPart (org.jkiss.dbeaver.ext.erd.editor.ERDEditorPart)4 IAction (org.eclipse.jface.action.IAction)3 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)3 ActionRegistry (org.eclipse.gef.ui.actions.ActionRegistry)2 RedoAction (org.eclipse.gef.ui.actions.RedoAction)2 SaveAction (org.eclipse.gef.ui.actions.SaveAction)2 SelectAllAction (org.eclipse.gef.ui.actions.SelectAllAction)2 UndoAction (org.eclipse.gef.ui.actions.UndoAction)2 ChangeOrderAction (org.csstudio.opibuilder.actions.ChangeOrderAction)1 ChangeOrientationAction (org.csstudio.opibuilder.actions.ChangeOrientationAction)1 CopyPropertiesAction (org.csstudio.opibuilder.actions.CopyPropertiesAction)1 CopyWidgetsAction (org.csstudio.opibuilder.actions.CopyWidgetsAction)1 CutWidgetsAction (org.csstudio.opibuilder.actions.CutWidgetsAction)1 DistributeWidgetsAction (org.csstudio.opibuilder.actions.DistributeWidgetsAction)1 PastePropertiesAction (org.csstudio.opibuilder.actions.PastePropertiesAction)1 PasteWidgetsAction (org.csstudio.opibuilder.actions.PasteWidgetsAction)1 PrintDisplayAction (org.csstudio.opibuilder.actions.PrintDisplayAction)1