我在一个 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 中的弹出菜单贡献的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!