/** * Fill the dialog's menu. Subclasses may extend or override. * * @param dialogMenu * The dialog's menu. */ protected void fillDialogMenu(IMenuManager dialogMenu) { dialogMenu.add(new GroupMarker("SystemMenuStart")); //$NON-NLS-1$ // RAP [bm]: Tracker // dialogMenu.add(new MoveAction()); // dialogMenu.add(new ResizeAction()); if (showPersistActions) { if (isUsing34API) { dialogMenu.add(new PersistLocationAction()); dialogMenu.add(new PersistSizeAction()); } else { dialogMenu.add(new PersistBoundsAction()); } } dialogMenu.add(new Separator("SystemMenuEnd")); //$NON-NLS-1$ }
protected void fillMenu(final IMenuManager menuMgr) { menuMgr.add(new Separator("group0")); //$NON-NLS-1$ menuMgr.add(new Separator("group1")); //$NON-NLS-1$ menuMgr.add(new Separator("group2")); //$NON-NLS-1$ menuMgr.add(new GroupMarker("group2.top")); //$NON-NLS-1$ menuMgr.add(new GroupMarker("group2.middle")); //$NON-NLS-1$ menuMgr.add(new GroupMarker("group2.bottom")); //$NON-NLS-1$ menuMgr.add(new Separator("group3")); //$NON-NLS-1$ menuMgr.add(new Separator("group4")); //$NON-NLS-1$ menuMgr.add(new Separator("group5")); //$NON-NLS-1$ menuMgr.add(new Separator("group6")); //$NON-NLS-1$ menuMgr.add(new Separator("group7")); //$NON-NLS-1$ menuMgr.add(new Separator("group8")); //$NON-NLS-1$ menuMgr.add(new Separator("group9")); //$NON-NLS-1$ menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); }
protected void contextMenuAboutToShow(IMenuManager mgr) { if (mgr.isEmpty()) { mgr.add(new GroupMarker(ICommonMenuConstants.GROUP_GOTO)); mgr.add(new Separator(ICommonMenuConstants.GROUP_EDIT)); mgr.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS)); mgr.add(new Separator(ICommonMenuConstants.GROUP_PROPERTIES)); mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_COPY)); mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_CUT)); mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_PASTE)); mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_DELETE)); } actionGroups.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); actionGroups.fillContextMenu(mgr); }
private void fillContextMenu(IMenuManager menu) { menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_UNDO)); menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO, (IAction) fGlobalActions.get(ITextEditorActionConstants.UNDO)); menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT)); menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, (IAction) fGlobalActions.get(ITextEditorActionConstants.CUT)); menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, (IAction) fGlobalActions.get(ITextEditorActionConstants.COPY)); menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, (IAction) fGlobalActions.get(ITextEditorActionConstants.PASTE)); menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, (IAction) fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL)); menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE)); menu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, (IAction) fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$ }
@Override public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW)); ActionContext context = new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); // Quick views IAction action = getAction(ITypeScriptEditorActionDefinitionIds.SHOW_OUTLINE); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); action = getAction(ITypeScriptEditorActionDefinitionIds.OPEN_IMPLEMENTATION); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); }
@Override protected void fillMenuBar(final IMenuManager menubar) { menubar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); IMenuManager windowMenu = new MenuManager("Window", IWorkbenchActionConstants.M_WINDOW); menubar.add(windowMenu); windowMenu.add(resetPerspectiveAction); windowMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); windowMenu.add(new Separator()); windowMenu.add(preferencesAction); // plugin.xml in css menu.app defines a non-brandable icon. // through plugin.xml in this bundle, that help menu is hidden, and // we replace it here with another one (shorter) version IMenuManager helpMenu = new MenuManager("Help", "help-2"); menubar.add(helpMenu); helpMenu.add(onlineHelpAction); helpMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); helpMenu.add(new Separator()); helpMenu.add(raiseIssueAction); helpMenu.add(new Separator()); helpMenu.add(aboutAction); }
/** * Creates the 'File' menu. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected IMenuManager createFileMenu(IWorkbenchWindow window) { IMenuManager menu = new MenuManager(getString("_UI_Menu_File_label"), IWorkbenchActionConstants.M_FILE); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); IMenuManager newMenu = new MenuManager(getString("_UI_Menu_New_label"), "new"); newMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(newMenu); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.CLOSE.create(window)); addToMenuAndRegister(menu, ActionFactory.CLOSE_ALL.create(window)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.SAVE.create(window)); addToMenuAndRegister(menu, ActionFactory.SAVE_AS.create(window)); addToMenuAndRegister(menu, ActionFactory.SAVE_ALL.create(window)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.QUIT.create(window)); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
/** * Creates the 'Edit' menu. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected IMenuManager createEditMenu(IWorkbenchWindow window) { IMenuManager menu = new MenuManager(getString("_UI_Menu_Edit_label"), IWorkbenchActionConstants.M_EDIT); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); addToMenuAndRegister(menu, ActionFactory.UNDO.create(window)); addToMenuAndRegister(menu, ActionFactory.REDO.create(window)); menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.CUT.create(window)); addToMenuAndRegister(menu, ActionFactory.COPY.create(window)); addToMenuAndRegister(menu, ActionFactory.PASTE.create(window)); menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.DELETE.create(window)); addToMenuAndRegister(menu, ActionFactory.SELECT_ALL.create(window)); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT)); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); return menu; }
/** * Creates the 'File' menu. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IMenuManager createFileMenu(IWorkbenchWindow window) { IMenuManager menu = new MenuManager(getString("_UI_Menu_File_label"), IWorkbenchActionConstants.M_FILE); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); IMenuManager newMenu = new MenuManager(getString("_UI_Menu_New_label"), "new"); newMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(newMenu); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.CLOSE.create(window)); addToMenuAndRegister(menu, ActionFactory.CLOSE_ALL.create(window)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.SAVE.create(window)); addToMenuAndRegister(menu, ActionFactory.SAVE_AS.create(window)); addToMenuAndRegister(menu, ActionFactory.SAVE_ALL.create(window)); menu.add(new Separator()); addToMenuAndRegister(menu, ActionFactory.QUIT.create(window)); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
/** Add context menu to axes_table */ private void createContextMenu() { final MenuManager menu = new MenuManager(); menu.setRemoveAllWhenShown(true); menu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { menu.add(new AddAxisAction(operations_manager, model)); if (!axes_table.getSelection().isEmpty()) menu.add(new DeleteAxesAction(operations_manager, axes_table, model)); if (model.getEmptyAxis() != null) menu.add(new RemoveUnusedAxesAction(operations_manager, model)); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); } }); final Table table = axes_table.getTable(); table.setMenu(menu.createContextMenu(table)); }
/** * Creates and returns the Project menu. */ private MenuManager createProjectMenu() { MenuManager menu = new MenuManager( IDEWorkbenchMessages.Workbench_project, IWorkbenchActionConstants.M_PROJECT); menu.add(new Separator(IWorkbenchActionConstants.PROJ_START)); menu.add(getOpenProjectItem()); menu.add(getCloseProjectItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT)); menu.add(new Separator()); menu.add(buildAllAction); menu.add(buildProjectAction); addWorkingSetBuildActions(menu); menu.add(cleanAction); menu.add(toggleAutoBuildAction); menu.add(new GroupMarker(IWorkbenchActionConstants.BUILD_EXT)); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new GroupMarker(IWorkbenchActionConstants.PROJ_END)); menu.add(new Separator()); menu.add(projectPropertyDialogAction); return menu; }
/** * Creates and returns the Edit menu. */ private MenuManager createEditMenu() { final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_edit, IWorkbenchActionConstants.M_EDIT); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); menu.add(undoAction); menu.add(redoAction); menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); menu.add(new Separator()); menu.add(getCutItem()); menu.add(getCopyItem()); menu.add(getPasteItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); menu.add(new Separator()); menu.add(getDeleteItem()); menu.add(getSelectAllItem()); menu.add(new Separator()); menu.add(getFindItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT)); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT)); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); return menu; }
/** * Creates and returns the Help menu. */ private MenuManager createHelpMenu() { final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP); addSeparatorOrGroupMarker(menu, "group.intro"); //$NON-NLS-1$ menu.add(new GroupMarker("group.intro.ext")); //$NON-NLS-1$ addSeparatorOrGroupMarker(menu, "group.main"); //$NON-NLS-1$ menu.add(helpContentsAction); addSeparatorOrGroupMarker(menu, "group.assist"); //$NON-NLS-1$ menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START)); menu.add(new GroupMarker("group.main.ext")); //$NON-NLS-1$ addSeparatorOrGroupMarker(menu, "group.tutorials"); //$NON-NLS-1$ addSeparatorOrGroupMarker(menu, "group.tools"); //$NON-NLS-1$ addSeparatorOrGroupMarker(menu, "group.updates"); //$NON-NLS-1$ menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END)); addSeparatorOrGroupMarker(menu, IWorkbenchActionConstants.MB_ADDITIONS); // about should always be at the bottom menu.add(new Separator("group.about")); //$NON-NLS-1$ final ActionContributionItem aboutItem = new ActionContributionItem(aboutAction); aboutItem.setVisible(!Util.isMac()); menu.add(aboutItem); menu.add(new GroupMarker("group.about.ext")); //$NON-NLS-1$ menu.add(openPreferencesAction); return menu; }
protected MenuManager prepareExportMenu(ISharedImages sharedImages) { final MenuManager exportMenu = new MenuManager(DisplayMessages.getMessage("action.title.export"), sharedImages.getImageDescriptor("IMG_ETOOL_EXPORT_WIZ"), "Export"); exportMenu.add(getAction(ExportToDDLAction.ID)); exportMenu.add(getAction(ExportToImageAction.ID)); // #deleted //exportMenu.add(this.getAction(ExportToExcelAction.ID)); //exportMenu.add(this.getAction(ExportToHtmlAction.ID)); //exportMenu.add(this.getAction(ExportToDictionaryAction.ID)); //exportMenu.add(this.getAction(ExportToTranslationDictionaryAction.ID)); //exportMenu.add(this.getAction(ExportToTestDataAction.ID)); //exportMenu.add(this.getAction(ExportToJavaAction.ID)); exportMenu.add(new GroupMarker("export")); return exportMenu; }
/** * Create the file, edit, window, view, and help menu items. * * @param menuBar The application's menu bar. */ @Override protected void fillMenuBar(IMenuManager menuBar) { IMenuManager menu = createFileMenu(); if (menu != null) menuBar.add(menu); menu = createEditMenu(); if (menu != null) menuBar.add(menu); menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu = createWindowMenu(); if (menu != null) menuBar.add(menu); menu = createViewMenu(); if (menu != null) menuBar.add(menu); menu = createAdminMenu(); if (menu != null) menuBar.add(menu); menu = createHelpMenu(); if (menu != null) menuBar.add(menu); }
/** * Create the "Edit" menu. This adds the undo, redo, cut, copy, paste, * delete, select all, and collapse all options to the menu. * * @param window * @return */ protected IMenuManager createEditMenu() { IMenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_edit, IWorkbenchActionConstants.M_EDIT); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); menu.add(getGlobalAction(ActionFactory.UNDO)); menu.add(getGlobalAction(ActionFactory.REDO)); menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); menu.add(new Separator()); menu.add(getGlobalAction(ActionFactory.CUT)); menu.add(getGlobalAction(ActionFactory.COPY)); menu.add(getGlobalAction(ActionFactory.PASTE)); // menu.add(getGlobalAction(EnsembleActionFactory.PASTE_SPECIAL)); menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); menu.add(new Separator()); menu.add(getGlobalAction(ActionFactory.DELETE)); menu.add(getGlobalAction(ActionFactory.SELECT_ALL)); menu.add(new Separator()); menu.add(getGlobalAction(ActionFactory.FIND)); menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT)); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT)); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); return menu; }
/** * Create the "Help" menu. * * @param window * @return the help MenuManager */ protected IMenuManager createHelpMenu() { IMenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP); menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START)); menu.add(new Separator()); menu.add(getGlobalAction(ActionFactory.DYNAMIC_HELP)); menu.add(getGlobalAction(ActionFactory.HELP_CONTENTS)); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END)); menu.add(new Separator()); IWorkbenchAction about = getGlobalAction(ActionFactory.ABOUT); ActionContributionItem aboutItem = new ActionContributionItem(about); menu.add(aboutItem); if (Platform.OS_MACOSX.equals(Platform.getOS())) { aboutItem.setVisible(false); } return menu; }
/** * Create the context menu for an ensemble editor part. * @see EnsembleActionBarAdvisor.createEditMenu * @param menu */ public void fillContextMenu(IMenuManager menu) { menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); menu.add(new Separator()); menu.add(undoHandler); menu.add(redoHandler); menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); menu.add(new Separator()); menu.add(cutHandler); menu.add(copyHandler); menu.add(pasteHandler); // menu.add(pasteSpecialHandler); menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); menu.add(new Separator()); menu.add(deleteHandler); menu.add(selectAllHandler); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); updateActionBars(getEditorSite().getActionBars()); }
/** * Fills the given view menu with the entries managed by the * group. * * @param viewMenu the menu to fill */ public void fillViewMenu(IMenuManager viewMenu) { /* * Don't change the separator group name. * Using this name ensures that other filters * get contributed to the same group. */ viewMenu.add(new Separator("filters")); //$NON-NLS-1$ viewMenu.add(new GroupMarker(RECENT_FILTERS_GROUP_NAME)); viewMenu.add(new ShowFilterDialogAction()); fMenuManager= viewMenu; fMenuListener= new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { removePreviousLRUFilterActions(manager); addLRUFilterActions(manager); } }; fMenuManager.addMenuListener(fMenuListener); }
/** * Creates the Java plug-in's standard groups for view context menus. * * @param menu the menu manager to be populated */ public static void createStandardGroups(IMenuManager menu) { if (!menu.isEmpty()) return; menu.add(new Separator(IContextMenuConstants.GROUP_NEW)); menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO)); menu.add(new Separator(IContextMenuConstants.GROUP_OPEN)); menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW)); menu.add(new Separator(ICommonMenuConstants.GROUP_EDIT)); menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE)); menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE)); menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH)); menu.add(new Separator(IContextMenuConstants.GROUP_BUILD)); menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS)); menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP)); menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES)); }
/** * 创建编辑菜单 * @return 返回编辑菜单的 menu manager; */ private MenuManager createEditMenu() { MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.edit"), IWorkbenchActionConstants.M_EDIT); // &Edit menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); // menu.add(undoAction); // menu.add(redoAction); menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); menu.add(new Separator()); menu.add(cutAction); menu.add(copyAction); menu.add(pasteAction); menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); // menu.add(deleteAction); menu.add(renameAction); menu.add(new Separator()); menu.add(findAction); menu.add(selectAllAction); menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT)); // menu.add(new Separator()); // menu.add(preferenceAction); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); return menu; }
/** * 创建帮助菜单 * @return 返回帮助菜单的 menu manager; */ private MenuManager createHelpMenu() { MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.help"), IWorkbenchActionConstants.M_HELP); // menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START)); menu.add(helpAction); // menu.add(helpSearchAction); // menu.add(dynamicHelpAction); // menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END)); menu.add(new GroupMarker("help.keyAssist")); menu.add(new Separator()); menu.add(new GroupMarker("help.updatePlugin")); menu.add(new Separator()); menu.add(new GroupMarker("help.license")); // 关于菜单需要始终显示在最底端 menu.add(new GroupMarker("group.about")); // ActionContributionItem aboutItem = new ActionContributionItem(aboutAction); // aboutItem.setVisible(!Util.isMac()); // menu.add(aboutItem); return menu; }
protected void fillMenuBar(IMenuManager menuBar) { MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE); MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP); menuBar.add(fileMenu); // Add a group marker indicating where action set menus will appear. menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menuBar.add(helpMenu); // File fileMenu.add(newWindowAction); fileMenu.add(new Separator()); fileMenu.add(messagePopupAction); fileMenu.add(openViewAction); fileMenu.add(new Separator()); fileMenu.add(exitAction); // Help helpMenu.add(aboutAction); }
protected void fillMenuBar(IMenuManager menuBar) { MenuManager fileMenu = new MenuManager("&Qpid Manager", "qpidmanager"); MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP); menuBar.add(fileMenu); // Add a group marker indicating where action set menus will appear. menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menuBar.add(helpMenu); fileMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); fileMenu.add(new Separator()); fileMenu.add(new GroupMarker("mbeanactions")); fileMenu.add(new Separator()); fileMenu.add(exitAction); // Help helpMenu.add(_aboutAction); }
/** * 创建文件菜单 * @return 返回文件菜单的 menu manager; */ private MenuManager createFileMenu() { MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.file"), IWorkbenchActionConstants.M_FILE); // &File menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); // 添加 new.ext group,这样 IDE 中定义的 Open File... 可以显示在最顶端 menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); menu.add(new Separator()); menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT)); menu.add(new GroupMarker("xliff.switch")); menu.add(new GroupMarker("rtf.switch")); menu.add(new GroupMarker("xliff.split")); menu.add(new Separator()); // 设置保存文件记录条数为 5 条 WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 5); menu.add(new GroupMarker(IWorkbenchActionConstants.HISTORY_GROUP)); menu.add(exitAction); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
/** * 创建编辑菜单 * @return 返回编辑菜单的 menu manager; */ private MenuManager createEditMenu() { MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.edit"), IWorkbenchActionConstants.M_EDIT); // &Edit menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); menu.add(new Separator()); menu.add(cutAction); menu.add(copyAction); menu.add(pasteAction); menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); menu.add(new Separator()); menu.add(findAction); menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT)); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); menu.add(new Separator()); menu.add(new GroupMarker("taskEdit")); return menu; }
/** * 创建工具菜单 * @return 返回工具菜单的 menu manager; */ private MenuManager createToolMenu() { MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.tool"), "net.heartsome.cat.ts.ui.menu.tool") { @Override public boolean isVisible() { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (workbenchWindow == null) return false; IWorkbenchPage activePage = workbenchWindow.getActivePage(); if (activePage == null) return false; if (activePage.getPerspective().getId().contains("net.heartsome.cat.ts.perspective")) return true; return false; } }; // &Tool menu.add(new GroupMarker("pluginConfigure")); menu.add(new GroupMarker("preference.groupMarker")); // menu.add(preferenceAction); return menu; }
/** * 创建编辑菜单 * @return 返回编辑菜单的 menu manager; */ private MenuManager createEditMenu() { MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.edit"), IWorkbenchActionConstants.M_EDIT); // &Edit menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); // menu.add(undoAction); // menu.add(redoAction); menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); menu.add(new Separator()); menu.add(cutAction); menu.add(copyAction); menu.add(pasteAction); menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); menu.add(new Separator()); menu.add(findAction); menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT)); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); return menu; }
public void createPartControl( Composite parent ) { ChartUIUtil.bindHelp( parent, ChartHelpContextIds.VIEW_CHART_EXAMPLE ); instance = new ChartExamples( parent ); final IActionBars actionBars = getViewSite( ).getActionBars( ); IToolBarManager toolbarManager = actionBars.getToolBarManager( ); Tools tools[] = ChartExamples.tools; String group = tools[0].group; toolbarManager.add( new GroupMarker( group ) ); for ( int i = 0; i < tools.length; i++ ) { Tools tool = tools[i]; if ( !tool.group.equals( group ) ) { toolbarManager.add( new Separator( ) ); toolbarManager.add( new GroupMarker( tool.group ) ); } group = tool.group; toolbarManager.appendToGroup( group, initActions( tool, parent ) ); } actionBars.updateActionBars( ); }
/** * Creates and returns the Help menu. */ private MenuManager createHelpMenu( ) { MenuManager menu = new MenuManager( DesignerWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP ); // See if a welcome or introduction page is specified if ( introAction != null ) menu.add( introAction ); // else if ( quickStartAction != null ) // menu.add( quickStartAction ); menu.add( helpContentsAction ); // if ( tipsAndTricksAction != null ) // menu.add( tipsAndTricksAction ); menu.add( new GroupMarker( "group.tutorials" ) ); //$NON-NLS-1$ menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) ); menu.add( new Separator( "group.about" ) ); //$NON-NLS-1$ menu.add( aboutAction ); menu.add( new GroupMarker( "group.about.ext" ) ); //$NON-NLS-1$ return menu; }
@Override protected void fillCoolBar(ICoolBarManager cbManager) { cbManager.add(new GroupMarker("group.file")); //$NON-NLS-1$ { // File Group IToolBarManager fileToolBar = new ToolBarManager(cbManager.getStyle()); fileToolBar.add(new Separator(IWorkbenchActionConstants.NEW_GROUP)); fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT)); fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_GROUP)); fileToolBar.add(getAction(ActionFactory.SAVE.getId())); // Add to the cool bar manager cbManager.add(new ToolBarContributionItem(fileToolBar, IWorkbenchActionConstants.TOOLBAR_FILE)); } cbManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); cbManager.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR)); }
/** * Creates and returns the 'File' menu. * * @return the created menu manager */ private MenuManager createFileMenu() { MenuManager menu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE); //$NON-NLS-1$ menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); menu.add(getAction(ActionFactory.CLOSE.getId())); menu.add(getAction(ActionFactory.CLOSE_ALL.getId())); // menu.add(closeAllSavedAction); menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT)); menu.add(new Separator()); menu.add(getAction(ActionFactory.SAVE.getId())); menu.add(getAction(ActionFactory.SAVE_AS.getId())); menu.add(getAction(ActionFactory.SAVE_ALL.getId())); menu.add(getAction(ActionFactory.REVERT.getId())); menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getActionBarConfigurer().getWindowConfigurer().getWindow())); menu.add(new GroupMarker(IWorkbenchActionConstants.MRU)); menu.add(new Separator()); menu.add(getAction(ActionFactory.QUIT.getId())); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
/** * Creates and returns the 'Edit' menu. * * @return the created menu manager */ private MenuManager createEditMenu() { MenuManager menu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT); //$NON-NLS-1$ menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); menu.add(getAction(ActionFactory.UNDO.getId())); menu.add(getAction(ActionFactory.REDO.getId())); menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); menu.add(getAction(ActionFactory.CUT.getId())); menu.add(getAction(ActionFactory.COPY.getId())); menu.add(getAction(ActionFactory.PASTE.getId())); menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); menu.add(getAction(ActionFactory.SELECT_ALL.getId())); menu.add(new Separator()); menu.add(getAction(ActionFactory.FIND.getId())); menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT)); menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT)); menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); return menu; }
private void fillContextMenu(IMenuManager manager, List<IContributionItem> contributionItems){ manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); for (IContributionItem contributionItem : contributionItems) { if (contributionItem == null) { manager.add(new Separator()); continue; } else if (contributionItem instanceof ActionContributionItem) { ActionContributionItem ac = (ActionContributionItem) contributionItem; if (ac.getAction() instanceof RestrictedAction) { ((RestrictedAction) ac.getAction()).reflectRight(); } } contributionItem.update(); manager.add(contributionItem); } }