简体   繁体   English

eclipse插件:如何添加复选框下拉列表

[英]eclipse plugin: how to add checkboxes dropdownlist

i need to add checkboxes dropdownlist to an eclipse plug-in , i want to add checkboxes dropdownlist that is the same as eclipse ide "customize perspective button " dropdownlist which it look like this http://s15.postimg.org/vwr4wk77f/dropdown.png 我需要将复选框dropdownlist添加到eclipse插件中,我想添加与eclipse ide“定制透视图按钮” dropdownlist相同的复选框dropdownlist,它看起来像这样http://s15.postimg.org/vwr4wk77f/dropdown巴纽

I have created my eclipse plugin using plugin.xml, I am really new to xml, so i have managed to create the plugin with a pulldown list,but i can't find an element in xml which can help me with the checkboxes 我已经使用plugin.xml创建了我的eclipse插件,我对xml真的很陌生,因此我设法通过下拉列表创建了该插件,但是我在xml中找不到可以帮助我使用复选框的元素

I have searched almost in every website for information or help, i haven't found anything that can help, so please guy I really appreciate if you give me advises about this 我几乎在每个网站上都搜索过有关信息或帮助的信息,但是我找不到任何可以帮助您的信息,因此,如果您能向我提供建议,我将非常感谢

my plugin code look like this : 我的插件代码如下所示:

<plugin>


<extension point="org.eclipse.ui.menus">
    <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
        <toolbar id="my.Toolbar">
        </toolbar>
    </menuContribution>


      </extension>

   <extension point="org.eclipse.ui.commands">
      <category
            id="TRE.projects.commands.category"
            name="%category.name.0">
      </category>

      <category
            id="TRE.projects.commands.MultiCategory"
            name="MultiCategory">
      </category>

      <command
            name="Configuration1"
            categoryId="TRE.projects.commands.MultiCategory"
            id="my.command1">
      </command>

      <command
            name="Configuration2"
            categoryId="TRE.projects.commands.MultiCategory"
            id="my.command2">
      </command>

   </extension>

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


      <handler
            commandId="my.command1"
            class="TRE.projects.handlers.SampleHandler">
      </handler>

      <handler
            commandId="my.command2"
            class="TRE.projects.handlers.SampleHandler">
      </handler>


   </extension>




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

    <menuContribution locationURI="toolbar:my.Toolbar?after=additions">
            <command
                  commandId="my.command1"
                  icon="icons/sample.gif"
                  id="my.Toolbar.command1"
                  style="pulldown"
                  tooltip="TRE Plugin">
            </command>
      </menuContribution>

      <menuContribution
            locationURI="menu:org.eclipse.ui.main.popup?after=additions">
         <menu
               id="TRE.projects.menus.sampleMenu"
               label="%menu.label.0"
               mnemonic="%menu.mnemonic.0">
            <command
                  commandId="TRE.projects.commands.sampleCommand"
                  id="TRE.projects.menus.sampleCommand"
                  mnemonic="%command.mnemonic.0"
                  style="toggle">
            </command>
         </menu>
      </menuContribution>

You need to add command elements to the menuContribution and use the style=toggle attribute. 您需要将command元素添加到menuContribution并使用style=toggle属性。

<menuContribution
      locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
    <command
           commandId="my.command1"
           label="Simple Item"
           style="toggle">
     </command>
</menuContribution>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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