org.eclipse.jface.action.ContributionManager Java Examples

The following examples show how to use org.eclipse.jface.action.ContributionManager. 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: TLAEditor.java    From tlaplus with MIT License 5 votes vote down vote up
private void removeTopLevelMenuWithDisplayText(final String text, final ContributionManager cm) {
    final IContributionItem[] items = cm.getItems();
	
    for (final IContributionItem item : items) {
    	if (item instanceof MenuManager) {
    		final MenuManager mm = (MenuManager)item;
    		final String menuText = mm.getMenuText();
    		
    		if ((menuText != null) && menuText.startsWith(text)) {
    			cm.remove(item);
    			return;
    		}
    	}
    }
}
 
Example #2
Source File: WorkbenchUtils.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public static void refreshMainMenu() {
  	IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
WorkbenchWindow ww = (WorkbenchWindow)w;
  	IMenuService service = (IMenuService)w.getService(IMenuService.class);
  	service.populateContributionManager((ContributionManager)ww.getActionBars().getMenuManager(), MenuUtil.MAIN_MENU);
  }