你如何找到菜单贡献的locationURI? [英] How do you find the locationURI of menu contributions?

查看:302
本文介绍了你如何找到菜单贡献的locationURI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户在项目资源管理器中右键单击文件,可以在弹出菜单中添加一个项目:

I've managed to add an item to the popup menu when the user right-clicks on a file in the Project Explorer by adding something like this:

  <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="false"
            locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu?after=additions">
         <command
               commandId="commands.mycmd"
               label="do foo"
               style="push">
         </command>
      </menuContribution>
   </extension>

现在,我知道使用 org.eclipse.ui的唯一原因。 navigator.ProjectExplorer 是因为这是每个人似乎都在做的(在Eclipse PDE文档中没有这个记录)。问题是我想要在导航器和包资源管理器视图中使用相同的功能(右键单击文件,您可以像项目资源管理器中那样执行do foo。如何查找locationURI这些其他两个视图(Package Explorer和Navigator)?

Now, the only reason I knew to use org.eclipse.ui.navigator.ProjectExplorer is because that is what everyone else seems to be doing (there is no record of this in Eclipse PDE documentation). The problem is that I want the same functionality in the Navigator and the Package Explorer views as well (right-click on a file and you can do "do foo" as in the Project Explorer. How do I find the locationURI of these other two views (Package Explorer and Navigator)?

我已经尝试了 alt + shift + F2 提示找到这样的信息,但Eclipse不允许您在激活此模式时获取选项卡本身的信息。

I've tried the alt+shift+F2 tip to find such information but Eclipse does not allow you to get the information of the tab itself when you activate this mode.

推荐答案

使用

locationURI="popup:org.eclipse.ui.navigator.any?after=additions">

它会做的伎俩。

这篇关于你如何找到菜单贡献的locationURI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆