Reputation: 155
I wish to add a popup menu to the Eclipse Problem View. I can add the menu but I want it to only appear under certain condition. Like for example when a certain type of problem is selected in the problems view.
Upvotes: 0
Views: 245
Reputation: 720
Assuming you are using the "org.eclipse.ui.menus" extension point and the command framework, you can set the visibleWhen part of the menu definition to something like;
<visibleWhen>
<with variable="selection">
<iterate>
<and>
<instanceof value="com.example.MyClass">
</instanceof>
</and>
</iterate>
</with>
</visibleWhen>
This should only make the option visible when the selected items are of the correct instance. It is also possible to set enabled and active states on command handlers in a similar way.
Upvotes: 1