Java Code Examples for org.eclipse.jface.action.IMenuManager#insertBefore()
The following examples show how to use
org.eclipse.jface.action.IMenuManager#insertBefore() .
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: DataSetNodeProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Creates the context menu for the given object. Gets the action from the * actionRegistry and adds the action to the menu. * * @param menu * the menu * @param object * the object */ public void createContextMenu( TreeViewer sourceViewer, Object object, IMenuManager menu ) { super.createContextMenu( sourceViewer, object, menu ); menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$ new ShowPropertyAction( object ) ); menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$ IAction action = new RefreshAction( sourceViewer ); if (action.isEnabled( )) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$ } }
Example 2
Source File: TabularDimensionNodeProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Creates the context menu for the given object. Gets the action from the * actionRegistry and adds the action to the menu. * * @param menu * the menu * @param object * the object */ public void createContextMenu( TreeViewer sourceViewer, Object object, IMenuManager menu ) { super.createContextMenu( sourceViewer, object, menu ); if ( ( (DimensionHandle) object ).canEdit( ) ) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS, new EditCubeDimensionAction( object, Messages.getString( "CubeDimensionNodeProvider.menu.text" ) ) ); //$NON-NLS-1$ } menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$ new ShowPropertyAction( object ) ); menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$ IAction action = new RefreshAction( sourceViewer ); if (action.isEnabled( )) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$ } }
Example 3
Source File: CustomFiltersActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void addLRUFilterActions(IMenuManager mm) { if (fLRUFilterIdsStack.isEmpty()) { fFilterIdsUsedInLastViewMenu= null; return; } SortedSet<String> sortedFilters= new TreeSet<String>(fLRUFilterIdsStack); String[] recentlyChangedFilterIds= sortedFilters.toArray(new String[sortedFilters.size()]); fFilterIdsUsedInLastViewMenu= new String[recentlyChangedFilterIds.length]; for (int i= 0; i < recentlyChangedFilterIds.length; i++) { String id= recentlyChangedFilterIds[i]; fFilterIdsUsedInLastViewMenu[i]= id; FilterItem filterItem= fFilterItems.get(id); if (filterItem != null) { IContributionItem item= new FilterActionMenuContributionItem(this, id, filterItem.descriptor.getName(), filterItem.enabled, i+1); mm.insertBefore(RECENT_FILTERS_GROUP_NAME, item); } } }
Example 4
Source File: JavaSearchResultPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void init(IPageSite site) { super.init(site); IMenuManager menuManager = site.getActionBars().getMenuManager(); menuManager.insertBefore(IContextMenuConstants.GROUP_PROPERTIES, new Separator(GROUP_FILTERING)); fActionGroup.fillActionBars(site.getActionBars()); menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action(SearchMessages.JavaSearchResultPage_preferences_label) { @Override public void run() { String pageId= "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$ String[] displayedPages= { pageId, "org.eclipse.ui.editors.preferencePages.Annotations", //$NON-NLS-1$ "org.eclipse.ui.preferencePages.ColorsAndFonts" //$NON-NLS-1$ }; PreferencesUtil.createPreferenceDialogOn(JavaPlugin.getActiveWorkbenchShell(), pageId, displayedPages, null).open(); } }); }
Example 5
Source File: TabularMeasureNodeProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Creates the context menu for the given object. Gets the action from the * actionRegistry and adds the action to the menu. * * @param menu * the menu * @param object * the object */ public void createContextMenu( TreeViewer sourceViewer, Object object, IMenuManager menu ) { super.createContextMenu( sourceViewer, object, menu ); if ( ( (MeasureHandle) object ).canEdit( ) ) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS, new EditCubeMeasureAction( object, Messages.getString( "CubeMeasureNodeProvider.menu.text" ) ) ); //$NON-NLS-1$ } menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$ new ShowPropertyAction( object ) ); menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$ IAction action = new RefreshAction( sourceViewer ); if ( action.isEnabled( ) ) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$ } }
Example 6
Source File: TabularCubeNodeProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Creates the context menu for the given object. Gets the action from the * actionRegistry and adds the action to the menu. * * @param menu * the menu * @param object * the object */ public void createContextMenu( TreeViewer sourceViewer, Object object, IMenuManager menu ) { super.createContextMenu( sourceViewer, object, menu ); if ( ( (CubeHandle) object ).canEdit( ) ) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS, new EditCubeAction( object, Messages.getString( "CubeNodeProvider.menu.text" ) ) ); //$NON-NLS-1$ } menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$ new ShowPropertyAction( object ) ); menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$ IAction action = new RefreshAction( sourceViewer ); if (action.isEnabled( )) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$ } }
Example 7
Source File: TabularLevelNodeProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Creates the context menu for the given object. Gets the action from the * actionRegistry and adds the action to the menu. * * @param menu * the menu * @param object * the object */ public void createContextMenu( TreeViewer sourceViewer, Object object, IMenuManager menu ) { super.createContextMenu( sourceViewer, object, menu ); if ( ( (LevelHandle) object ).canEdit( ) ) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS, new EditCubeLevelAction( object, Messages.getString( "CubeLevelNodeProvider.menu.text" ) ) ); //$NON-NLS-1$ } menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$ new ShowPropertyAction( object ) ); menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$ IAction action = new RefreshAction( sourceViewer ); if (action.isEnabled( )) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$ } }
Example 8
Source File: LeveAttributelNodeProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Creates the context menu for the given object. Gets the action from the * actionRegistry and adds the action to the menu. * * @param menu * the menu * @param object * the object */ public void createContextMenu( TreeViewer sourceViewer, Object object, IMenuManager menu ) { super.createContextMenu( sourceViewer, object, menu ); menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$ new ShowPropertyAction( object ) ); menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$ IAction action = new RefreshAction( sourceViewer ); if (action.isEnabled( )) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$ } }
Example 9
Source File: TabularMeasureGroupNodeProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Creates the context menu for the given object. Gets the action from the * actionRegistry and adds the action to the given menu. * * @param menu * the menu * @param object * the object */ public void createContextMenu( TreeViewer sourceViewer, Object object, IMenuManager menu ) { // WizardUtil.createNewCubeMenu( menu ); super.createContextMenu( sourceViewer, object, menu ); if ( ( (MeasureGroupHandle) object ).canEdit( ) ) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS, new EditCubeMeasureGroupAction( object, Messages.getString( "CubeMeasureGroupNodeProvider.menu.text" ) ) ); //$NON-NLS-1$ } menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$ new ShowPropertyAction( object ) ); menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$ IAction action = new RefreshAction( sourceViewer ); if (action.isEnabled( )) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$ } }
Example 10
Source File: CrosstabCellMenuAdapterFactory.java From birt with Eclipse Public License 1.0 | 5 votes |
private void createLevelMenu( IMenuManager menu, Object firstSelectedObj, IContributionItem beforeThis ) { DesignElementHandle element = null; if ( firstSelectedObj instanceof DesignElementHandle ) { element = (DesignElementHandle) firstSelectedObj; } else if ( firstSelectedObj instanceof CrosstabCellAdapter ) { element = ( (CrosstabCellAdapter) firstSelectedObj ).getDesignElementHandle( ); } String firstId = beforeThis.getId( ); if ( element != null ) { IAction action = new AddLevelHandleAction( element ); //if (!CrosstabUtil.isBoundToLinkedDataSet( getCrosstab(element) )) { menu.insertBefore( firstId, action ); } action = new AddSubTotalAction( element ); menu.insertBefore( firstId, action ); action = new DeleteDimensionViewHandleAction( element ); menu.insertBefore( firstId, action ); } }
Example 11
Source File: DataSourceNodeProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates the context menu for the given object. * * @param menu * the menu * @param object * the object */ public void createContextMenu( TreeViewer sourceViewer, Object object, IMenuManager menu ) { super.createContextMenu( sourceViewer, object, menu ); menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$ new ShowPropertyAction( object ) ); }
Example 12
Source File: SelectTopLevelElementActionGroup.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public void fillActionBars(final IActionBars actionBars) { if (hasContributedToViewMenu) { return; } final IMenuManager topLevelSubMenu = new MenuManager("Top Level Elements"); addActions(topLevelSubMenu); final IMenuManager menuManager = actionBars.getMenuManager(); menuManager.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, topLevelSubMenu); hasContributedToViewMenu = true; }
Example 13
Source File: CrosstabCellMenuAdapterFactory.java From birt with Eclipse Public License 1.0 | 5 votes |
private void createMeasureMenu( IMenuManager menu, Object firstSelectedObj, IContributionItem beforeThis ) { DesignElementHandle element = null; String firstId = beforeThis.getId( ); if ( firstSelectedObj instanceof DesignElementHandle ) { element = (DesignElementHandle) firstSelectedObj; } else if ( firstSelectedObj instanceof CrosstabCellAdapter ) { element = ( (CrosstabCellAdapter) firstSelectedObj ).getDesignElementHandle( ); } if ( element != null ) { buildShowMenu( menu, element, firstId ); IAction action = new AddRelativeTimePeriodAction( element ); //if (action.isEnabled( )) { menu.insertBefore( firstId, action ); } action = new AddComputedMeasureAction( element ); menu.insertBefore( firstId, action ); action = new AddMeasureViewHandleAction( element ); menu.insertBefore( firstId, action ); action = new DeleteMeasureHandleAction( element ); menu.insertBefore( firstId, action ); } }
Example 14
Source File: TabularCubeNodeProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Creates the context menu for the given object. Gets the action from the * actionRegistry and adds the action to the menu. * * @param menu * the menu * @param object * the object */ public void createContextMenu( TreeViewer sourceViewer, Object object, IMenuManager menu ) { menu.add( new Separator( ) ); InsertCubeInLayoutAction insertAction = new InsertCubeInLayoutAction( object ); if ( insertAction.isEnabled( ) ) { menu.add( insertAction ); } super.createContextMenu( sourceViewer, object, menu ); if ( ( (CubeHandle) object ).canEdit( ) ) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS, new EditCubeAction( object, Messages.getString( "InsertCubeInLayoutAction.menu.text" ) ) ); //$NON-NLS-1$ } menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$ new ShowPropertyAction( object ) ); menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$ IAction action = new RefreshAction( sourceViewer ); if ( action.isEnabled( ) ) { menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$ } }
Example 15
Source File: RefactorActionProvider.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void fillContextMenu(final IMenuManager menu) { final IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); final boolean anyResourceSelected = !selection.isEmpty(); if (anyResourceSelected) { renameAction.selectionChanged(selection); historyAction.selectionChanged(selection); compareAction.selectionChanged(selection); menu.insertBefore(CopyAction.ID, renameAction); menu.insertAfter("additions", historyAction); if (selection.size() == 2) { menu.insertAfter("additions", compareAction); } } }
Example 16
Source File: BugActionProvider.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void fillContextMenu(IMenuManager menu) { super.fillContextMenu(menu); menu.insertBefore(ICommonMenuConstants.GROUP_PORT, new Separator("fb")); menu.insertBefore(ICommonMenuConstants.GROUP_PORT, new Separator("fb.project")); menu.insertBefore(ICommonMenuConstants.GROUP_PORT, new Separator("fb.filter")); }
Example 17
Source File: ChartMenuBuilder.java From birt with Eclipse Public License 1.0 | 4 votes |
public void buildMenu( IMenuManager menu, List selectedList ) { if ( selectedList != null && selectedList.size( ) == 1 && ChartItemUtil.isChartHandle( selectedList.get( 0 ) ) ) { ExtendedItemHandle handle = (ExtendedItemHandle) selectedList.get( 0 ); Separator separator = new Separator( "group.chart" ); //$NON-NLS-1$ if ( menu.getItems( ).length > 0 ) { menu.insertBefore( menu.getItems( )[0].getId( ), separator ); } else { menu.add( separator ); } menu.appendToGroup( separator.getId( ), new OpenChartTaskAction( handle, "org.eclipse.birt.chart.ui.swt.wizard.TaskSelectType", //$NON-NLS-1$ Messages.getString( "OpenChartTaskAction.Text.SelectChartType" ),//$NON-NLS-1$ UIHelper.getImage( ChartUIConstants.IMAGE_TASK_TYPE ), true ) ); menu.appendToGroup( separator.getId( ), new OpenChartTaskAction( handle, "org.eclipse.birt.chart.ui.swt.wizard.TaskSelectData", //$NON-NLS-1$ Messages.getString( "OpenChartTaskAction.Text.SelectData" ), //$NON-NLS-1$ UIHelper.getImage( ChartUIConstants.IMAGE_TASK_DATA ), false ) ); menu.appendToGroup( separator.getId( ), new OpenChartTaskAction( handle, "org.eclipse.birt.chart.ui.swt.wizard.TaskFormatChart", //$NON-NLS-1$ Messages.getString( "OpenChartTaskAction.Text.FormatChart" ),//$NON-NLS-1$ UIHelper.getImage( ChartUIConstants.IMAGE_TASK_FORMAT ), false ) ); if ( ChartCubeUtil.isPlotChart( handle ) || ChartCubeUtil.isAxisChart( handle ) ) { menu.appendToGroup( separator.getId( ), new FlipAxisAction( handle ) ); menu.appendToGroup( separator.getId( ), new ShowAxisAction( handle ) ); } } }
Example 18
Source File: RotatedTextMenuBuilder.java From birt with Eclipse Public License 1.0 | 4 votes |
public void buildMenu( IMenuManager menu, List selectedList ) { if ( selectedList != null && selectedList.size( ) == 1 && selectedList.get( 0 ) instanceof ExtendedItemHandle ) { ExtendedItemHandle handle = (ExtendedItemHandle) selectedList.get( 0 ); if ( !RotatedTextItem.EXTENSION_NAME.equals( handle.getExtensionName( ) ) ) { return; } RotatedTextItem item = null; try { item = (RotatedTextItem) handle.getReportItem( ); } catch ( ExtendedElementException e ) { e.printStackTrace( ); } if ( item == null ) { return; } Separator separator = new Separator( "group.rotatedtext" ); //$NON-NLS-1$ if ( menu.getItems( ).length > 0 ) { menu.insertBefore( menu.getItems( )[0].getId( ), separator ); } else { menu.add( separator ); } menu.appendToGroup( separator.getId( ), new RotateAction( item, -90 ) ); menu.appendToGroup( separator.getId( ), new RotateAction( item, 90 ) ); menu.appendToGroup( separator.getId( ), new RotateAction( item, 0 ) ); menu.appendToGroup( separator.getId( ), new RotateAction( item, 180 ) ); } }
Example 19
Source File: WorkingSetFilterActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private void addLRUWorkingSetAction(IMenuManager mm, int id, IWorkingSet workingSet) { IContributionItem item= new WorkingSetMenuContributionItem(id, this, workingSet); mm.insertBefore(LRU_GROUP, item); fContributions.add(item); }
Example 20
Source File: TexEditorActionContributor.java From texlipse with Eclipse Public License 1.0 | 4 votes |
@Override public void contributeToMenu(IMenuManager menuManager) { super.contributeToMenu(menuManager); //Add a new group to the navigation/goto menu IMenuManager gotoMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE+"/"+IWorkbenchActionConstants.GO_TO); if (gotoMenu != null) { gotoMenu.add(new Separator("additions2")); } IMenuManager editMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_WINDOW); MenuManager manager = new MenuManager("Latex Symbols"); if (editMenu != null) { menuManager.insertBefore(IWorkbenchActionConstants.M_WINDOW, manager); MenuManager smallGreekMenu = new MenuManager("Greek lower case"); MenuManager captialGreekMenu = new MenuManager("Greek upper case"); MenuManager arrowsMenu = new MenuManager("Arrows"); MenuManager compareMenu = new MenuManager("Compare symbols"); MenuManager stdBinOpMenu = new MenuManager("Binary Operator"); MenuManager stdBracesMenu = new MenuManager("Braces"); MenuManager stdAccentsMenu = new MenuManager("Accents"); manager.add(captialGreekMenu); manager.add(smallGreekMenu); manager.add(new Separator()); manager.add(arrowsMenu); manager.add(compareMenu); manager.add(stdBinOpMenu); manager.add(stdBracesMenu); manager.add(new Separator()); manager.add(stdAccentsMenu); for (int i = 0; i < greekSmall.length; i++) smallGreekMenu.add(greekSmall[i]); for (int i = 0; i < greekCapital.length; i++) captialGreekMenu.add(greekCapital[i]); for (int i = 0; i < arrows.length; i++) arrowsMenu.add(arrows[i]); for (int i = 0; i < stdCompare.length; i++) compareMenu.add(stdCompare[i]); for (int i = 0; i < stdBinOp.length; i++) stdBinOpMenu.add(stdBinOp[i]); for (int i = 0; i < stdBraces.length; i++) stdBracesMenu.add(stdBraces[i]); for (int i = 0; i < stdAccents.length; i++) stdAccentsMenu.add(stdAccents[i]); } }