Search code examples
eclipse-plugin

Adding an entry in a submenu of a popup


I'm building a plugin, and adding an entry to the context menu (right-click on a folder in the project tree).

So far it works, following this tutorial: http://www.eclipse.org/articles/article.php?file=Article-JFaceWizards/index.html

The problem is that it's adding my entry in the root of the context menu. Since my entry refers to a "New XXX" wizard, I want it to go to the "New" submenu.

It seems like I would have to set the correct locationURI or menuPath in my plugin.xml. However I can't find the locationURI or menuPath corresponding to that submenu. How can I find that?


Solution

  • The new contributions are menu ID based, not menu path based. So it should be something like:

    <menuContribution
    locationURI="menu:file?after=additions" />
    

    See this SO answer for an example of locationUri.
    See Menu Extension for more. The exact id is either:

    • found in the existing plugin.xml from the menu or
    • determined with plugin Spy

    alt text

    See "How to add items in popup menu?" (from justinmreina) for more on adding an entry to a menu.