编辑器上下文菜单 - Eclipse-RCP
我有一个 Eclipse RCP 应用程序。我创建了一个编辑器。当我右键单击编辑器时,几乎没有上下文菜单(默认)。我还没有创建这些菜单。 请告诉我,如何删除编辑器的上下文菜单?
I have an Eclipse RCP application. I have created an Editor. There are few context menu (default), when I right click on the Editor. I have not created these menus.
Please let me know, How to remove the context menu of the Editor?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它需要您扩展编辑器的不同方法。
让我知道你扩展了什么,比我能回答更有效的问题。
一般情况下:
将使用 IWorkbenchParSite#registerContextMenu(...),因此找到调用它的位置,覆盖它。不推荐。因为通过这样做,为您的编辑器提供的菜单扩展将不再起作用。
It needs different approach by which editor you extends.
Let me know What you extends, than I can answer more efficient one.
In general way:
IWorkbenchParSite#registerContextMenu(...) will be used, So find where calls that, override it. It is not recommend. Because by doing this, Menu Extensions which is contributed for your editor will not work anymore.
如果您指的是出现在编辑器选项卡和视图选项卡上的系统菜单,则该菜单由演示文稿(2.1、经典、默认等)提供。没有任何调整可以简单地修改它。
删除它的两种方法是:
这
org.eclipse.ui.presentations.StackPresentation
API 和匹配的扩展点。
撰写演示文稿是一项复杂的工作
承诺。
org.eclipse.ui.workbench 插件
并在 RCP 中修补该插件
应用程序。
If you mean the system menu that appears on editor tabs and view tabs, that menu is provided by the presentation (2.1, Classic, Default, etc). There is no tweak to simply modify it.
The 2 ways to remove it would be:
the
org.eclipse.ui.presentations.StackPresentation
API and matching extension point.
Writing a presentation is a involved
undertaking.
org.eclipse.ui.workbench
pluginand patch that plugin in your RCP
app.
如果您使用 Text 或 StyleText,您将获得系统默认菜单(剪切、复制、粘贴,也许是有关编码或输入的内容)。如果您不打算提供自己的菜单,只需创建一个空的 SWT 菜单并进行设置即可:
Eclipse 还有一个文本编辑框架,如果您需要的不仅仅是基本文本框,您应该查看它。 http://wiki.eclipse.org/The_Official_Eclipse_FAQs#Text_Editors
If you use Text or StyleText you will get the system default menu (cut,copy,paste, maybe something about encoding or input). If you are not going to supply your own menu, simply create an empty SWT Menu and set it:
Eclipse also has a text editing framework, if you need more than a basic text box you should check it out. http://wiki.eclipse.org/The_Official_Eclipse_FAQs#Text_Editors