是否可以扩展 Eclipse 搜索菜单
现在在 Eclipse 中,无法使用 Eclipse 扩展来扩展其他插件定义的菜单: org.eclipse.ui.menus。
我想在搜索中添加一个菜单项,但不是搜索页面。由于菜单搜索是由 org.eclipse.search 定义的,我无法添加它。
但我看到 JDT 和 CDT 确实在搜索下添加了一些菜单项。有谁知道他们是如何让它发挥作用的吗?
任何提示表示赞赏。
right now in eclipse it is not possible to extend Menu defined by Other plugins by using eclipse extension:
org.eclipse.ui.menus.
I want to add one menu item in Search but not a search page. since the Menu Search is defined by org.eclipse.search, I cannot add it.
but I see JDT and CDT do add some menu item under search. does any body know how they make it work?
any hint is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 org 从其他插件扩展菜单.eclipse.ui.actionSets 扩展点
这就是 JDT 使用自己的操作扩展搜索菜单的方式。为了在给定菜单中执行操作,您必须填写
menubarPath
值。例如,Java 搜索操作的 JDT 填充了以下内容:我建议导入 JDT UI 源并查看 JDT plugin.xml 文件。或者,您将需要一个经典的 Eclipse SDK,然后在插件视图中右键单击 org.eclipse.jdt.ui 插件并选择导入作为源。
You can extend menus from other plugins using org.eclipse.ui.actionSets extension point
This is how the JDT does to extend the search menu with its own action. In order to have the action in a given menu you'll have to fill the
menubarPath
value. For example the JDT for the Java search action filled it with:I suggest to import the JDT UI sources and to look at the JDT plugin.xml file. FOr that you will need a classic Eclipse SDK and then in the plugins view right click on the
org.eclipse.jdt.ui
plugin and select import as source.只要您知道菜单或工具栏的 ID,就可以使用 org.eclipse.ui.menus 扩展点来扩展它们。对于搜索菜单,此 ID 为 org.eclipse.search.menu。如果您想向
dialogGroup
添加内容,请使用org.eclipse.search.menu?after=dialogGroup
。As long as you know the ID of the menu or toolbar, you can extend these using the
org.eclipse.ui.menus
extension point. For the search menu, this ID isorg.eclipse.search.menu
. If you want to add stuff to thedialogGroup
then useorg.eclipse.search.menu?after=dialogGroup
.2012 年 8 月更新,如 reprogrammer 所评论,
org.eclipse.ui.actionSets
已弃用:原始答案(2011 年 8 月)
actionSet (
extension point="org.eclipse.ui.actionSets"
) 上的操作Manuel SelvamenubarPath="org.eclipse.search.menu/dialogGroup"” a> 是官方解决方案,符合 一般菜单贡献。但要注意一些可能仍然存在于搜索菜单贡献中的问题,如由此线程围绕(据说已修复)错误 15684:
(那是在 2009 年,希望这个问题已经得到解决)
Update August 2012, as commented by reprogrammer,
org.eclipse.ui.actionSets
is deprecated:Original answer (August 2011)
The actionSet (
extension point="org.eclipse.ui.actionSets"
) with an action on 'menubarPath="org.eclipse.search.menu/dialogGroup"
' recommended by Manuel Selva is the official solution, in line with general menu contribution.But beware of some issue that might still lingering for Search menu contribution, as illustrated by this thread around the (supposedly fixed) bug 15684:
(it was in 2009, hopefully the issue has been addressed since)