eclipseeclipse-pluginswtjfaceeclipse-pde

How to create a context menu before Eclipse Import menu item in Eclipse Plugin development


I want to add a new menu just before Eclipse Import... menu. I am able to create a context menu item, but I want to place it before Import.... I provide below the code snippet from plugin.xml.

<menuContribution
            locationURI="popup:org.eclipse.ui.popup.any">
         <menu
               icon="icons/someIcon.png"
               id="com.sample.app.sampleMenu"
               label="PathXplorer">
            <command
                  commandId="com.sample.app.commands.actionid"
                  icon="icons/someIcon.png"
                  id="ccom.sample.app.menus.action1Id"
                  label="Some Good Label">
            </command>
        </menu>
</menuContribution>     

For more clarity, you can see below the image. My menu will be Sample Action Menu which should be visible before import. Please help me to resolve.

enter image description here


Solution

  • The id of the Import menu item seems to be import so your can specify you menu contribution position using the relative position in the locationURI:

    locationURI="popup:org.eclipse.ui.popup.any?before=import">