我正在尝试使用扩展点中的"处理程序"激活复制命令,用于多种条件。如果我添加条件以适用于单个视图,它就可以正常工作。
<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>
但是当我使用多种条件时,例如..
条件:
- 当"view1"或"view2"处于活动状态时,它应该打开。
- 并且选择的 cont 应该正好是 1,并且选择的实例应该是 example.xyz.ICharacteristicValue。
我尝试使用此片段,它不起作用。这段代码有什么问题?
<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
只接受一个子元素 - 你有两个。您需要将它们与<and>
组合:
<activeWhen>
<and>
<with
variable="activePartId">
.....
</with>
<with
variable="selection">
.....
</with>
</and>
</activeWhen>