【问题标题】:Eclipse Plugin-ins: How can I add a group to the popup context menu?Eclipse 插件:如何将组添加到弹出上下文菜单?
【发布时间】:2009-12-17 13:10:50
【问题描述】:

当我右键单击项目文件夹时,Eclipse 上下文菜单中有一个可用的命令。该子菜单在我认为是上下文菜单的“添加”部分中可见。但是,我想要一个行分隔符将我的贡献与其他添加区分开来。我怎样才能做到这一点?我知道通过动作贡献,您可以使用 menuBarPath(我认为)创建一个组并向其添加动作,但是如何使用 plugin.xml 中的 menuContribution 标记来做到这一点?

<extension point="org.eclipse.ui.menus">
  <menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
        <menu label="PopKit">
            <command
                commandId="convertToAppKitProjectCommand"
                mnemonic="S"
                id="ie.ondevice.popkit.plugin.menus.popup.convertProjectCommand">
                <visibleWhen>
                   <with variable="activeMenuSelection">
                      <iterate>
                         <adapt type="org.eclipse.core.resources.IProject"/>
                      </iterate>
                   </with>
                </visibleWhen>                  
            </command>
        </menu>
  </menuContribution> 

【问题讨论】:

  • 你能粘贴你的 plugin.xml 的 menuContribution-part 吗?
  • 将其添加到问题 Sven 的正文中!

标签: eclipse plugins eclipse-plugin


【解决方案1】:

在贡献的菜单中添加分隔符:

<menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
    <menu label="PopKit">
       <separator
             name="some.id.here.">
       </separator>
       <command
             commandId="convertToAppKitProjectCommand"

       // the rest ...

【讨论】:

    猜你喜欢
    • 2014-01-12
    • 1970-01-01
    • 2014-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-29
    • 2014-08-30
    • 2015-01-09
    相关资源
    最近更新 更多