Java Code Examples for org.eclipse.ui.IActionBars#getMenuManager()
The following examples show how to use
org.eclipse.ui.IActionBars#getMenuManager() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SelectAllProjectExplorer_PluginUITest.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * Tests that the Top Level Elements */ @Test public void testTopLevelElementsEntryNoDuplicates() { IActionBars actionBars = projectExplorer.getViewSite().getActionBars(); IMenuManager menuManager = actionBars.getMenuManager(); int topLevelElementsEntriesFound = 0; for (IContributionItem item : menuManager.getItems()) { if (item instanceof MenuManager) { String escapedMenuText = LegacyActionTools.removeMnemonics(((MenuManager) item).getMenuText()); if (escapedMenuText.equals("Top Level Elements")) { topLevelElementsEntriesFound++; } } } assertEquals("There was more than one 'Top Level Elements' entry in the navigator action bar.", topLevelElementsEntriesFound, 1); }
Example 2
Source File: JavaOutlinePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void registerToolbarActions(IActionBars actionBars) { IToolBarManager toolBarManager= actionBars.getToolBarManager(); fCollapseAllAction= new CollapseAllAction(fOutlineViewer); fCollapseAllAction.setActionDefinitionId(CollapseAllHandler.COMMAND_ID); toolBarManager.add(fCollapseAllAction); toolBarManager.add(new LexicalSortingAction()); fMemberFilterActionGroup= new MemberFilterActionGroup(fOutlineViewer, "org.eclipse.jdt.ui.JavaOutlinePage"); //$NON-NLS-1$ fMemberFilterActionGroup.contributeToToolBar(toolBarManager); fCustomFiltersActionGroup.fillActionBars(actionBars); IMenuManager viewMenuManager= actionBars.getMenuManager(); viewMenuManager.add(new Separator("EndFilterGroup")); //$NON-NLS-1$ fToggleLinkingAction= new ToggleLinkingAction(); fToggleLinkingAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR); viewMenuManager.add(new ClassOnlyAction()); viewMenuManager.add(fToggleLinkingAction); fCategoryFilterActionGroup= new CategoryFilterActionGroup(fOutlineViewer, "org.eclipse.jdt.ui.JavaOutlinePage", new IJavaElement[] {fInput}); //$NON-NLS-1$ fCategoryFilterActionGroup.contributeToViewMenu(viewMenuManager); }
Example 3
Source File: CallHierarchyViewPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void fillViewMenu() { IActionBars actionBars = getViewSite().getActionBars(); IMenuManager viewMenu = actionBars.getMenuManager(); viewMenu.add(new Separator()); for (int i = 0; i < fToggleCallModeActions.length; i++) { viewMenu.add(fToggleCallModeActions[i]); } viewMenu.add(new Separator()); MenuManager layoutSubMenu= new MenuManager(CallHierarchyMessages.CallHierarchyViewPart_layout_menu); for (int i = 0; i < fToggleOrientationActions.length; i++) { layoutSubMenu.add(fToggleOrientationActions[i]); } viewMenu.add(layoutSubMenu); viewMenu.add(new Separator(IContextMenuConstants.GROUP_SEARCH)); MenuManager fieldSubMenu= new MenuManager(CallHierarchyMessages.CallHierarchyViewPart_field_menu); for (int i = 0; i < fToggleFieldModeActions.length; i++) { fieldSubMenu.add(fToggleFieldModeActions[i]); } viewMenu.add(fieldSubMenu); viewMenu.add(fShowSearchInDialogAction); }
Example 4
Source File: PyHierarchyView.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override public void createPartControl(Composite parent) { viewer.createPartControl(parent); IActionBars actionBars = getViewSite().getActionBars(); IMenuManager menuManager = actionBars.getMenuManager(); addOrientationPreferences(menuManager); onControlCreated.call(viewer.treeClassesViewer); onControlCreated.call(viewer.treeMembers); }
Example 5
Source File: PyOutlinePage.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override protected void createActions() { super.createActions(); IActionBars actionBars = getSite().getActionBars(); IMenuManager menuManager = actionBars.getMenuManager(); menuManager.add(new OutlineHideCommentsAction(this, imageCache)); menuManager.add(new OutlineHideImportsAction(this, imageCache)); menuManager.add(new OutlineHideMagicObjectsAction(this, imageCache)); menuManager.add(new OutlineHideFieldsAction(this, imageCache)); menuManager.add(new OutlineHideNonPublicMembersAction(this, imageCache)); menuManager.add(new OutlineHideStaticMethodsAction(this, imageCache)); }
Example 6
Source File: LibraryExplorerContextMenuProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Handles all global actions */ private void handleGlobalAction( ) { IPageSite pageSite = page == null ? null : page.getSite( ); IActionBars actionBars = pageSite == null ? null : pageSite.getActionBars( ); if ( actionBars != null ) { String copyID = ActionFactory.COPY.getId( ); String pasteID = ActionFactory.PASTE.getId( ); String deleteID = ActionFactory.DELETE.getId( ); String moveID = ActionFactory.MOVE.getId( ); String renameID = ActionFactory.RENAME.getId( ); String refreshID = ActionFactory.REFRESH.getId( ); actionBars.setGlobalActionHandler( copyID, copyResourceAction ); actionBars.setGlobalActionHandler( pasteID, pasteResourceAction ); actionBars.setGlobalActionHandler( deleteID, deleteResourceAction ); actionBars.setGlobalActionHandler( moveID, moveResourceAction ); actionBars.setGlobalActionHandler( renameID, renameResourceAction ); actionBars.setGlobalActionHandler( refreshID, refreshExplorerAction ); IMenuManager menuManager = actionBars.getMenuManager( ); IToolBarManager toolBarManager = actionBars.getToolBarManager( ); if ( menuManager != null ) { menuManager.add( filterAction ); } if ( toolBarManager != null ) { toolBarManager.add( refreshExplorerAction ); } } }
Example 7
Source File: WorkingSetShowActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void fillActionBars(IActionBars actionBars) { super.fillActionBars(actionBars); IMenuManager menuManager= actionBars.getMenuManager(); fillViewMenu(menuManager); }
Example 8
Source File: ViewActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void fillActionBars(IActionBars actionBars) { super.fillActionBars(actionBars); fMenuManager= actionBars.getMenuManager(); fillViewMenu(fMenuManager); if (fActiveActionGroup == null) fActiveActionGroup= fFilterActionGroup; ((ActionGroup)fActiveActionGroup).fillActionBars(actionBars); }
Example 9
Source File: PackagesView.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void fillActionBars(IActionBars actionBars) { //create new layout group IMenuManager manager= actionBars.getMenuManager(); final IContributionItem groupMarker= new GroupMarker("layout"); //$NON-NLS-1$ manager.add(groupMarker); IMenuManager newManager= new MenuManager(JavaBrowsingMessages.PackagesView_LayoutActionGroup_layout_label); manager.appendToGroup("layout", newManager); //$NON-NLS-1$ super.addActions(newManager); }
Example 10
Source File: OccurrencesSearchResultPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void createControl(Composite parent) { super.createControl(parent); IActionBars bars= getSite().getActionBars(); IMenuManager menu= bars.getMenuManager(); menu.add(fToggleLinkingAction); IHandlerService handlerService= (IHandlerService) getSite().getService(IHandlerService.class); handlerService.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR, new ActionHandler(fToggleLinkingAction)); }
Example 11
Source File: CommonOutlinePage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private void registerActions(IActionBars actionBars) { IToolBarManager toolBarManager = actionBars.getToolBarManager(); if (toolBarManager != null) { toolBarManager.add(new SortingAction()); } IMenuManager menu = actionBars.getMenuManager(); fToggleLinkingAction = new ToggleLinkingAction(); menu.add(fToggleLinkingAction); }
Example 12
Source File: SDView.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Enables or disables the Pages... menu item, depending on the number of pages * * @param bar the bar containing the action */ protected void updatePagesMenuItem(IActionBars bar) { if (fSdPagingProvider instanceof ISDAdvancedPagingProvider) { IMenuManager menuManager = bar.getMenuManager(); ActionContributionItem contributionItem = (ActionContributionItem) menuManager.find(OpenSDPagesDialog.ID); IAction openSDPagesDialog = null; if (contributionItem != null) { openSDPagesDialog = contributionItem.getAction(); } if (openSDPagesDialog instanceof OpenSDPagesDialog) { openSDPagesDialog.setEnabled(((ISDAdvancedPagingProvider) fSdPagingProvider).pagesCount() > 1); } } }
Example 13
Source File: TypeScriptContentOutlinePage.java From typescript.java with MIT License | 5 votes |
/** * Register toolbar actions. * * @param actionBars */ private void registerToolbarActions(IActionBars actionBars) { // Toolbar IToolBarManager toolBarManager = actionBars.getToolBarManager(); toolBarManager.add(new CollapseAllAction(this.fOutlineViewer)); // Menu IMenuManager viewMenuManager = actionBars.getMenuManager(); viewMenuManager.add(new Separator("EndFilterGroup")); //$NON-NLS-1$ viewMenuManager.add(new ToggleLinkingAction()); }
Example 14
Source File: TLAMultiPageEditorActionBarContributor.java From tlaplus with MIT License | 5 votes |
public void init(IActionBars bars) { super.init(bars); IMenuManager menuManager = bars.getMenuManager(); IMenuManager editMenu = menuManager.findMenuUsingPath("toolbox.edit.menu"); if (editMenu != null) { editMenu.add(new Separator()); editMenu.add(fContentAssistProposal); editMenu.add(fContentAssistTip); } }
Example 15
Source File: TLAEditorActionContributor.java From tlaplus with MIT License | 5 votes |
public void init(IActionBars bars) { super.init(bars); IMenuManager menuManager = bars.getMenuManager(); IMenuManager editMenu = menuManager.findMenuUsingPath("toolbox.edit.menu"); if (editMenu != null) { editMenu.add(new Separator()); editMenu.add(fContentAssistProposal); editMenu.add(fContentAssistTip); } }
Example 16
Source File: MigrationStatusView.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createActions() { final IEditorPart editor = getSite().getPage().getActiveEditor(); final IActionBars actionBars = getViewSite().getActionBars(); final IMenuManager dropDownMenu = actionBars.getMenuManager(); final IToolBarManager toolBar = actionBars.getToolBarManager(); exportAction = new ExportMigrationReportAsPDFAction(); if (editor instanceof DiagramEditor) { exportAction.setReport(getReportFromEditor(editor)); } exportAction.setViewer(tableViewer); dropDownMenu.add(exportAction); linkAction = new ToggleLinkingAction(); linkAction.setChecked(true); linkAction.setViewer(tableViewer); linkAction.run(); if (editor instanceof DiagramEditor) { linkAction.setEditor((DiagramEditor) editor); } toolBar.add(linkAction); final HideValidStatusAction hideStatusAction = new HideValidStatusAction(); hideStatusAction.setViewer(tableViewer); dropDownMenu.add(hideStatusAction); final HideReviewedAction hideReviewedAction = new HideReviewedAction(); hideReviewedAction.setViewer(tableViewer); dropDownMenu.add(hideReviewedAction); }
Example 17
Source File: PyUnitView.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private void configureToolBar() { IActionBars actionBars = getViewSite().getActionBars(); IToolBarManager toolBar = actionBars.getToolBarManager(); IMenuManager menuManager = actionBars.getMenuManager(); ShowViewOnTestRunAction showViewOnTestRunAction = new ShowViewOnTestRunAction(this); menuManager.add(showViewOnTestRunAction); IAction showTestRunnerPreferencesAction = new ShowTestRunnerPreferencesAction(this); menuManager.add(showTestRunnerPreferencesAction); ShowOnlyFailuresAction action = new ShowOnlyFailuresAction(this); toolBar.add(action); action.setChecked(this.showOnlyErrors); toolBar.add(new Separator()); toolBar.add(new RelaunchAction(this)); toolBar.add(new RelaunchErrorsAction(this)); toolBar.add(new StopAction(this)); toolBar.add(new Separator()); toolBar.add(new RelaunchInBackgroundAction(this)); toolBar.add(new Separator()); toolBar.add(new HistoryAction(this)); toolBar.add(fPinHistory); toolBar.add(new RestorePinHistoryAction(this)); addOrientationPreferences(menuManager); }
Example 18
Source File: SVNHistoryPage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private void contributeActions() { toggleShowComments = new Action(Policy.bind("HistoryView.showComments"), //$NON-NLS-1$ SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_COMMENTS)) { public void run() { showComments = isChecked(); setViewerVisibility(); store.setValue(ISVNUIConstants.PREF_SHOW_COMMENTS, showComments); } }; toggleShowComments.setChecked(showComments); // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextAction, // IHelpContextIds.SHOW_COMMENT_IN_HISTORY_ACTION); // Toggle wrap comments action toggleWrapCommentsAction = new Action(Policy.bind("HistoryView.wrapComments")) { //$NON-NLS-1$ public void run() { wrapCommentsText = isChecked(); setViewerVisibility(); store.setValue(ISVNUIConstants.PREF_WRAP_COMMENTS, wrapCommentsText); } }; toggleWrapCommentsAction.setChecked(wrapCommentsText); // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextWrapAction, // IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION); // Toggle path visible action toggleShowAffectedPathsAction = new Action(Policy.bind("HistoryView.showAffectedPaths"), //$NON-NLS-1$ SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_FLAT_MODE)) { public void run() { showAffectedPaths = isChecked(); setViewerVisibility(); store.setValue(ISVNUIConstants.PREF_SHOW_PATHS, showAffectedPaths); } }; toggleShowAffectedPathsAction.setChecked(showAffectedPaths); // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleListAction, // IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION); // Toggle stop on copy action toggleStopOnCopyAction = new Action(Policy.bind("HistoryView.stopOnCopy")) { //$NON-NLS-1$ public void run() { refresh(); SVNUIPlugin.getPlugin().getPreferenceStore().setValue(ISVNUIConstants.PREF_STOP_ON_COPY, toggleStopOnCopyAction.isChecked()); } }; toggleStopOnCopyAction.setChecked(store.getBoolean(ISVNUIConstants.PREF_STOP_ON_COPY)); // Toggle include merged revisions action toggleIncludeMergedRevisionsAction = new Action(Policy.bind("HistoryView.includeMergedRevisions")) { //$NON-NLS-1$ public void run() { store.setValue(ISVNUIConstants.PREF_INCLUDE_MERGED_REVISIONS, toggleIncludeMergedRevisionsAction.isChecked()); refreshTable(); refresh(); } }; toggleIncludeMergedRevisionsAction.setChecked(store.getBoolean(ISVNUIConstants.PREF_INCLUDE_MERGED_REVISIONS)); IHistoryPageSite parentSite = getHistoryPageSite(); IPageSite pageSite = parentSite.getWorkbenchPageSite(); IActionBars actionBars = pageSite.getActionBars(); // Contribute toggle text visible to the toolbar drop-down IMenuManager actionBarsMenu = actionBars.getMenuManager(); actionBarsMenu.add(getGetNextAction()); actionBarsMenu.add(getGetAllAction()); actionBarsMenu.add(toggleStopOnCopyAction); actionBarsMenu.add(toggleIncludeMergedRevisionsAction); actionBarsMenu.add(new Separator()); actionBarsMenu.add(toggleWrapCommentsAction); actionBarsMenu.add(new Separator()); actionBarsMenu.add(toggleShowComments); actionBarsMenu.add(toggleShowAffectedPathsAction); actionBarsMenu.add(new Separator()); for (int i = 0; i < toggleAffectedPathsModeActions.length; i++) { actionBarsMenu.add(toggleAffectedPathsModeActions[i]); } actionBarsMenu.add(new Separator()); for (int i = 0; i < toggleAffectedPathsLayoutActions.length; i++) { actionBarsMenu.add(toggleAffectedPathsLayoutActions[i]); } // Create the local tool bar IToolBarManager tbm = actionBars.getToolBarManager(); // tbm.add(getRefreshAction()); tbm.add(new Separator()); tbm.add(getSearchAction()); tbm.add(getClearSearchAction()); tbm.add(new Separator()); tbm.add(toggleShowComments); tbm.add(toggleShowAffectedPathsAction); tbm.add(new Separator()); tbm.add(getGetNextAction()); tbm.add(getGetAllAction()); // tbm.add(getLinkWithEditorAction()); tbm.update(false); actionBars.updateActionBars(); }
Example 19
Source File: LamiReportView.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override public void createPartControl(@Nullable Composite parent) { LamiAnalysisReport report = fReport; if (report == null || parent == null) { return; } setPartName(report.getName()); fTabFolder = new CTabFolder(parent, SWT.NONE); fTabFolder.setSimple(false); for (LamiResultTable table : report.getTables()) { String name = table.getTableClass().getTableTitle(); CTabItem tabItem = new CTabItem(fTabFolder, SWT.NULL); tabItem.setText(name); SashForm sf = new SashForm(fTabFolder, SWT.NONE); fTabPages.add(new LamiReportViewTabPage(sf, table)); tabItem.setControl(sf); } /* Add toolbar buttons */ Action toggleTableAction = new ToggleTableAction(); toggleTableAction.setText(Messages.LamiReportView_ActivateTableAction_ButtonName); toggleTableAction.setToolTipText(Messages.LamiReportView_ActivateTableAction_ButtonTooltip); toggleTableAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath("icons/table.gif")); //$NON-NLS-1$ IActionBars actionBars = getViewSite().getActionBars(); IToolBarManager toolbarMgr = actionBars.getToolBarManager(); toolbarMgr.add(toggleTableAction); fNewChartAction.setText(Messages.LamiReportView_NewCustomChart); fClearCustomViewsAction.setText(Messages.LamiReportView_ClearAllCustomViews); IMenuManager menuMgr = actionBars.getMenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener((@Nullable IMenuManager manager) -> { if (manager != null) { populateMenu(manager); } }); populateMenu(menuMgr); /* Select the first tab initially */ CTabFolder tf = checkNotNull(fTabFolder); if (tf.getItemCount() > 0) { tf.setSelection(0); } }
Example 20
Source File: JavaBrowsingPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
protected void fillActionBars(IActionBars actionBars) { IToolBarManager toolBar= actionBars.getToolBarManager(); fillToolBar(toolBar); if (fHasWorkingSetFilter) fWorkingSetFilterActionGroup.fillActionBars(getViewSite().getActionBars()); actionBars.updateActionBars(); fActionGroups.fillActionBars(actionBars); if (fHasCustomFilter) fCustomFiltersActionGroup.fillActionBars(actionBars); IMenuManager menu= actionBars.getMenuManager(); menu.add(fToggleLinkingAction); }