Reputation: 14867
I know I can disable menu entries for commands in the plugin XML like that:
<visibleWhen checkEnabled="false">
<with variable="activeWorkbenchWindow.activePerspective">
<equals value="myperspective"/>
</with>
</visibleWhen>
My question is: is there a way to just disable a menu entry, instead of hiding it?
Upvotes: 0
Views: 1290
Reputation: 111142
That is controlled by the handler for the command. The handler can define when it is active with <activeWhen>
element and when it is enabled with <enabledWhen>
<extension
point="org.eclipse.ui.handlers">
<handler
class="..."
commandId="...">
<activeWhen>
....
</activeWhen>
<enabledWhen>
....
</enabledWhen>
</handler>
The menu item will be disabled if there is no active handler or the active handler is not enabled.
Upvotes: 4