2

I'm trying to implement a slightly customized XML editor for my Eclipse RCP application. The editor extends the TextEditor class and works just fine. Except that it puts a lot of stuff to the context (right-click) popup menu I don't really need. I found that I need to overwrite the editorContextMenuAboutToShow function:

@Override
public void editorContextMenuAboutToShow(IMenuManager menu) {
    menu.removeAll();
}

This works fine except that I still have menus in my context menu, namely Debug As, Run As, Validate, Team, Compare etc. menus and their submenus.

I'm not sure what else to do and this is very annoying since I do not want the user to get access to these features. I'd appreciate any help

Thank you

breakline
  • 5,776
  • 8
  • 45
  • 84
  • The extra items are because `AbstractTextEditor` calls `IEditorSite.registerContextMenu` to register the context menu which lets other plug-ins add to the menu. I can't see an obvious way to stop this. – greg-449 Feb 11 '14 at 10:39
  • Thank you Greg for the help! It seems we need to implement our own AbstractTextEditor then if we wantto overwrite these. – breakline Feb 11 '14 at 11:14
  • Is that on Eclipse 3.x? Then this post might help you: http://stackoverflow.com/questions/3482312/is-it-possible-to-hide-remove-arbitrary-context-menu-items-in-eclipse-3-6 – Calon Feb 11 '14 at 11:57
  • You may be able to use the `activityPatternBinding` mentioned in the question referenced in another comment. – greg-449 Feb 11 '14 at 13:16

1 Answers1

0

I guess activities don't work with Context Menus.

I was able to remove all context menus , but except "Github"-menu by adding following single line code to editorContextMenuAboutToShow() method :

ObjectActionContributorManager.getManager().unregisterAllContributors();
Yaseen Ahmad
  • 1,807
  • 5
  • 25
  • 43
Rajan
  • 63
  • 8