是否可以扩展 Eclipse 搜索菜单 [英] Is it possible to extend Eclipse Search Menu

查看:20
本文介绍了是否可以扩展 Eclipse 搜索菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在在 eclipse 中,无法使用 eclipse 扩展扩展由其他插件定义的菜单:org.eclipse.ui.menus.

right now in eclipse it is not possible to extend Menu defined by Other plugins by using eclipse extension: org.eclipse.ui.menus.

我想在搜索中添加一个菜单项,而不是搜索页面.由于菜单搜索是由 org.eclipse.search 定义的,我无法添加它.

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.

但我看到 JDT 和 CDT 确实在搜索下添加了一些菜单项.有没有人知道他们是如何做到的?

but I see JDT and CDT do add some menu item under search. does any body know how they make it work?

感谢任何提示.

推荐答案

2012 年 8 月更新,正如 reprogrammer 所评论的,org.eclipse.ui.actionSets 已弃用:

Update August 2012, as commented by reprogrammer, org.eclipse.ui.actionSets is deprecated:

相反,使用扩展点 org.eclipse.ui.commands.

Instead, use the extension point org.eclipse.ui.commands.

<小时>

原始答案(2011 年 8 月)


Original answer (August 2011)

actionSet (extension point="org.eclipse.ui.actionSets") 对 'menubarPath="org.eclipse.search.menu/Manuel Selva推荐的dialogGroup"'为官方解决方案,符合一般菜单贡献.

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.

但要注意一些可能仍然存在于搜索菜单贡献的问题,如此线程说明围绕(据称已修复)错误 15684:
(那是在 2009 年,希望此后问题已得到解决)

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)

实际上所做的工作是重新定义整个搜索菜单,就像 JDT 3.6 当前仍在使用的解决方法一样:

What actually does work is redefining the whole Search Menu as in the workaround that is still currently used in JDT 3.6:

   <extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            label="%JavaSearchActionSet.label"
            description="%JavaSearchActionSet.description"
            visible="false"
            id="org.eclipse.jdt.ui.SearchActionSet">
<!-- see http://bugs.eclipse.org/bugs/show_bug.cgi?id=15684    -->
<!-- Note: The menu (re-) definition has to be here due to bug: -->
<!-- =================================================================== -->
<!-- Search Menu                                                         -->
<!-- =================================================================== -->
         <menu
               label="%searchMenu.label"
               path="navigate"
               id="org.eclipse.search.menu">
                <groupMarker name="internalDialogGroup"/>   <!-- not to be used by clients  -->
                <groupMarker name="dialogGroup"/>           <!-- to be used by clients      -->
                <separator name="fileSearchContextMenuActionsGroup"/> <!-- to be used by clients      -->
                <separator name="contextMenuActionsGroup"/> <!-- to be used by clients -->
                <separator name="occurencesActionsGroup"/> <!-- to be used by clients -->
                <separator name="extraSearchGroup"/> <!-- to be used by clients -->
         </menu>
<!-- (...) -->

这篇关于是否可以扩展 Eclipse 搜索菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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