简体   繁体   中英

Making a pulldown menu in the action menu in Eclipse plugin

I have the following menu item that should have other 2 items when pointed to but it just have the arrow that indicates that it is a pulldown. I need to make 2 other menu items appear when I point to the menu item 'Language ' in the figure below

and this is the code for the menu

 <plugin>

   <extension
         point="org.eclipse.ui.actionSets">

      <actionSet
            id="Bachelor.actionSet"
            label="New menu"
            visible="true">

  <menu
               id="sampleMenu"
               label="Localized">
            <separator
                  name="sampleGroup">
            </separator>
            <groupMarker
                  name="content">
            </groupMarker>
         </menu>
<action
      class="bachelor.actions.Compile"
      icon="icons/sample.gif"
      id="bachelor.actions.Compile"
      label="&amp;Compile"
      menubarPath="sampleMenu/content"
      toolbarPath="sampleGroup"
      tooltip="Open the resource manager view">
</action>
<action
      class="bachelor.actions.Run"
      icon="icons/sample.gif"
      id="bachelor.actions.Run"
      label="&amp;Run"
      menubarPath="sampleMenu/content"
      toolbarPath="sampleGroup"
      tooltip="Open the resource manager view">
</action>
<action
      class="language"
      id="Bachelor.action1"
      label="Language"
      menubarPath="sampleMenu/content"
      pulldown="true"
      state="true"
      style="pulldown"
      visible="true">
   <selection
         class="bachelor.German"
         name="German">
   </selection>
</action>


      </actionSet>
   </extension>
</plugin>

在此处输入图片说明

First of all, you should use commands and handlers instead of actionSets, see http://wiki.eclipse.org/Platform_Command_Framework

In this case, your pulldown action needs to implement a different I*ActionDelegate and provide an IMenuCreator . See the Extension Point Description for org.eclipse.ui.actionSets

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