I am developing an eclipse plugin and trying to extend the source menu (mainMenubar/Source – visible when editing in the java-editor) in Eclipse 3.7.
The documentation says to rely on the org.eclipse.ui.menus-extension point since the older extension points are deprecated. It is a complete secret to me where to obtain reliable locationURIs, but I finally managed to find some plausible URI with the Plugin Spy (following an advice here).
So the following should be the extension snippet for the plugin.xml:
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.jdt.ui.source.menu">
<command
commandId="some.command.id"
label="Some label"
style="push">
</command>
</menuContribution>
</extension>
Unfortunately, when running the plugin for my development IDE no command appears, and also no error message. Just nothing happens. When I set the locationURI to “menu:help”, the new command appears in the help menu, so the problem seems to be really the locationURI.
I ran into the same problem. I finally figured out that extending the Source menu using the (recommended) extension point
org.eclipse.ui.menusis not possible.The reason is that a menu defined in an old style
actionSet(like the Source menu) is created after the processing oforg.eclipse.ui.menus-extensions. The way it is, these extensions can only contribute to already existing menus.So sticking to the old API (as suggested by VonC) is probably the best option until the
jdtplugin is migrated to the new approach…