wiki:RemoveUnwantedMenuEntries

How to remove unwanted menu entries

< back

See here for more information.

Paste the following code snippet at the end of your makeAction method in your actionBarAdvisor:

    ActionSetRegistry reg = WorkbenchPlugin.getDefault()
	.getActionSetRegistry();
    IActionSetDescriptor[] actionSets = reg.getActionSets();

    for (int i = 0; i < actionSets.length; i++) {
	if (actionSets[i].getId().equals(
		"org.eclipse.ui.actionSet.openFiles")) {
	IExtension ext = actionSets[i].getConfigurationElement()
		.getDeclaringExtension();
	reg.removeExtension(ext, new Object[] { actionSets[i] });
	break;
    }


Replace org.eclipse.ui.actionSet.openFiles with the id of another menu entry to remove another entry than the "open file" entry.

Last modified 16 years ago Last modified on Apr 10, 2008, 1:09:32 PM