willcodejavaforfood
willcodejavaforfood

Reputation: 44063

Eclipse Plugin - Popup Menu Extension

I am trying to add a new menu item to Eclipse's popupmenus. It really seemed straightforward enough in the examples and tutorials but the menu item itself is never visible. I expect this to work in all views and for basically anything that is a file. I am using Eclipse 3.4. This is the my plugin.xml configuration:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>

   <extension
         point="org.eclipse.ui.popupMenus">
      <objectContribution
            objectClass="org.eclipse.core.resources.IFile"
            id="com.willcodejavaforfood.ExploreHere.contribution1">
         <action
               label="Explore Here"
               class="com.willcodejavaforfood.explorehere.popup.actions.ExploreHereAction"
               menubarPath="additions"
               enablesFor="1"
               id="com.willcodejavaforfood.ExploreHere.newAction">
         </action>
      </objectContribution>
   </extension>

</plugin>

Any idea why it is never visible?

----edit----

Turns out my plugin works just fine in version 3.4.2 of Ganymede, but not in the older version 3.4.0 that I previously used.

Upvotes: 3

Views: 4695

Answers (3)

BOB
BOB

Reputation: 11

Try ICompiliationUnit instead of IFile

Upvotes: 1

Manuel Selva
Manuel Selva

Reputation: 19050

May be you can try the PDE templates:

File -> New plugin project -> On the last page select create from template and try the Plugin with popup menu which description is exactly what you want:

"This template adds a submenu and a new action to a target object's popup menu. This contribution will appear in all viewers where an object of the specified type is selected."

Hope this can help

Manu

Upvotes: 2

Manuel Selva
Manuel Selva

Reputation: 19050

I tried your code in my Eclipse's installation and I am able to see the action in the contextual menu when I right click one of my .c file in the Project explorer's view of the C perspective.

Take care that a Project or a project's sub folder is not a file.

Upvotes: 2

Related Questions