I want to add a custom menu item to the context menu of the default text editor in eclipse.
I can add a menu entry to all context menus with
<menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<command commandId="HelloPlugin2.commands.sampleCommand" label="My Test" style="push" />
</menuContribution>
but I want it to be shown only in the current editors context menu, so i tried
<menuContribution locationURI="popup:#TextEditorContext?after=additions">
<command commandId="HelloPlugin2.commands.sampleCommand" label="My Test" style="push" />
</menuContribution>
but unfortunately the item is not visible...
Can anybode help me out? Thank you!
The base text editor context menu id is #TextEditorContext but other editors based on the text editor normally override this using the setEditorContextMenuId method.
Looking at the setEditorContextMenuId calls the Java text editor context menu id appears to be #CompilationUnitEditorContext (and #ClassFileEditorContext if a .class file is being edited).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With