Launch and search are displayed in RCP Menubar

I suddenly got “Run” and “Search” in the menu bar of my RCP application. Is there any way to remove them?

+6
eclipse rcp eclipse-rcp
source share
2 answers

First check this thread (and the " Contributing to Workbench Eclipse " article used in this thread ):

The trick was “ check the launcher config ” - even after a completely new installation of Eclipse 3.1.1, and nothing else in my WS, except for my own plugins, annoying additional menus and annoying error “edit last position” were still present.

Then I went into the launcher configuration, as you expected, which had a lot of cracks (automatically created by Eclipse) - so I unselected all, selected my plugins and clicked " Add Required " ; works with WS with this - great!

See also error 115998

removing the platform function fixes all this - a very simple fix that was very hard to find!


In general, to hide some actions you can try, for example, this thread :

1 / to hide the menu / cooler defined by the ActionSet extension point.

 IWorkbenchPage.hideActionSet(actionSetId) IWorkbenchPage.hideActionSet("org.eclipse.search.menu"); 

2 / Hide its menu:

 MenuManager mbManager = ((ApplicationWindow)page.getWorkbenchWindow()).getMenuBarManager(); for (int i=0; i<mbManager.getItems().length; i++){ IContributionItem item=mbManager.getItems()[i]; if (item.getId().equals("org.eclipse.search.menu")){ item.setVisible(false); } } 

Or you can try this thread to hide it for any perspective using the PerspectiveListener :

IDs of the actions I received from viewing my dependent eclipse plugins .. search for ActionSets

 package ch.post.pf.gui.prototyp.sesam.pstonline; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IPerspectiveDescriptor; import org.eclipse.ui.IPerspectiveListener; import org.eclipse.ui.IStartup; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; public class ActionWiper implements IStartup, IPerspectiveListener { private static final String[] ACTIONS_2_WIPE = new String[] { "org.eclipse.search.searchActionSet", "org.eclipse.ui.edit.text.actionSet.presentation", "org.eclipse.ui.edit.text.actionSet.openExternalFile", "org.eclipse.ui.edit.text.actionSet.annotationNavigation", "org.eclipse.ui.edit.text.actionSet.navigation", "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo", "org.eclipse.update.ui.softwareUpdates" }; public void earlyStartup() { IWorkbenchWindow[] windows = PlatformUI.getWorkbench() .getWorkbenchWindows(); for (int i = 0; i < windows.length; i++) { IWorkbenchPage page = windows[i].getActivePage(); if (page != null) { wipeActions(page); } windows[i].addPerspectiveListener(this); } } private void wipeActions(IWorkbenchPage page) { for (int i = 0; i < ACTIONS_2_WIPE.length; i++) { wipeAction(page, ACTIONS_2_WIPE[i]); } } private void wipeAction(final IWorkbenchPage page, final String actionsetId) { Display.getDefault().syncExec(new Runnable() { public void run() { page.hideActionSet(actionsetId); } }); } public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { wipeActions(page); } public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) { } } 

And delete the settings:

With PreferenceManager I even got rid of unwanted settings .. :)
Where the lines PREFERENCES_2_WIPE should be the identifiers of the main categories that you want to get rid of. How "org.eclipse.ui.preferencePages.Workbench" → appears as generic

 PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager(); for (int i = 0; i < PREFERENCES_2_WIPE.length; i++) { pm.remove(PREFERENCES_2_WIPE[i]); } 
+8
source share

This worked for me (I hope this helps you):

  <extension point="org.eclipse.ui.activities"> <activity id="someid.remove" name="RemoveSearchMenu"> <enabledWhen> <with variable="activePartId"> <equals value="someidr.RemoveSearchMenu1"> </equals> </with></enabledWhen> </activity> <activityPatternBinding activityId="someid.remove" pattern="org.eclipse.search.*"> </activityPatternBinding> 

+3
source share

All Articles