@Override protected void makeActions ( final IWorkbenchWindow window ) { this.exitAction = ActionFactory.QUIT.create ( window ); register ( this.exitAction ); this.aboutAction = ActionFactory.ABOUT.create ( window ); register ( this.aboutAction ); this.newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create ( window ); register ( this.newWindowAction ); register ( ActionFactory.NEW_WIZARD_DROP_DOWN.create ( window ) ); register ( ActionFactory.NEW.create ( window ) ); register ( ActionFactory.INTRO.create ( window ) ); register ( ActionFactory.SAVE.create ( window ) ); this.showViews = ContributionItemFactory.VIEWS_SHORTLIST.create ( window ); this.newWizards = ContributionItemFactory.NEW_WIZARD_SHORTLIST.create ( window ); register ( ActionFactory.NEW_EDITOR.create ( window ) ); register ( ActionFactory.PREFERENCES.create ( window ) ); }
/** * Creates and returns the Window menu. */ private MenuManager createWindowMenu() { MenuManager menu = new MenuManager( IDEWorkbenchMessages.Workbench_window, IWorkbenchActionConstants.M_WINDOW); menu.add(newWindowAction); menu.add(newEditorAction); menu.add(new Separator()); addPerspectiveActions(menu); menu.add(new Separator()); addKeyboardShortcuts(menu); Separator sep = new Separator(IWorkbenchActionConstants.MB_ADDITIONS); sep.setVisible(!Util.isMac()); menu.add(sep); // See the comment for quit in createFileMenu ActionContributionItem openPreferencesItem = new ActionContributionItem( openPreferencesAction); openPreferencesItem.setVisible(!Util.isMac()); menu.add(openPreferencesItem); menu.add(ContributionItemFactory.OPEN_WINDOWS.create(getWindow())); return menu; }
/** * Adds the perspective actions to the specified menu. */ private void addPerspectiveActions(MenuManager menu) { { String openText = IDEWorkbenchMessages.Workbench_openPerspective; MenuManager changePerspMenuMgr = new MenuManager(openText, "openPerspective"); //$NON-NLS-1$ IContributionItem changePerspMenuItem = ContributionItemFactory.PERSPECTIVES_SHORTLIST .create(getWindow()); changePerspMenuMgr.add(changePerspMenuItem); menu.add(changePerspMenuMgr); } { MenuManager showViewMenuMgr = new MenuManager( IDEWorkbenchMessages.Workbench_showView, "showView"); //$NON-NLS-1$ IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST .create(getWindow()); showViewMenuMgr.add(showViewMenu); menu.add(showViewMenuMgr); } menu.add(new Separator()); menu.add(editActionSetAction); menu.add(savePerspectiveAction); menu.add(resetPerspectiveAction); menu.add(closePerspAction); menu.add(closeAllPerspsAction); }
/** * Creates and returns the Window menu. */ private MenuManager createWindowMenu() { MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_window, IWorkbenchActionConstants.M_WINDOW); menu.add(newWindowAction); menu.add(newEditorAction); menu.add(new Separator()); addPerspectiveActions(menu); menu.add(new Separator()); Separator sep = new Separator(IWorkbenchActionConstants.MB_ADDITIONS); sep.setVisible(!Util.isMac()); menu.add(sep); menu.add(ContributionItemFactory.OPEN_WINDOWS.create(getWindow())); return menu; }
/** * Adds the perspective actions to the specified menu. */ private void addPerspectiveActions(MenuManager menu) { String openText = IDEWorkbenchMessages.Workbench_openPerspective; MenuManager changePerspMenuMgr = new MenuManager(openText, "openPerspective"); //$NON-NLS-1$ IContributionItem changePerspMenuItem = ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(getWindow()); changePerspMenuMgr.add(changePerspMenuItem); menu.add(changePerspMenuMgr); MenuManager showViewMenuMgr = new MenuManager(IDEWorkbenchMessages.Workbench_showView, "showView"); //$NON-NLS-1$ IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST.create(getWindow()); showViewMenuMgr.add(showViewMenu); menu.add(showViewMenuMgr); menu.add(new Separator()); menu.add(getSavePerspectiveItem()); menu.add(getResetPerspectiveItem()); menu.add(closePerspAction); menu.add(closeAllPerspsAction); }
/** * Adds the perspective actions to the specified menu. */ private void addPerspectiveActions(final MenuManager menu) { { final MenuManager perspectiveMenuMgr = new MenuManager( Messages.App_Action_open_perspective, "openPerspective"); //$NON-NLS-1$ final IContributionItem changePerspMenuItem = ContributionItemFactory.PERSPECTIVES_SHORTLIST .create(_window); perspectiveMenuMgr.add(changePerspMenuItem); menu.add(perspectiveMenuMgr); } menu.add(_actionSavePerspective); menu.add(_actionResetPerspective); menu.add(_actionClosePerspective); menu.add(_actionCloseAllPerspective); }
@Override public void fillContextMenu(IMenuManager menu) { super.fillContextMenu(menu); if (!fIsTypeHiararchyViewerOwner) appendToGroup(menu, fOpenTypeHierarchy); if (!fIsCallHiararchyViewerOwner) appendToGroup(menu, fOpenCallHierarchy); if (fShowShowInMenu) { MenuManager showInSubMenu= new MenuManager(getShowInMenuLabel()); IWorkbenchWindow workbenchWindow= fOpenSuperImplementation.getSite().getWorkbenchWindow(); showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN.create(workbenchWindow)); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, showInSubMenu); } IStructuredSelection selection= getStructuredSelection(); if (fShowOpenPropertiesAction && selection != null && fOpenPropertiesDialog.isApplicableForSelection()) menu.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, fOpenPropertiesDialog); }
/** * 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; }
protected void makeActions(IWorkbenchWindow window) { this.window = window; this.saveBTAction = ActionFactory.SAVE.create(this.window); this.saveBTAsAction = ActionFactory.SAVE_AS.create(this.window); this.exportAsCppAction = new DialogExportAsCppAction(this.window); this.openBTAction = new DialogOpenBTAction(this.window); this.newBTAction = new NewBTAction(); this.loadMMPMDomainAction = new DialogLoadMMPMDomainAction(this.window); this.viewsList = ContributionItemFactory.VIEWS_SHORTLIST.create(this.window); this.aboutAction = ActionFactory.ABOUT.create(this.window); /* For key bindings and for copy and paste actions... */ this.register(this.saveBTAction); this.register(ActionFactory.COPY.create(this.window)); this.register(ActionFactory.PASTE.create(this.window)); }
@Override protected void makeActions(final IWorkbenchWindow window) { // save saveAction = ActionFactory.SAVE.create(window); saveAction.setImageDescriptor(Icon.SAVE.descriptor()); saveAction.setDisabledImageDescriptor(Icon.SAVE_DISABLED.descriptor()); // save as saveAsAction = ActionFactory.SAVE_AS.create(window); saveAsAction.setImageDescriptor(Icon.SAVE_AS.descriptor()); saveAsAction.setDisabledImageDescriptor(Icon.SAVE_AS_DISABLED.descriptor()); // save all saveAllAction = ActionFactory.SAVE_ALL.create(window); saveAllAction.setImageDescriptor(Icon.SAVE_ALL.descriptor()); saveAllAction.setDisabledImageDescriptor(Icon.SAVE_ALL_DISABLED.descriptor()); closeAction = ActionFactory.CLOSE.create(window); closeAllAction = ActionFactory.CLOSE_ALL.create(window); preferencesAction = ActionFactory.PREFERENCES.create(window); preferencesAction.setImageDescriptor(Icon.PREFERENCES.descriptor()); importAction = ActionFactory.IMPORT.create(window); importAction.setImageDescriptor(Icon.IMPORT.descriptor()); exportAction = ActionFactory.EXPORT.create(window); exportAction.setImageDescriptor(Icon.EXPORT.descriptor()); exitAction = ActionFactory.QUIT.create(window); showViews = ContributionItemFactory.VIEWS_SHORTLIST.create(window); aboutAction = ActionFactory.ABOUT.create(window); }
@Override protected void editorContextMenuAboutToShow(final IMenuManager menu) { super.editorContextMenuAboutToShow(menu); final IContributionItem[] items = menu.getItems(); for (int i = 0; i < items.length; i++) { if (items[i] instanceof IMenuManager) { final IMenuManager subMenu = (IMenuManager) items[i]; final IContributionItem testShowIn = subMenu.find(ContributionItemFactory.VIEWS_SHOW_IN.getId()); if (null != testShowIn) { menu.remove(subMenu); } } } }
@Override protected void makeActions ( final IWorkbenchWindow window ) { this.newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create ( window ); this.exitAction = ActionFactory.QUIT.create ( window ); this.aboutAction = ActionFactory.ABOUT.create ( window ); this.showViews = ContributionItemFactory.VIEWS_SHORTLIST.create ( window ); this.newWizards = ContributionItemFactory.NEW_WIZARD_SHORTLIST.create ( window ); this.showHelpAction = ActionFactory.HELP_CONTENTS.create ( window ); this.searchHelpAction = ActionFactory.HELP_SEARCH.create ( window ); this.dynamicHelpAction = ActionFactory.DYNAMIC_HELP.create ( window ); register ( this.exitAction ); register ( this.aboutAction ); register ( this.newWindowAction ); register ( this.showHelpAction ); register ( this.searchHelpAction ); register ( this.dynamicHelpAction ); register ( ActionFactory.NEW_WIZARD_DROP_DOWN.create ( window ) ); register ( ActionFactory.NEW.create ( window ) ); register ( ActionFactory.INTRO.create ( window ) ); register ( ActionFactory.SAVE.create ( window ) ); register ( ActionFactory.NEW_EDITOR.create ( window ) ); register ( ActionFactory.PREFERENCES.create ( window ) ); }
/** * Creates the 'Window' menu. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected IMenuManager createWindowMenu(IWorkbenchWindow window) { IMenuManager menu = new MenuManager(getString("_UI_Menu_Window_label"), IWorkbenchActionConstants.M_WINDOW); addToMenuAndRegister(menu, ActionFactory.OPEN_NEW_WINDOW.create(window)); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(ContributionItemFactory.OPEN_WINDOWS.create(window)); return menu; }
@Override protected void fillMenuBar(IMenuManager menuBar) { //DepAn menu actions MenuManager newMenu = new MenuManager("New...", "New..."); IContributionItem newWizards = ContributionItemFactory.NEW_WIZARD_SHORTLIST .create(getActionBarConfigurer().getWindowConfigurer().getWindow()); newMenu.add(newWizards); // window menu actions MenuManager viewsMenu = new MenuManager("Views", "Views"); IContributionItem views = ContributionItemFactory.VIEWS_SHORTLIST .create(getActionBarConfigurer().getWindowConfigurer().getWindow()); viewsMenu.add(views); // top level menu MenuManager depanMenu = new MenuManager("&DepAn", "DepAn"); depanMenu.add(newMenu); depanMenu.add(new Separator()); depanMenu.add(saveAction); depanMenu.add(saveAsAction); depanMenu.add(new Separator()); depanMenu.add(exitAction); MenuManager windowMenu = new MenuManager("&Window", "Window"); windowMenu.add(viewsMenu); windowMenu.add(preferencesAction); MenuManager helpMenu = new MenuManager("&Help", "Help"); helpMenu.add(aboutAction); menuBar.add(depanMenu); // Room for Edit, View, etc. menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menuBar.add(windowMenu); menuBar.add(helpMenu); }
@Override protected void fillCoolBar(ICoolBarManager coolBar) { IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle()); toolbar.add(saveAction); toolbar.add(ContributionItemFactory.NEW_WIZARD_SHORTLIST .create(getActionBarConfigurer().getWindowConfigurer().getWindow())); coolBar.add(toolbar); // allow contributions here with id "additions" (MB_ADDITIONS) coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); }
protected void fillContextMenu(IMenuManager menu) { int selectionCount = table.getSelectionCount(); if (selectionCount == 1) { menu.add(new EditEntryAction()); menu.add(new Separator()); } MenuManager showInSubMenu = new MenuManager("&Show In"); IWorkbenchWindow window = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); IContributionItem item = ContributionItemFactory.VIEWS_SHOW_IN .create(window); showInSubMenu.add(item); menu.add(showInSubMenu); }
@Override protected IContributionItem[] getContributionItems() { final List<IContributionItem> menuContributionList = new ArrayList<>(); final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); final IContributionItem item = ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(window); menuContributionList.add(item); // add the list of views in the menu return menuContributionList.toArray(new IContributionItem[menuContributionList.size()]); }
@Override protected IContributionItem[] getContributionItems() { final List<IContributionItem> menuContributionList = new ArrayList<>(); final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); final IContributionItem item = ContributionItemFactory.VIEWS_SHORTLIST.create(window); menuContributionList.add(item); // add the list of views in the menu return menuContributionList.toArray(new IContributionItem[menuContributionList.size()]); }
protected void fillContextMenu(IMenuManager menu) { int selectionCount = table.getSelectionCount(); if (selectionCount == 1) { menu.add(new EditEntryAction()); menu.add(new Separator()); } MenuManager showInSubMenu = new MenuManager("&Show In"); IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IContributionItem item = ContributionItemFactory.VIEWS_SHOW_IN.create(window); showInSubMenu.add(item); menu.add(showInSubMenu); }
/** * Create the "Window" menu. * file/new * @return */ protected IMenuManager createWindowMenu() { IWorkbenchWindow window = getWindow(); MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_window, IWorkbenchActionConstants.M_WINDOW); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS+"2")); menu.add(new Separator()); MenuManager perspectiveMenu = new MenuManager("Open Perspective", "openPerspective"); IContributionItem perspectiveList = ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(window); perspectiveMenu.add(perspectiveList); menu.add(perspectiveMenu); MenuManager viewMenu = new MenuManager("Show View", "showView"); IContributionItem viewList = ContributionItemFactory.VIEWS_SHORTLIST.create(window); viewMenu.add(viewList); menu.add(viewMenu); menu.add(ActionFactory.RESET_PERSPECTIVE.create(window)); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); IWorkbenchAction newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window); newWindowAction.setText("New Window"); menu.add(newWindowAction); IWorkbenchAction preferences = ActionFactory.PREFERENCES.create(window); String oldText = preferences.getText(); if (!oldText.contains("...")) { preferences.setText(oldText+"..."); } ActionContributionItem preferenceItem = new ActionContributionItem(preferences); menu.add(preferenceItem); if (Platform.OS_MACOSX.equals(Platform.getOS())) { preferenceItem.setVisible(false); } menu.add(ContributionItemFactory.OPEN_WINDOWS.create(window)); return menu; }
/** * Creates the 'Window' menu. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IMenuManager createWindowMenu(IWorkbenchWindow window) { IMenuManager menu = new MenuManager(getString("_UI_Menu_Window_label"), IWorkbenchActionConstants.M_WINDOW); addToMenuAndRegister(menu, ActionFactory.OPEN_NEW_WINDOW.create(window)); menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(ContributionItemFactory.OPEN_WINDOWS.create(window)); return menu; }
/** * 创建文件菜单 * @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(newAction); menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); menu.add(new Separator()); menu.add(closeAction); menu.add(closeAllAction); menu.add(refreshAction); // menu.add(new Separator("net.heartsome.cat.ts.ui.menu.file.separator")); 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); // 添加文件访问列表 ContributionItemFactory REOPEN_EDITORS = new ContributionItemFactory("reopenEditors") { //$NON-NLS-1$ /* (non-javadoc) method declared on ContributionItemFactory */ public IContributionItem create(IWorkbenchWindow window) { if (window == null) { throw new IllegalArgumentException(); } return new ReopenEditorMenu(window, getId(), false); } }; menu.add(REOPEN_EDITORS.create(window)); menu.add(exitAction); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
/** * 创建文件菜单 * @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); // 添加文件访问列表 ContributionItemFactory REOPEN_EDITORS = new ContributionItemFactory("reopenEditors") { //$NON-NLS-1$ /* (non-javadoc) method declared on ContributionItemFactory */ public IContributionItem create(IWorkbenchWindow window) { if (window == null) { throw new IllegalArgumentException(); } return new ReopenEditorMenu(window, getId(), false); } }; menu.add(REOPEN_EDITORS.create(window)); menu.add(exitAction); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
/** * Creates and returns the File menu. */ private MenuManager createFileMenu( ) { MenuManager menu = new MenuManager( DesignerWorkbenchMessages.Workbench_file, IWorkbenchActionConstants.M_FILE ); MenuManager newMenu = new MenuManager(DesignerWorkbenchMessages.Workbench_new, ActionFactory.NEW.getId()); newMenu.add(newReportAction); newMenu.add(newLibraryAction); newMenu.add(newReportTemplateAction); for (int i=0; i<newActions.length; i++) { newMenu.add(newActions[i]); } menu.add(newMenu); menu.add(openFileAction); menu.add( new Separator( ) ); menu.add( closeAction ); menu.add( closeAllAction ); menu.add( new GroupMarker( IWorkbenchActionConstants.CLOSE_EXT ) ); menu.add( new Separator( ) ); menu.add( saveAction ); menu.add( saveAsAction ); menu.add( saveAllAction ); menu.add( new GroupMarker( IWorkbenchActionConstants.SAVE_EXT ) ); menu.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) ); menu.add( ContributionItemFactory.REOPEN_EDITORS.create( getWindow( ) ) ); menu.add( new GroupMarker( IWorkbenchActionConstants.MRU ) ); menu.add( new Separator( ) ); menu.add( quitAction ); menu.add( new GroupMarker( IWorkbenchActionConstants.FILE_END ) ); return menu; }
/** * Adds the perspective actions to the specified menu. */ private void addPerspectiveActions( MenuManager menu ) { { MenuManager showViewMenuMgr = new MenuManager( DesignerWorkbenchMessages.Workbench_showView, "showView" ); //$NON-NLS-1$ IContributionItem showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST.create( getWindow( ) ); showViewMenuMgr.add( showViewMenu ); menu.add( showViewMenuMgr ); } }
/** * Makes views show up under Window -> Show View. */ @Override protected IContributionItem[] getContributionItems() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IContributionItem item = ContributionItemFactory.VIEWS_SHORTLIST.create(window); List<IContributionItem> menuContributionList = new ArrayList<>(); menuContributionList.add(item); return menuContributionList.toArray(new IContributionItem[menuContributionList.size()]); }
/** * Makes perspectives show up under Window -> Open Perspective. */ @Override protected IContributionItem[] getContributionItems() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IContributionItem item = ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(window); List<IContributionItem> menuContributionList = new ArrayList<>(); menuContributionList.add(item); return menuContributionList.toArray(new IContributionItem[menuContributionList.size()]); }
@Override protected void contributeActions() { final SourceFilesCheckinControl sourceFilesSubControl = getCheckinControl().getSourceFilesSubControl(); sourceFilesSubControl.getContextMenu().addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { final String groupId = StandardActionConstants.HOSTING_CONTROL_CONTRIBUTIONS; final MenuManager compareSubMenu = new MenuManager(Messages.getString("PendingChangesView.CompareMenuText")); //$NON-NLS-1$ compareSubMenu.add(compareWithWorkspaceAction); compareSubMenu.add(compareWithLatestAction); final MenuManager viewSubMenu = new MenuManager(Messages.getString("PendingChangesView.ViewMenuText")); //$NON-NLS-1$ viewSubMenu.add(viewAction); viewSubMenu.add(viewUnmodifiedAction); viewSubMenu.add(viewLatestAction); final IContributionItem showInContributions = ContributionItemFactory.VIEWS_SHOW_IN.create(getViewSite().getWorkbenchWindow()); final MenuManager showInSubMenu = new MenuManager(Messages.getString("PendingChangesView.ShowInMenuText")); //$NON-NLS-1$ showInSubMenu.add(showInContributions); manager.appendToGroup(groupId, viewSubMenu); manager.appendToGroup(groupId, new Separator()); manager.appendToGroup(groupId, compareSubMenu); manager.appendToGroup(groupId, undoAction); manager.appendToGroup(groupId, new Separator()); if (showInSubMenu.getMenu() != null && showInSubMenu.getMenu().getItems().length > 0) { manager.appendToGroup(groupId, showInSubMenu); manager.appendToGroup(groupId, new Separator()); } manager.appendToGroup(groupId, refreshPendingChangesAction); } }); sourceFilesSubControl.getChangesTable().addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent event) { if (viewAction.isEnabled()) { viewAction.run(); } else if (viewUnmodifiedAction.isEnabled()) { viewUnmodifiedAction.run(); } } }); final IContributionManager contributionManager = getViewSite().getActionBars().getToolBarManager(); workspaceActionContribution = new ActionContributionItem(workspaceToolbarAction); contributionManager.appendToGroup(TOOLBAR_GROUP_WORKSPACE, workspaceActionContribution); checkinActionContribution = new ActionContributionItem(checkinAction); contributionManager.appendToGroup(TOOLBAR_GROUP_CHECKIN, checkinActionContribution); shelveActionContribution = new ActionContributionItem(shelveAction); contributionManager.appendToGroup(TOOLBAR_GROUP_SHELVE, shelveActionContribution); unshelveActionContribution = new ActionContributionItem(unshelveAction); contributionManager.appendToGroup(TOOLBAR_GROUP_SHELVE, unshelveActionContribution); resolveConflictsActionContribution = new ActionContributionItem(resolveConflictsAction); setToolbarButtonTextMode(); final IMenuManager localViewMenu = getViewSite().getActionBars().getMenuManager(); localViewMenu.add(undoUnchangedAction); localViewMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); localViewMenu.add(toggleButtonTextAction); localViewMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); getViewSite().getActionBars().updateActionBars(); }
/** * Called when the context menu is about to show. * * We use this to remove unwanted items from the menu * that eclipse plug-ins contribute. */ protected void editorContextMenuAboutToShow(IMenuManager menuManager) { super.editorContextMenuAboutToShow(menuManager); // The following adds an extra section for the fold commands. // First, try to find the additions group. IContributionItem additions = menuManager.find(IWorkbenchActionConstants.MB_ADDITIONS); if (additions != null) { // insert fold commands after additions if found menuManager.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS, new Separator("foldCommands")); } else { // else just put fold commands at the end menuManager.add(new Separator("foldCommands")); } /* * The following removes unwanted preference items. * * The calls to the super class implementations of this method * add menu items that we dont want, so after they are added, * we remove them. */ menuManager.remove(ITextEditorActionConstants.SHIFT_RIGHT); menuManager.remove(ITextEditorActionConstants.SHIFT_LEFT); /* * The following is a bit of a hack to remove * the "Show In" submenu that is contributed by * AbstractDecoratedTextEditor in its implementation * of this method. It is contributed without * an id, so we have to check all items in the menu * to check if a submenu contains an item with * the id viewShowIn. Then we remove this submenu. */ IContributionItem[] items = menuManager.getItems(); for (int i = 0; i < items.length; i++) { if (items[i] instanceof MenuManager) { MenuManager subMenu = (MenuManager) items[i]; if (subMenu.find(ContributionItemFactory.VIEWS_SHOW_IN.getId()) != null) { menuManager.remove(subMenu); break; } } } }
/** * Creates and returns the File menu. */ private MenuManager createFileMenu() { MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_file, IWorkbenchActionConstants.M_FILE); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); { // create the New submenu, using the same id for it as the New // action String newText = IDEWorkbenchMessages.Workbench_new; String newId = ActionFactory.NEW.getId(); MenuManager newMenu = new MenuManager(newText, newId); newMenu.setActionDefinitionId("org.eclipse.ui.file.newQuickMenu"); //$NON-NLS-1$ newMenu.add(new Separator(newId)); this.newWizardMenu = new NewWizardMenu(getWindow()); newMenu.add(this.newWizardMenu); newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(newMenu); } menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); menu.add(new Separator()); menu.add(closeAction); menu.add(closeAllAction); // menu.add(closeAllSavedAction); menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT)); menu.add(new Separator()); menu.add(saveAction); menu.add(saveAsAction); menu.add(saveAllAction); menu.add(getRevertItem()); menu.add(new Separator()); menu.add(getMoveItem()); menu.add(getRenameItem()); menu.add(getRefreshItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT)); menu.add(new Separator()); menu.add(getPrintItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT)); menu.add(new Separator()); menu.add(switchWorkspaceAction); menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT)); menu.add(new Separator()); menu.add(importResourcesAction); menu.add(exportResourcesAction); menu.add(new GroupMarker(IWorkbenchActionConstants.IMPORT_EXT)); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new Separator()); menu.add(getPropertiesItem()); menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getWindow())); menu.add(new GroupMarker(IWorkbenchActionConstants.MRU)); menu.add(new Separator()); // If we're on OS X we shouldn't show this command in the File menu. It // should be invisible to the user. However, we should not remove it - // the carbon UI code will do a search through our menu structure // looking for it when Cmd-Q is invoked (or Quit is chosen from the // application menu. ActionContributionItem quitItem = new ActionContributionItem(quitAction); quitItem.setVisible(!Util.isMac()); menu.add(quitItem); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
/** * Creates and returns the Navigate menu. */ private MenuManager createNavigateMenu() { MenuManager menu = new MenuManager( IDEWorkbenchMessages.Workbench_navigate, IWorkbenchActionConstants.M_NAVIGATE); menu.add(new GroupMarker(IWorkbenchActionConstants.NAV_START)); menu.add(goIntoAction); MenuManager goToSubMenu = new MenuManager( IDEWorkbenchMessages.Workbench_goTo, IWorkbenchActionConstants.GO_TO); menu.add(goToSubMenu); goToSubMenu.add(backAction); goToSubMenu.add(forwardAction); goToSubMenu.add(upAction); goToSubMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new Separator(IWorkbenchActionConstants.OPEN_EXT)); for (int i = 2; i < 5; ++i) { menu.add(new Separator(IWorkbenchActionConstants.OPEN_EXT + i)); } menu.add(new Separator(IWorkbenchActionConstants.SHOW_EXT)); { MenuManager showInSubMenu = new MenuManager( IDEWorkbenchMessages.Workbench_showIn, "showIn"); //$NON-NLS-1$ showInSubMenu.setActionDefinitionId(showInQuickMenu .getActionDefinitionId()); showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN .create(getWindow())); menu.add(showInSubMenu); } for (int i = 2; i < 5; ++i) { menu.add(new Separator(IWorkbenchActionConstants.SHOW_EXT + i)); } menu.add(new Separator()); menu.add(nextAction); menu.add(previousAction); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new GroupMarker(IWorkbenchActionConstants.NAV_END)); // TBD: Location of this actions menu.add(new Separator()); menu.add(backwardHistoryAction); menu.add(forwardHistoryAction); return menu; }
private IContributionItem getPinEditorItem() { return ContributionItemFactory.PIN_EDITOR.create(window); }
/** * Creates and returns the File menu. */ private MenuManager createFileMenu() { final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_file, IWorkbenchActionConstants.M_FILE); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); { // create the New submenu, using the same id for it as the New action final String newText = IDEWorkbenchMessages.Workbench_new; final String newId = ActionFactory.NEW.getId(); final MenuManager newMenu = new MenuManager(newText, newId); newMenu.setActionDefinitionId("org.eclipse.ui.file.newQuickMenu"); //$NON-NLS-1$ newMenu.setImageDescriptor(icons.desc("navigator/navigator.new2")); newMenu.add(new Separator(newId)); this.newWizardMenu = new BaseNewWizardMenu(getWindow(), null) { @Override protected void addItems(final List list) { addShortcuts(list); } }; newMenu.add(this.newWizardMenu); newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(newMenu); } menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); menu.add(new Separator()); menu.add(closeAction); menu.add(closeAllAction); menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT)); menu.add(new Separator()); menu.add(saveAction); menu.add(saveAsAction); menu.add(saveAllAction); // menu.add(getRevertItem()); menu.add(new Separator()); menu.add(getMoveItem()); menu.add(getRenameItem()); menu.add(getRefreshItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT)); menu.add(new Separator()); menu.add(getPrintItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT)); menu.add(new Separator()); menu.add(openWorkspaceAction); menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT)); menu.add(new GroupMarker(IWorkbenchActionConstants.IMPORT_EXT)); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new Separator()); menu.add(getPropertiesItem()); menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getWindow())); menu.add(new GroupMarker(IWorkbenchActionConstants.MRU)); menu.add(new Separator()); // If we're on OS X we shouldn't show this command in the File menu. It // should be invisible to the user. However, we should not remove it - // the carbon UI code will do a search through our menu structure // looking for it when Cmd-Q is invoked (or Quit is chosen from the // application menu. final ActionContributionItem quitItem = new ActionContributionItem(quitAction); quitItem.setVisible(!Util.isMac()); menu.add(quitItem); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }
/** * Creates and returns the File menu. */ private MenuManager createFileMenu() { MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_file, IWorkbenchActionConstants.M_FILE); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); // create the New submenu, using the same id for it as the New action String newText = IDEWorkbenchMessages.Workbench_new; String newId = ActionFactory.NEW.getId(); MenuManager newMenu = new MenuManager(newText, newId); newMenu.setActionDefinitionId("org.eclipse.ui.file.newQuickMenu"); //$NON-NLS-1$ newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(newMenu); menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); menu.add(new Separator()); menu.add(closeAction); menu.add(closeAllAction); // menu.add(closeAllSavedAction); menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT)); menu.add(new Separator()); menu.add(saveAction); menu.add(saveAsAction); menu.add(saveAllAction); menu.add(getRevertItem()); menu.add(new Separator()); menu.add(getMoveItem()); menu.add(getRenameItem()); menu.add(getRefreshItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT)); menu.add(new Separator()); menu.add(getPrintItem()); menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT)); menu.add(new Separator()); menu.add(openWorkspaceAction); menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT)); menu.add(new Separator()); menu.add(getPropertiesItem()); menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getWindow())); menu.add(new GroupMarker(IWorkbenchActionConstants.MRU)); menu.add(new Separator()); // If we're on OS X we shouldn't show this command in the File menu. It // should be invisible to the user. However, we should not remove it - // the carbon UI code will do a search through our menu structure // looking for it when Cmd-Q is invoked (or Quit is chosen from the // application menu. ActionContributionItem quitItem = new ActionContributionItem(quitAction); quitItem.setVisible(!Util.isMac()); menu.add(quitItem); menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); return menu; }