recluising
recluising

Reputation: 348

popup plugin development eclipse 3.6.2

I'm trying to develop an eclipse plugin, but, seeing the steps, or using the template Eclipse gives, I can't see the menu item.

Mi Eclipse version is 3.6.2 and mi plugin.xml file has this content:

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

   <extension
         point="org.eclipse.ui.popupMenus">
      <objectContribution
            objectClass="org.eclipse.core.resources.IFile"
            id="Test.contribution1">
         <menu
               label="Test Submenu"
               path="additions"
               id="Test.menu1">
            <separator
                  name="group1">
            </separator>
         </menu>
         <action
               label="Test Action"
               class="test.popup.actions.TestNewAction"
               menubarPath="Test.menu1/group1"
               enablesFor="1"
               id="Test.newAction">
         </action>
      </objectContribution>
   </extension>

</plugin>

This is the sample template Eclipse gives, but it doesn't work.

It's supposed that this kind of menu shows the option when you right click on a Java element (like a constant or something like that). Am I wrong?

Upvotes: 0

Views: 416

Answers (1)

Astyan
Astyan

Reputation: 108

Indeed, the code you posted should show a menu and a submenu when you make a right click on a file in the Project Explorer/Package Explorer view.

If you don't see any menu or submenu, try to add adaptable="true" and nameFilter="*", like this :

 <objectContribution
        adaptable="true"
        nameFilter="*"
        objectClass="org.eclipse.core.resources.IFile"
        id="Test.contribution1">

It should work now and you should have this output.

Upvotes: 2

Related Questions