How remove pop-up menu contributions in eclipse RCP(如何删除 Eclipse RCP 中的弹出菜单贡献)
问题描述
我在一个 RCP 应用程序中工作,并且我知道哪个数据模型是 IResources 的实例.当弹出菜单可见时,我发现我想删除的其他插件贡献的命令.
代码示例:
<上一页>1 菜单管理器菜单管理器 = 新菜单管理器();2 mm.setRemoveAllWhenShown(true);3 菜单菜单 = menuManager.createContextMenu(this.treeViewer.getControl());4 this.treeViewer.getControl().setMenu(menu);5 getSite().registerContextMenu(menuManager, this.treeViewer);如果我注释第 5 行上下文菜单不出现.
是否可以使用 plugin.xml 中的 menu-contribution 并删除其他插件的贡献?
注意:我的弹出菜单是声明性的,它位于 plugin.xml 中.
提前致谢
一种可能的方法是执行所谓的Equinox 转换器挂钩",请参阅 http://wiki.eclipse.org/Equinox_Transforms
您可以通过一些示例检查捆绑包(有关更多信息,请参阅 wiki 页面),我在 XSLT 转换器方面取得了很好的经验,可以在某些 plugin.xml 文件向平台贡献其扩展之前对其进行操作(唯一的挑战是找出哪个包造成了烦人的上下文菜单条目,但您可以使用 PluginSpy 来确定邪恶者":-P.
HTH 汤姆
I'm working in a RCP application and I have a view which data model are instances of IResources. When popup menu is visible I find commands contributed by others plugins I would like to remove.
Sample of code:
1 MenuManager menuManager = new MenuManager(); 2 mm.setRemoveAllWhenShown(true); 3 Menu menu = menuManager.createContextMenu(this.treeViewer.getControl()); 4 this.treeViewer.getControl().setMenu(menu); 5 getSite().registerContextMenu(menuManager, this.treeViewer);
If I comment line 5 context menu doesn't appear.
Is posible use menu-contribution from plugin.xml and remove contributions of other plugins?
Note: My popup menu is declarative and it is in plugin.xml.
Thanks in advance
A possible way is to exeucte so called "Equinox transformer hooks", see http://wiki.eclipse.org/Equinox_Transforms
You can checkout the bundles with some examples (see the wiki-page for more infos), I made good experiences with the XSLT transformer, to manipulate certain plugin.xml files before they're contributing their extensions to the platform (the only challenge is to find out which bundle is contributing the annoying context-menu entry, but you can use PluginSpy to determinate the "evildoer" :-P.
HTH Tom
这篇关于如何删除 Eclipse RCP 中的弹出菜单贡献的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何删除 Eclipse RCP 中的弹出菜单贡献
基础教程推荐
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
