public void buildContextMenu(IMenuManager menu) { GEFActionConstants.addStandardActionGroups(menu); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.UNDO.getId())); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.REDO.getId())); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.DELETE.getId())); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionIdConstants.MODIFY_ACTION_ID)); IAction saveAction = getAction(ActionFactory.SAVE.getId()); saveAction.setImageDescriptor(Activator.getImageDescriptor(Activator.IMAGE_SAVE)); menu.appendToGroup(GEFActionConstants.GROUP_SAVE, saveAction); menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, createExportMenuManager()); menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.IMPORT_DATABASE_ACTION_ID)); menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.CHANGE_DATABASE_ACTION_ID)); }
/** * Create actions managed by this contributor. * * @see org.eclipse.gef.ui.actions.ActionBarContributor#buildActions() */ protected void buildActions() { addRetargetAction(new DeleteRetargetAction()); addRetargetAction(new UndoRetargetAction()); addRetargetAction(new RedoRetargetAction()); IWorkbenchWindow iww = getPage().getWorkbenchWindow(); addRetargetAction((RetargetAction)ActionFactory.COPY.create(iww)); addRetargetAction((RetargetAction)ActionFactory.PASTE.create(iww)); // Registering the zooming actions at the menu bar. addRetargetAction(new ZoomInRetargetAction()); addRetargetAction(new ZoomOutRetargetAction()); addRetargetAction(new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY, GEFMessages.ToggleGrid_Label, IAction.AS_CHECK_BOX)); }
/** * Just to make the zooming actions for the editor via the context menu. */ @Override public void contributeToMenu(IMenuManager menuManager) { // TODO Auto-generated method stub super.contributeToMenu(menuManager); // Adding the zooming to the workbench while our editor is active. MenuManager zoomMenu = new MenuManager("Zoom"); IAction zoomInAction = getAction(GEFActionConstants.ZOOM_IN); IAction zoomOutAction = getAction(GEFActionConstants.ZOOM_OUT); if (zoomInAction != null && zoomOutAction != null) { zoomMenu.add(zoomInAction); zoomMenu.add(zoomOutAction); menuManager.insertAfter(IWorkbenchActionConstants.M_EDIT,zoomMenu); } MenuManager mnu = new MenuManager ("view"); mnu.add(getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY)); menuManager.insertAfter(IWorkbenchActionConstants.M_EDIT, mnu); }
/** * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(org.eclipse.jface.action.IToolBarManager) */ public void contributeToToolBar(IToolBarManager toolBarManager) { toolBarManager.add(getAction(ActionFactory.UNDO.getId())); toolBarManager.add(getAction(ActionFactory.REDO.getId())); toolBarManager.add(new Separator()); toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ZOOM_IN)); toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ZOOM_OUT)); toolBarManager.add(new Separator()); // 수평 방향의 정렬 액션의 추가 toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_LEFT)); toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_CENTER)); toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_RIGHT)); toolBarManager.add(new Separator()); // 수직 방향의 정렬 액션의 추가 toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_TOP)); toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_MIDDLE)); toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_BOTTOM)); toolBarManager.add(new Separator()); toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.MATCH_WIDTH)); toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.MATCH_HEIGHT)); }
/** * @see org.eclipse.gef.ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager) */ public void buildContextMenu(IMenuManager manager) { GEFActionConstants.addStandardActionGroups(manager); super.buildContextMenu(manager); IAction action = getActionRegistry().getAction(AddInteractionOperandAction.ADD_INTERACTIONOPERAND_ACTIONID); if (action.isEnabled()) { manager.appendToGroup(GEFActionConstants.GROUP_ADD, action); } action = getActionRegistry().getAction(AddCoveredLifelineAction.ADD_COVERED_LIFELINE_ACTIONID); if (action.isEnabled()) { manager.appendToGroup(GEFActionConstants.GROUP_ADD, action); } action = getActionRegistry().getAction(RemoveCoveredLifelineAction.REMOVE_COVERED_LIFELINE_ACTIONID); if (action.isEnabled()) { manager.appendToGroup(GEFActionConstants.GROUP_ADD, action); } }
/** * Builds the actions. * * @see org.eclipse.gef.ui.actions.ActionBarContributor#buildActions() */ protected void buildActions(IActionBars bars) { addRetargetAction(new UndoRetargetAction()); addRetargetAction(new RedoRetargetAction()); addRetargetAction(new DeleteRetargetAction()); // addRetargetAction(new PrintAction()); addRetargetAction(new ZoomInRetargetAction()); addRetargetAction(new ZoomOutRetargetAction()); addRetargetAction(new RetargetAction(GEFActionConstants.TOGGLE_RULER_VISIBILITY, Messages.JrxmlEditorContributor_show_ruler, IAction.AS_CHECK_BOX)); addRetargetAction(new RetargetAction(SnapToGuidesAction.ID, Messages.common_snap_to_guides, IAction.AS_CHECK_BOX)); addRetargetAction(new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY, Messages.common_show_grid, IAction.AS_CHECK_BOX)); addRetargetAction(new RetargetAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY, Messages.common_snap_to_geometry, IAction.AS_CHECK_BOX)); addRetargetAction(new RetargetAction(SnapToGridAction.ID, Messages.common_snap_to_grid, IAction.AS_CHECK_BOX)); addRetargetAction(new RetargetAction(SizeGridAction.ID, Messages.JrxmlEditorContributor_grid_size)); List<RetargetAction> ractions = JaspersoftStudioPlugin.getDecoratorManager().buildMenuActions(); for (RetargetAction r : ractions) addRetargetAction(r); }
public void contributeToMenu(IMenuManager manager) { super.contributeToMenu(manager); MenuManager viewMenu = new MenuManager(Messages.JrxmlEditorContributor_view); viewMenu.add(getAction(GEFActionConstants.ZOOM_IN)); viewMenu.add(getAction(GEFActionConstants.ZOOM_OUT)); viewMenu.add(new Separator()); viewMenu.add(getAction(GEFActionConstants.TOGGLE_RULER_VISIBILITY)); viewMenu.add(getAction(SnapToGuidesAction.ID)); viewMenu.add(new Separator()); viewMenu.add(getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY)); viewMenu.add(getAction(SnapToGridAction.ID)); viewMenu.add(getAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY)); viewMenu.add(getAction(SizeGridAction.ID)); JaspersoftStudioPlugin.getDecoratorManager().contribute2Menu(getActionRegistry(), viewMenu); manager.insertAfter(IWorkbenchActionConstants.M_EDIT, viewMenu); }
@Override public void buildContextMenu(IMenuManager menu) { super.buildContextMenu(menu); // ----------------------------------------------------------- IAction action = getActionRegistry().getAction(CreateStyleAction.ID); if (action != null && action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_ADD, action); action = getActionRegistry().getAction(CreateStyleTemplateReferenceAction.ID); if (action != null && action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_ADD, action); action = getActionRegistry().getAction(ActionFactory.DELETE.getId()); if (action != null && action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action); action = getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT); if (action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action); }
@Override public void contributeItemsToEditorTopToolbar(IToolBarManager toolbarManager) { toolbarManager.add(getActionRegistry().getAction(CompileAction.ID)); toolbarManager.add(getActionRegistry().getAction(DatasetAction.ID)); toolbarManager.add(new Separator()); toolbarManager.add(getActionRegistry().getAction(GEFActionConstants.ZOOM_IN)); toolbarManager.add(getActionRegistry().getAction(GEFActionConstants.ZOOM_OUT)); RZoomComboContributionItem zoomItem = new RZoomComboContributionItem(getEditorSite().getPage()); GraphicalViewer graphicalViewer = getGraphicalViewer(); ZoomManager property = (ZoomManager) graphicalViewer.getProperty(ZoomManager.class.toString()); if (property != null) zoomItem.setZoomManager(property); zoomItem.setEnabled(true); toolbarManager.add(zoomItem); toolbarManager.add(new Separator()); // Contributed actions List<AContributorAction> contributedActions = JaspersoftStudioPlugin.getExtensionManager().getActions(); for (AContributorAction a : contributedActions) { a.setJrConfig((JasperReportsConfiguration) getGraphicalViewer().getProperty("JRCONTEXT")); toolbarManager.add(a); } // Global "View" menu items toolbarManager.add(new ViewSettingsDropDownAction(getActionRegistry())); }
@Override public void setActivePage(IEditorPart activeEditor) { final MainDiagramEditor editor = (MainDiagramEditor) activeEditor; final ERDiagramActionBarContributor actionBarContributor = editor.getActionBarContributor(); final IActionBars actionBars = getActionBars(); actionBars.clearGlobalActionHandlers(); actionBars.getToolBarManager().removeAll(); actionBarContributor.init(actionBars, editor.getEditorSite().getPage()); actionBarContributor.setActiveEditor(editor); final ZoomComboContributionItem item = (ZoomComboContributionItem) getActionBars().getToolBarManager().find(GEFActionConstants.ZOOM_TOOLBAR_WIDGET); if (item != null) { final ZoomManager zoomManager = (ZoomManager) editor.getAdapter(ZoomManager.class); item.setZoomManager(zoomManager); } getActionBars().updateActionBars(); }
@Override public void buildContextMenu(IMenuManager menu) { GEFActionConstants.addStandardActionGroups(menu); Request request = new Request(EnsembleRequestConstants.REQ_CONTEXT_MENU); Point cursor = getCursorLocation(getViewer().getControl()); EditPart target = calculateTargetEditPart(cursor, request); if (target != null) { EditPolicy policy = target.getEditPolicy(ContextMenuEditPolicy.CONTEXT_MENU_ROLE); if (policy instanceof ContextMenuEditPolicy) { Point local = new Point(0, 0); if (target instanceof GraphicalEditPart) { local = ((GraphicalEditPart)target).getFigure().getBounds().getTopLeft(); local.negate(); local.translate(cursor); } try { ((ContextMenuEditPolicy)policy).buildContextMenu(local, menu); } catch (Exception e) { LogUtil.error(e); } } } }
/** * This is the method that builds the context menu. * * @param menu * The IMenuManager to which actions for the palette's context * menu can be added. * @see ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager) */ public void buildContextMenu(IMenuManager menu) { GEFActionConstants.addStandardActionGroups(menu); EditPart selectedPart = (EditPart) getPaletteViewer() .getSelectedEditParts().get(0); IPinnableEditPart pinnablePart = (IPinnableEditPart) selectedPart .getAdapter(IPinnableEditPart.class); if (pinnablePart != null && pinnablePart.canBePinned()) { menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, new PinDrawerAction(pinnablePart)); } menu.appendToGroup(GEFActionConstants.GROUP_VIEW, new LayoutAction( getPaletteViewer().getPaletteViewerPreferences())); menu.appendToGroup(GEFActionConstants.GROUP_VIEW, new ChangeIconSizeAction(getPaletteViewer() .getPaletteViewerPreferences())); if (getPaletteViewer().getCustomizer() != null) { menu.appendToGroup(GEFActionConstants.GROUP_REST, new CustomizeAction(getPaletteViewer())); } menu.appendToGroup(GEFActionConstants.GROUP_REST, new SettingsAction( getPaletteViewer())); }
/** {@inheritDoc} */ @Override public void buildContextMenu(final IMenuManager menu) { GEFActionConstants.addStandardActionGroups(menu); IAction action; action = getActionRegistry().getAction(ActionFactory.UNDO.getId()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); action = getActionRegistry().getAction(ActionFactory.REDO.getId()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); action = getActionRegistry().getAction(StepInAction.STEP_IN_ID); menu.appendToGroup(GEFActionConstants.GROUP_VIEW, action); action = getActionRegistry().getAction(StepInNewTabAction.STEP_IN_NEW_TAB_ID); menu.appendToGroup(GEFActionConstants.GROUP_VIEW, action); action = getActionRegistry().getAction(StepInNewPageAction.STEP_IN_NEW_PAGE_ID); menu.appendToGroup(GEFActionConstants.GROUP_VIEW, action); action = getActionRegistry().getAction(StepOutAction.STEP_OUT_ID); menu.appendToGroup(GEFActionConstants.GROUP_VIEW, action); action = getActionRegistry().getAction(FulfillRolesAction.FULFILL_ROLES_ID); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action); action = getActionRegistry().getAction(RelationshipConstraintsAction.RLSHIP_CONSTRAINTS_ID); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action); }
/** {@inheritDoc} */ @Override protected void buildActions() { addRetargetAction(new UndoRetargetAction()); addRetargetAction(new RedoRetargetAction()); addRetargetAction(new DeleteRetargetAction()); // add grid icon to grid action final RetargetAction gridAction = new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY, "", IAction.AS_CHECK_BOX); gridAction.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/grid.png")); gridAction.setToolTipText(TOGGLE_GRID_LABEL); addRetargetAction(gridAction); final RetargetAction snapAction = new RetargetAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY, "", IAction.AS_CHECK_BOX); snapAction.setImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/grid-snap.png")); snapAction.setToolTipText(TOGGLE_SNAP_TO_GERMETRY_LABEL); addRetargetAction(snapAction); }
public Object getAdapter( final Object adaptableObject, Class adapterType ) { if ( ( adaptableObject instanceof ImageHandle ) && adapterType == IMenuListener.class ) { return new ISchematicMenuListener( ) { public void menuAboutToShow( IMenuManager manager ) { manager.appendToGroup( GEFActionConstants.GROUP_EDIT, new ReloadImageAction( adaptableObject ) ); } public void setActionRegistry( ActionRegistry actionRegistry ) { } }; } return null; }
public void buildContextMenu( IMenuManager menu ) { GEFActionConstants.addStandardActionGroups( menu ); IChoiceSet choiceSet = null; choiceSet = ChoiceSetFactory.getElementChoiceSet( ReportDesignConstants.REPORT_DESIGN_ELEMENT, ReportDesignHandle.UNITS_PROP ); if (choiceSet == null ) { return ; } int len = choiceSet.getChoices().length; for (int i=0; i<len; i++) { IChoice ch = choiceSet.getChoices()[i]; ChangeRulerUnitAction action = new ChangeRulerUnitAction(ch.getName(), ch.getDisplayName()); menu.appendToGroup( GEFActionConstants.GROUP_ADD, action ); } }
@Override public void setActivePage(IEditorPart activeEditor) { IActionBars actionBars = this.getActionBars(); actionBars.clearGlobalActionHandlers(); actionBars.getToolBarManager().removeAll(); BODesignerEditor editor = (BODesignerEditor) activeEditor; BODiagramActionBarContributor activeContributor =editor.getActionBarContributor(); if (this.zoomComboContributionItem == null) { this.zoomComboContributionItem = new ZoomComboContributionItem( this.getPage()); } activeContributor.contributeToToolBar(actionBars.getToolBarManager(), this.zoomComboContributionItem); activeContributor.setActiveEditor(editor); ZoomComboContributionItem item = (ZoomComboContributionItem) getActionBars() .getToolBarManager().find( GEFActionConstants.ZOOM_TOOLBAR_WIDGET); if (item != null) { ZoomManager zoomManager = (ZoomManager) editor .getAdapter(ZoomManager.class); item.setZoomManager(zoomManager); } actionBars.updateActionBars(); }
public void buildContextMenu(IMenuManager menu) { GEFActionConstants.addStandardActionGroups(menu); IAction action; action = getActionRegistry().getAction(ActionFactory.UNDO.getId()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); action = getActionRegistry().getAction(ActionFactory.REDO.getId()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); action = getActionRegistry().getAction(ActionFactory.DELETE.getId()); if (action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action); action = getActionRegistry().getAction(AddIndicatorGroupAction.ADDINDICATORGROUP); if (action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_REST, action); action = getActionRegistry().getAction(EditIndicatorGroupsAction.EDITINDICATORGROUPSACTION); if (action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_REST, action); action = getActionRegistry().getAction(EditMetadataAction.EDITMETADATAACTION); if (action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_REST, action); }
/** Undo, Redo, and Delete */ private void addEditActions(final IMenuManager menu) { GEFActionConstants.addStandardActionGroups(menu); IAction undoAction = registry.getAction(ActionFactory.UNDO.getId()); undoAction.setImageDescriptor(Icon.UNDO.descriptor()); undoAction.setDisabledImageDescriptor(Icon.UNDO_DISABLED.descriptor()); IAction redoAction = registry.getAction(ActionFactory.REDO.getId()); redoAction.setImageDescriptor(Icon.REDO.descriptor()); redoAction.setDisabledImageDescriptor(Icon.REDO_DISABLED.descriptor()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, undoAction); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, redoAction); IAction deleteAction = registry.getAction(ActionFactory.DELETE.getId()); deleteAction.setText(M.Delete); deleteAction.setImageDescriptor(Icon.DELETE.descriptor()); deleteAction.setDisabledImageDescriptor(Icon.DELETE_DISABLED.descriptor()); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, deleteAction); }
@Override public void buildContextMenu(IMenuManager menu) { GEFActionConstants.addStandardActionGroups(menu); IAction rAction; rAction = getActionRegistry().getAction("OSETS_FREFRESH_COMMANDS"); if (rAction != null) { menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, rAction); } rAction = getActionRegistry().getAction("OSETS_DREFRESH_COMMANDS"); if (rAction != null) { menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, rAction); } rAction = getActionRegistry().getAction("OSETS_CREFRESH_COMMANDS"); if (rAction != null) { menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, rAction); } IAction eAction; eAction = getActionRegistry().getAction("OSETS_EXPORT_COMMANDS"); menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, eAction); IAction action; action = getActionRegistry().getAction("OSETS_COMMANDS"); menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, action); IAction cAction; cAction = getActionRegistry().getAction("OSETS_CLEAR_COMMANDS"); menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, cAction); IAction uAction; uAction = getActionRegistry().getAction("OSETS_UID_COMMANDS"); menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, uAction); IAction aAction; aAction = getActionRegistry().getAction("OSETS_API_COMMANDS"); menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, aAction); IAction iAction; iAction = getActionRegistry().getAction("OSETS_INT_COMMANDS"); menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, iAction); }
@Override protected void buildActions() { IWorkbenchWindow iww = getPage().getWorkbenchWindow(); addRetargetAction(new UndoRetargetAction()); addRetargetAction(new RedoRetargetAction()); addRetargetAction(new DeleteRetargetAction()); addRetargetAction(new ZoomInRetargetAction()); addRetargetAction(new ZoomOutRetargetAction()); addRetargetAction(new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY, GEFMessages.ToggleGrid_Label, IAction.AS_CHECK_BOX)); addRetargetAction(new RetargetAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY, GEFMessages.ToggleSnapToGeometry_Label, IAction.AS_CHECK_BOX)); addRetargetAction(new RetargetAction(ActionFactory.SELECT_ALL.getId(), GEFMessages.SelectAllAction_Label)); addRetargetAction((RetargetAction)ActionFactory.COPY.create(iww)); addRetargetAction((RetargetAction)ActionFactory.PASTE.create(iww)); addRetargetAction(new ClearEdgeBenpointLayoutRetargetAction(iww)); }
public void contributeToToolBar(IToolBarManager toolBarManager) { toolBarManager.add(getAction(ActionFactory.UNDO.getId())); toolBarManager.add(getAction(ActionFactory.REDO.getId())); toolBarManager.add(getAction(ActionFactory.DELETE.getId())); toolBarManager.add(new Separator()); toolBarManager.add(getAction(GEFActionConstants.ZOOM_IN)); toolBarManager.add(getAction(GEFActionConstants.ZOOM_OUT)); toolBarManager.add(new ZoomComboContributionItem(getPage())); toolBarManager.add(getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY)); toolBarManager.add(getAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY)); toolBarManager.add(getAction(ActionFactory.COPY.getId())); toolBarManager.add(getAction(ActionFactory.PASTE.getId())); toolBarManager.add(new Separator()); toolBarManager.add(getAction(ClearEdgeBendpointLayoutAction.ID)); }
private void buildActions(IActionBars actionBars) { addRetargetAction(new UndoRetargetAction()); addRetargetAction(new RedoRetargetAction()); addRetargetAction(new DeleteRetargetAction()); RetargetAction showGridAction=new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY, "Grid"); showGridAction.setImageDescriptor(Activator.getImageDescriptorFromPlugin("icons/grid.png")); addRetargetAction(showGridAction); }
public void contributeToToolBar(IToolBarManager toolBarManager) { toolBarManager.add(getAction(ActionFactory.DELETE.getId())); toolBarManager.add(getAction(ActionFactory.UNDO.getId())); toolBarManager.add(getAction(ActionFactory.REDO.getId())); toolBarManager.add(new Separator()); toolBarManager.add(getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY)); toolBarManager.add(new Separator()); toolBarManager.add(getAction(GEFActionConstants.ZOOM_IN)); toolBarManager.add(getAction(GEFActionConstants.ZOOM_OUT)); String[] zoomStrings = new String[] { ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH }; toolBarManager.add(new ZoomComboContributionItem(getPage(), zoomStrings)); }
@Override public void setActivePage(IEditorPart activeEditor) { IActionBars actionBars = this.getActionBars(); actionBars.clearGlobalActionHandlers(); actionBars.getToolBarManager().removeAll(); ERDiagramEditor editor = (ERDiagramEditor) activeEditor; ERDiagramActionBarContributor activeContributor = editor .getActionBarContributor(); if (this.zoomComboContributionItem == null) { this.zoomComboContributionItem = new ZoomComboContributionItem( this.getPage()); } activeContributor.setActiveEditor(editor); EditPart editPart = editor.getGraphicalViewer().getContents(); ERDiagram diagram = (ERDiagram) editPart.getModel(); activeContributor.contributeToToolBar(diagram, actionBars.getToolBarManager(), this.zoomComboContributionItem); ZoomComboContributionItem item = (ZoomComboContributionItem) getActionBars() .getToolBarManager().find( GEFActionConstants.ZOOM_TOOLBAR_WIDGET); if (item != null) { ZoomManager zoomManager = (ZoomManager) editor .getAdapter(ZoomManager.class); item.setZoomManager(zoomManager); } actionBars.updateActionBars(); }
/** * Called when the context menu is about to show. Actions, whose state is * enabled, will appear in the context menu. * * @see org.eclipse.gef.ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager) */ public void buildContextMenu(IMenuManager menu) { // Add standard action groups to the menu GEFActionConstants.addStandardActionGroups(menu); IAction action; action = actionRegistry.getAction(ActionFactory.UNDO.getId()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); action = actionRegistry.getAction(ActionFactory.REDO.getId()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); // Adding the delete in a special way. deleteActionItem = actionRegistry.getAction(ActionFactory.DELETE.getId()); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, deleteActionItem); // Adding the delete in a special way. copyActionItem = actionRegistry.getAction(ActionFactory.COPY.getId()); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, copyActionItem); // Adding the delete in a special way. pasteActionItem = actionRegistry.getAction(ActionFactory.PASTE.getId()); menu.appendToGroup(GEFActionConstants.GROUP_EDIT, pasteActionItem); // Add actions to the menu // menu.appendToGroup(GEFActionConstants.GROUP_UNDO, // target group id // getAction(ActionFactory.UNDO.getId())); // action to add // menu.appendToGroup(GEFActionConstants.GROUP_UNDO, // getAction(ActionFactory.REDO.getId())); // menu.appendToGroup(GEFActionConstants.GROUP_EDIT, // getAction(ActionFactory.DELETE.getId())); }
/** * @see org.eclipse.gef.ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager) */ public void buildContextMenu(IMenuManager manager) { GEFActionConstants.addStandardActionGroups(manager); IAction action; action = getActionRegistry().getAction(ChangeForkAndJoinAction.CHANGE_ACTION_ID); if (action != null) { action.setText(UMLMessage.LABEL_CHANGE); if (action.isEnabled()) manager.appendToGroup(GEFActionConstants.GROUP_REST, action); } IMenuManager submenuManager = new MenuManager("Activity Partition Direction"); manager.add(submenuManager);//.insertAfter(GEFActionConstants.GROUP_COPY, submenuManager); submenuManager.add(new Separator("Partition Direction")); action = getActionRegistry().getAction(ChangeHorizontalDirectionAction.CHANGE_HORIZONTAL_DIRECTION_ACTION_ID); if (action != null) { action.setText(ChangeHorizontalDirectionAction.CHANGE_HORIZONTAL_DIRECTION_ACTION); if (action.isEnabled()) submenuManager.appendToGroup("Partition Direction", action); } action = getActionRegistry().getAction(ChangeVerticalDirectionAction.CHANGE_VERTICAL_DIRECTION_ACTION_ID); if (action != null) { action.setText(ChangeVerticalDirectionAction.CHANGE_VERTICAL_DIRECTION_ACTION); if (action.isEnabled()) submenuManager.appendToGroup("Partition Direction", action); } super.buildContextMenu(manager); }
private void addZoom(IToolBarManager tbm) { tbm.add(getAction(GEFActionConstants.ZOOM_IN)); tbm.add(getAction(GEFActionConstants.ZOOM_OUT)); if (zoomCombo == null) zoomCombo = new RZoomComboContributionItem(getPage()); zoomCombo.setEnabled(true); tbm.add(zoomCombo); tbm.update(true); }
private void removeZoom(IToolBarManager tbm) { tbm.remove(GEFActionConstants.ZOOM_IN); tbm.remove(GEFActionConstants.ZOOM_OUT); tbm.remove(zoomCombo.getId()); zoomCombo.setEnabled(false); tbm.update(true); }
public void contributeToMenu(IMenuManager manager) { super.contributeToMenu(manager); MenuManager viewMenu = new MenuManager(Messages.JrxmlEditorContributor_view); viewMenu.add(getAction(GEFActionConstants.ZOOM_IN)); viewMenu.add(getAction(GEFActionConstants.ZOOM_OUT)); }
@Override public void buildContextMenu(IMenuManager menu) { GEFActionConstants.addStandardActionGroups(menu); IAction action = getActionRegistry().getAction(ActionFactory.UNDO.getId()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); action = getActionRegistry().getAction(ActionFactory.REDO.getId()); menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action); // ---------------------------------------- action = getActionRegistry().getAction(ActionFactory.CUT.getId()); if (action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_COPY, action); action = getActionRegistry().getAction(ActionFactory.COPY.getId()); if (action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_COPY, action); action = getActionRegistry().getAction(ActionFactory.PASTE.getId()); if (action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_COPY, action); // ------------------------------ action = getActionRegistry().getAction(ShowPropertyViewAction.ID); if (action.isEnabled()) menu.appendToGroup(GEFActionConstants.GROUP_VIEW, action); }
/** * @param diagramViewer */ public ToggleGridVisibilityAction(GraphicalViewer diagramViewer) { super(InstallOptionsPlugin.getResourceString("toggle.grid.label"), AS_CHECK_BOX); //$NON-NLS-1$ this.mDiagramViewer = diagramViewer; setToolTipText(InstallOptionsPlugin.getResourceString("toggle.grid.tooltip")); //$NON-NLS-1$ setId(GEFActionConstants.TOGGLE_GRID_VISIBILITY); setActionDefinitionId(GEFActionConstants.TOGGLE_GRID_VISIBILITY); setChecked(isChecked()); }
/** * This method sets shortcuts for actions. * */ private void configureKeyboardShortcuts() { getGraphicalViewer().getKeyHandler(); GraphicalViewerKeyHandler keyHandler = new GraphicalViewerKeyHandler( getGraphicalViewer()); keyHandler.put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry() .getAction(GEFActionConstants.DIRECT_EDIT)); keyHandler.put( KeyStroke.getPressed(SWT.CR, '\r', 0), getActionRegistry().getAction( CreateAttributeOperationAction.CREATE_A_M_ID)); getGraphicalViewer().setKeyHandler(keyHandler); }
/** * Contributes to the given tool bar(workbench actionbar) the actions. * */ @Override public void contributeToToolBar(final IToolBarManager toolBarManager) { super.contributeToToolBar(toolBarManager); toolBarManager.add(getAction(ActionFactory.UNDO.getId())); toolBarManager.add(getAction(ActionFactory.REDO.getId())); toolBarManager.add(getAction(ActionFactory.DELETE.getId())); toolBarManager.add(getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY)); toolBarManager.add(getAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY)); }