简体   繁体   中英

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.

在此处输入图像描述

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">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM