private void createDiagramAction(GraphicalViewer viewer) { ActionRegistry registry = getActionRegistry(); AutoLayoutAction autoLayoutAction = new AutoLayoutAction(this, getGraphicalViewer()); registry.registerAction(autoLayoutAction); getSelectionActions().add(autoLayoutAction.getId()); IAction action = new TableSelectionAction(this, getGraphicalViewer()); registry.registerAction(action); getSelectionActions().add(action.getId()); ERDViewStyleAction erdStyledAction = new ERDViewStyleAction(this, getGraphicalViewer()); registry.registerAction(erdStyledAction); getSelectionActions().add(ERDViewStyleAction.ID); ERDRefreshAction refreshAction = new ERDRefreshAction(this, getGraphicalViewer()); registry.registerAction(refreshAction); getSelectionActions().add(refreshAction.getId()); }
/** * In order for the right-click menu to work, this shell must be registered with a view. Register * the context menu against the view. Make the view the default. * * @param view */ public void registerWithView(IViewPart view) { this.view = view; actionRegistry.registerAction(new RefreshOPIAction(this)); SingleSourceHelper.registerRCPRuntimeActions(actionRegistry, this); OPIRunnerContextMenuProvider contextMenuProvider = new OPIRunnerContextMenuProvider(viewer, this); getSite().registerContextMenu(contextMenuProvider, viewer); viewer.setContextMenu(contextMenuProvider); }
@Override protected void createActions() { super.createActions(); ActionRegistry registry = getActionRegistry(); IAction action = new MatchWidthAction(this); registry.registerAction(action); getSelectionActions().add(action.getId()); action = new MatchHeightAction(this); registry.registerAction(action); getSelectionActions().add(action.getId()); 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()); }