如何在Eclipse中删除弹出菜单中的贡献RCP [英] How remove pop-up menu contributions in eclipse RCP

查看:97
本文介绍了如何在Eclipse中删除弹出菜单中的贡献RCP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个RCP应用程序中工作,我看到哪个数据模型是IResources的实例。当弹出菜单可见时,我发现我想删除的其他插件提供的命令。



代码示例:

 
1 MenuManager menuManager = new MenuManager();
2 mm.setRemoveAllWhenShown(true);
3菜单菜单= menuManager.createContextMenu(this.treeViewer.getControl());
4 this.treeViewer.getControl()。setMenu(menu);

5 getSite()。registerContextMenu(menuManager,this.treeViewer);

如果我注释第5行上下文菜单不出现。



是posible使用menu.xml的贡献,并删除其他插件的贡献?



注意:我的弹出菜单是声明性的,它在plugin.xml中。



提前感谢

解决方案

一种可能的方法是排除所谓的Equinox变压器钩子,请参阅 http://wiki.eclipse.org/Equinox_Transforms



您可以通过一些示例检查捆绑包(有关更多信息,请参阅wiki页面),我对XSLT变压器做了很好的体验,以便在将其扩展名附加到平台(唯一的挑战是找出哪个软件包引起烦人的上下文菜单项,但是您可以使用PluginSpy来确定evildoer:-P。



HTH Tom


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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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