I suddenly have "Run" and "Search" in the menubar of my RCP application. Is there anyway to remove them?
First, check this thread (and the article "Contributing Actions to the Eclipse Workbench" used in this thread):
The trick was "
check the launcher config
" -- even after a completely fresh install of Eclipse 3.1.1, with precisely nothing else in my WS except my own plugins, the annoying extra menus and annoying error "edit last position" were still present.Then I went to the launcher config as you suggested, which had loads of cruft (created automagically by Eclipse) -- so I deselected all, selected my plugins, and clicked "
Add Required
"; running from the WS with that -- great!
See also bug 115998
removing the "platform" feature fixes it all up -- a very simple fix that was very hard to find!
That said, in general, to hide some action contributions you can try, like in this thread to:
1/ to hide menu/coolbar defined by 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 through a PerspectiveListener
:
The action ids I got from browsing through my dependent eclipse plugins.. searching 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 remove the preferences:
With the
PreferenceManager
I got even rid of the unwanted Preferences..:)
Where thePREFERENCES_2_WIPE
Strings have to be the IDs of the main categories you want to get rid off. Like the "org.eclipse.ui.preferencePages.Workbench" -> shows up as General
PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager();
for (int i = 0; i < PREFERENCES_2_WIPE.length; i++) {
pm.remove(PREFERENCES_2_WIPE[i]);
}
For me this worked (hope it 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>
© 2022 - 2024 — McMap. All rights reserved.