RushSykes
RushSykes

Reputation: 41

How to add a custom popup action to the default Eclipse editor

Ah I've searched all around but mostly I found threads about how to add custom actions for a custom menu or a custom editor, not for the original editor of Eclipse.

And since the org.eclipse.ui.popMenus is deprecated, I consider using org.eclipse.ui.menus.

So how to add a custom popup action to the default Eclipse editor Like here I want to tweak the context menu in Java editor

Upvotes: 2

Views: 584

Answers (1)

greg-449
greg-449

Reputation: 111217

The context menu for the Java editor seems to have the id of #CompilationUnitEditorContext. You can contribute to the context menu using something like:

<extension 
     point="org.eclipse.ui.menus">
   <menuContribution
         allPopups="false"
         locationURI="popup:#CompilationUnitEditorContext?before=additions">
      <command
            commandId="your.command.id"
            style="push">
      </command>
   </menuContribution>

where your.command.id is the id of a command that you define.

Upvotes: 2

Related Questions