0

On the eclipse plugin that I am working on I want to add a context menu "myAction" on the Package Explorer view, just after "Delete" when you right click on a java class in the package explorer for example.

Right now I have a menuContribution, popup:

 <menuContribution
            allPopups="false"
            locationURI="popup:org.eclipse.ui.edit?after=additions">
         <command
               commandId="plugin.myActionCommand"
               icon="icons/myAction.gif"
               style="push"
               tooltip="hello">
         </command>
 </menuContribution>

I found this LocationURI by doing (ALT+SHIFT+F2) on "Delete" as mentioned in this post : How to add a submenu entry to Eclipse Package Explorer context menu item using org.eclipse.ui.menus? But it does not work.

My questions are : Should I use popup: or menu: in my LocationURI? Which URI is it for Package Explorer view -> (right click) Delete? And does there is now a better way than this old SO post, that could make it work?

PS : I know you could say it's duplicated BUT I am wondering if the answer is not outdated, and he didn't clearly answer the orginal question.

Logan Wlv
  • 3,274
  • 5
  • 32
  • 54

1 Answers1

2

Context menus are popup: menus.

The Package Explorer view context menu id is org.eclipse.jdt.ui.PackageExplorer

The group in the context menu containing 'Delete' is group.edit.

All the above confirmed by reading the Package Explorer source code (org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart).

So this menuContribution adds after Delete:

<menuContribution
    allPopups="false"
    locationURI="popup:org.eclipse.jdt.ui.PackageExplorer?endof=group.edit">
greg-449
  • 109,219
  • 232
  • 102
  • 145