简体   繁体   中英

How to add a context menu to existing “File” menu in Eclipse Plugin development?

In Eclipse main menu how to contribute to an existing Main Menu for ex need to create a context menu under Main menu "File" . What is the location URI "File"

The location URI for the file menu is menu:file .

See org.eclipse.ui.internal.ide.WorkbenchActionBuilder for information about the different sections and IDs...

Here is an example how to add submenu to File menu:

   <extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            id="com.my.plugin.actionSet"
            label="My ActionSet"
            visible="true">
         <menu
               id="mymenu"
               label="My Menu"
               path="file/fileEnd">
            <groupMarker
                  name="start">
            </groupMarker>
            <separator
                  name="additions">
            </separator>
         </menu>
         <action
               class="com.my.plugin.ActionClass"
               id="com.myplugin.action"
               label="Action"
               menubarPath="file/mymenu/start"
               style="push">
         </action>
      </actionSet>
   </extension>

Constants for positioning MyMenu within File menu could be found at org.eclipse.ui.IWorkbenchActionConstants

Cheers, Max

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