limiting command visibility depending on view selecction [message #513786] |
Thu, 11 February 2010 09:58  |
Eclipse User |
|
|
|
Hi,
I'm composing a set of menus and toolbar buttons for a set of master/slave views. Each view must have the same set of commands, that must be active when the view has a selection in it. So I've tried the following in the plugin.xml:
<command
commandId="hrpm.rcp.commands.EditTableElement"
icon="img/edit.png"
id="hrpm.rcp.gui.view.UserView.edit"
label="Modifica"
style="push"
tooltip="Modifica l'elemento selezionato">
<visibleWhen
checkEnabled="true">
<with
variable="selection">
<iterate
ifEmpty="false"
operator="or">
</iterate>
</with>
</visibleWhen>
</command>
the problem is that this activates the command (makes it visible) as first as a selection is activated within the active page, that is among all the perspective views. I want a restricted scope so to force the command to be activated only when the selection on the view it is contributing (e.g., UserView) has a selection. Is it possilbe?
|
|
|
Re: limiting command visibility depending on view selecction [message #513796 is a reply to message #513786] |
Thu, 11 February 2010 10:58  |
Eclipse User |
|
|
|
I've fixed the problem setting another test on the activeId property, as follows:
<command
commandId="hrpm.rcp.commands.EditTableElement"
icon="img/edit.png"
id="hrpm.rcp.gui.view.UserView.edit"
label="Modifica"
style="push"
tooltip="Modifica l'elemento selezionato">
<visibleWhen
checkEnabled="true">
<with
variable="selection">
<iterate
ifEmpty="false"
operator="or">
</iterate>
<and>
<with
variable="activePartId">
<equals
value="hrpm.rcp.gui.view.UserView">
</equals>
</with>
</and>
</with>
</visibleWhen>
</command>
Is this the right way to proceed?
|
|
|
|
Powered by
FUDForum. Page generated in 0.03440 seconds