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

查看:24
本文介绍了你如何找到菜单贡献的 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">

它会成功的.

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

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