问题描述
我正在构建一个插件,并在上下文菜单中添加一个条目(右键单击项目树中的文件夹)。
I'm building a plugin, and adding an entry to the context menu (right-click on a folder in the project tree).
到目前为止,按照本教程:
So far it works, following this tutorial:http://www.eclipse.org/articles/article.php?file=Article-JFaceWizards/index.html
问题是它在我的条目中添加上下文菜单的根。由于我的条目是指新的XXX向导,我希望它进入新建子菜单。
The problem is that it's adding my entry in the root of the context menu. Since my entry refers to a "New XXX" wizard, I want it to go to the "New" submenu.
好像我必须设置正确的位置URI或者我的plugin.xml中的menuPath。但是我找不到与该子菜单相对应的locationURI或menuPath。如何找到?
It seems like I would have to set the correct locationURI or menuPath in my plugin.xml. However I can't find the locationURI or menuPath corresponding to that submenu. How can I find that?
推荐答案
新的贡献是基于菜单ID,而不是基于菜单路径。所以应该是这样的:
The new contributions are menu ID based, not menu path based. So it should be something like:
<menuContribution
locationURI="menu:file?after=additions" />
看到这个。
请参阅更多。确切的ID是:在菜单中现有的plugin.xml中找到
See this SO answer for an example of locationUri
.
See Menu Extension for more. The exact id is either:
- 通过确定
- found in the existing plugin.xml from the menu or
- determined with plugin Spy
请参阅(从)了解更多关于添加条目的菜单。
See "How to add items in popup menu?" (from justinmreina) for more on adding an entry to a menu.
这篇关于在弹出式菜单的子菜单中添加条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!