【问题标题】:eclipse plugin: how to add checkboxes dropdownlisteclipse插件:如何添加复选框下拉列表
【发布时间】:2013-11-26 13:44:14
【问题描述】:

我需要将复选框下拉列表添加到 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>

【问题讨论】:

    标签: java eclipse checkbox


    【解决方案1】:

    您需要将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>
    

    【讨论】:

    • 感谢快速重播,我已经完成了您之前在我的代码中所说的内容,但样式是“下拉”来创建下拉列表,但现在我找不到帮助我创建的元素复选框下拉列表,感谢您的建议,但“切换”样式为按钮提供了一个选项,该选项只能单击按钮。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多