Reputation: 97
I've followed all the possible solutions that I found on several forum (also this: Eclipse plugin menu item is not visible). But, all of them didn't resolve my problem. I've also followed this tutorial http://www.vogella.com/tutorials/EclipsePlugIn/article.html. Anyway the label didn't show in the menu. This is my plugin.xml:
<extension
point="org.eclipse.ui.commands">
<command
defaultHandler="pr.handlers.SampleHandler3"
id="pr.commands.rightclick"
name="Analyze">
</command>
.....
<menuContribution
locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
<command
commandId="pr.commands.rightclick"
label="Analyze"
style="push">
<visibleWhen>
<with variable="activeMenuSelection">
<iterate
ifEmpty="false">
<adapt type="org.eclipse.core.resources.IFile">
<test property="org.eclipse.core.resources.name" value="*java" />
</adapt>
</iterate>
</with>
</visibleWhen>
</command>
</menuContribution>
Upvotes: 0
Views: 1011
Reputation: 111142
It seems that for Java files in the packages section of the Package Explorer there is no adapter defined for org.eclipse.core.resources.IFile
, there is however an adapter for org.eclipse.core.resources.IResource
so changing your adapt
to that should work.
Since matching IResource
will also match folders your test
would be better checking the content type id:
<adapt type="org.eclipse.core.resources.IResource">
<test property="org.eclipse.core.resources.contentTypeId" value="org.eclipse.jdt.core.javaSource" />
</adapt>
Upvotes: 1