简体   繁体   中英

Make a radio button in Eclipse plugin's menu

I have this menu that has 2 items Compile and Run [shown in the screenshot below]

I want to make another menu item in the form : [ Language-> ] and Language has other two items 'German' & 'French' that have check boxes or Radio buttons as I want the user to check one of the 2 languages and I detect that so I can make some changes according to the language check

so now I need 2 things 1- make the menu with that format and they have to be checkable 2- How to detect which one was checked

图1

Here is the XML 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>
      </actionSet>
   </extension>



</plugin>

You just need to add

style="radio"

to the XML definitions. See the Eclipse help for more information and how to choose which of the two is marked by default.

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