wiki:RemoveUnwantedMenuEntries

Version 3 (modified by jdamerow, 16 years ago) (diff)

--

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.