在弹出式菜单的子菜单中添加条目 [英] Adding an entry in a submenu of a popup

查看:91
本文介绍了在弹出式菜单的子菜单中添加条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个插件,并在上下文菜单中添加一个条目(右键单击项目树中的文件夹)。

I'm building a plugin, and adding an entry to the context menu (right-click on a folder in the project tree).

到目前为止,按照本教程:
http:/ /www.eclipse.org/articles/article.php?file=Article-JFaceWizards/index.html

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" />

看到这个 locationUri 的示例中的添加项目在弹出菜单> SO答案

请参阅菜单扩展更多。确切的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

alt text http://eclipsesource.com/blogs/wp-content/uploads/2009/04/spy21-300x240.png

请参阅如何在弹出菜单中添加项目(从 justinmreina )了解更多关于添加条目的菜单。

See "How to add items in popup menu?" (from justinmreina) for more on adding an entry to a menu.

这篇关于在弹出式菜单的子菜单中添加条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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