你如何找到菜单贡献的 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".如何找到这另外两个视图(包资源管理器和导航器)?
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">
它会成功的.
相关文章