Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[pde-dev] Usage of org.eclipse.core.resources.IFile as value for <objectClass> of <enablement> element

Hi All

I am developing a code generator plug-in for Java Projects and am using the org.eclipse.ui.popupMenus extention.
If I use the <objectContribution> element then the menu item is not visible in the context menu. The following are the declaration in the plugin.xml file
<?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"
   nameFilter="*.java"
   id="AvnetCodeGenerator.generateInterface">
   <menu
    label="Generate Interface Definitions"
    path="additions"
    id="AvnetCodeGenerator.menu1">
    <separator
     name="group1">
    </separator>
   </menu>
   <action
    label="Generate"
    class="com.accenture.avnet.codegenerator.plugin.popup.actions.NewAction"
    menubarPath="AvnetCodeGenerator.menu1/group1"
    id="AvnetCodeGenerator.newAction">
   </action>
  </objectContribution>
 </extension>

</plugin>


The menu item is displayed, using the <viewerContribution> element,but I am not able to enable it for the java files in the Package Explorer. The following are the declaration in the plugin.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
 <extension point="org.eclipse.ui.popupMenus">
  <viewerContribution
   id="AvnetCodeGenerator.generateInterface"
   targetID="org.eclipse.jdt.ui.PackageExplorer">
   <menu
    label="Generate Interface Definitions"
    path="additions"
    id="AvnetCodeGenerator.menu1">
    <separator
     name="group1">
    </separator>
   </menu>
   <action
    label="Generate"
    class=" com.accenture.avnet.codegenerator.plugin.popup.actions.NewAction"
    menubarPath="AvnetCodeGenerator.menu1/group1"
    enablesFor="*"
    id="AvnetCodeGenerator.newAction">
    <enablement>
     <and>
      <objectClass name="org.eclipse.core.resources.IFile"/>
      <objectState name="extension" value="java"/>
     </and>
    </enablement>
   </action>
  </viewerContribution>
 </extension>
</plugin>

Please help me by pointing where I am going wrong.

Thanks and Regards

Prashant Vasha


Back to the top