0
votes

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?

3

3 Answers

1
votes

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.

1
votes

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:

  1. write your own presentation, using the org.eclipse.ui.presentations.StackPresentation API and matching extension point. Writing a presentation is a involved undertaking.
  2. Change the internal classes in the org.eclipse.ui.workbench plugin and patch that plugin in your RCP app.
0
votes

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:

Menu emptyMenu = new Menu(text);
text.setMenu(emptyMenu);

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