1

我需要将复选框下拉列表添加到 Eclipse 插件,我想添加与 Eclipse IDE“自定义透视按钮”下拉列表相同的复选框下拉列表,它看起来像这样http://s15.postimg.org/vwr4wk77f/dropdown .png

我已经使用plugin.xml创建了我的eclipse插件,我对xml真的很陌生,所以我设法用下拉列表创建了插件,但是我在xml中找不到可以帮助我处理复选框的元素

我几乎在每个网站上都搜索过信息或帮助,我还没有找到任何可以提供帮助的东西,所以如果你给我关于这个的建议,我真的很感激

我的插件代码如下所示:

<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>
4

1 回答 1

3

您需要将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>
于 2013-11-13T19:47:44.863 回答