I am trying to activate the copy command using the "handler" in the extension point for multi conditions. If I add the condition to work for single view it's working correctly.
<extension
point="org.eclipse.ui.handlers">
<handler class="example.xyz.CopyHandler"
commandId="org.eclipse.ui.edit.copy">
<activeWhen
<with
variable="activePartId">
</with>
<equals
value="example.xyz.view1">
</equals>
</with>
</activeWhen>
</handler>
</extension>
But when i used with multi conditions like..
Conditions:
I tried with this snippet, it's not working. what is wrong in this code?
<extension
point="org.eclipse.ui.handlers">
<handler
class="example.xyz.CopyHandler"
commandId="org.eclipse.ui.edit.copy">
<activeWhen>
<with
variable="activePartId">
<iterate
operator="or">
<equals
value="example.xyz.view1">
</equals>
<equals
value="example.xyz.view2">
</equals>
</iterate>
</with>
<with
variable="selection">
<count
value="1">
</count>
<iterate>
<instanceof
value="example.xyz.ICharacteristicValue">
</instanceof></iterate>
</with>
</activeWhen>
</handler>
</extension>
<activeWhen
only accepts one child element - you have two. You need to combine them with an <and>
:
<activeWhen>
<and>
<with
variable="activePartId">
.....
</with>
<with
variable="selection">
.....
</with>
</and>
</activeWhen>