简体   繁体   中英

How to add new items to an existing menu in Eclipse?

I want to add a new item to a menu. For example

File > New > New item

or

Project > Build > Working set > New item

I've got this far with my plugin.xml:

<menuContribution
            allPopups="false"
            locationURI="i don't know id">
         <command
               commandId="testcommand"
               icon="icons/menu_icon01.jpg"
               label="test"
               style="push">
         </command>
</menuContribution>

How can I find out the IDs of existing commands in Eclipse menus.

When you view your menuContribution in the editor, you can add a new command and click browse next to the commandId in the Extension Element Details. You'll get a list of all possible comands (at least in my Juno Version).

If you are looking for a specific item, Alt+Shift+F2, then click on the menu entry you want to inspect.

The menu File -> New however consists of Wizards. You can add to that using the org.eclipse.ui.newWizards extension point and pointing it to your Wizard implementation.

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