Reputation: 1
I'm currently working on an Eclipse plugin. I want to add an item on right-click menu in WorkbenchView of my plugin. This item should be visible only to a specific object.
I tried to use the VisibleWhen tag like this :
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:MyURI">
<command
commandId="MyCommandId"
style="push">
<visibleWhen
checkEnabled="false">
<test
property="org.eclipse.core.resources.name"
value="WORKSPACE">
</test>
</visibleWhen>
</command>
</menuContribution>
</extension>
And when I do it the menu item never appears.
So is there a way to test the properties values of org.eclipse.core.resources and know what is wrong with them ?
Thanks.
Alexandre.
Upvotes: 0
Views: 176
Reputation: 1212
Try something like this:
<visibleWhen
checkEnabled="false">
<iterate>
<adapt type="org.eclipse.core.resources.IResource">
<test property="org.eclipse.core.resources.name"
value="*.java"/>
</adapt>
</iterate>
This will show the menu for all of the *.java files. Modify this according to your needs.
Upvotes: 1