我想根据视角在工具栏上显示一个命令。我已经使用核心表达式来实现这一点,如下所示。
<extension point="org.eclipse.core.expressions.definitions">
<definition id="onValidationPerspective">
<with variable="activeWorkbenchWindow.activePerspective">
<equals value="com.sample.perspective1"/>
</with>
</definition>
</extension>
我在命令标签中使用了它,如下所示。
<command
commandId="com.sample.run.root"
icon="icons/run_exc.gif"
label="Reset Card"
style="pulldown">
<visibleWhen checkEnabled="false">
<reference
definitionId="onValidationPerspective">
</reference>
</visibleWhen>
</command>
上面的代码工作正常。
但我想将其扩展到多个视角,即我想以两个视角显示工具栏上的命令,即 com.sample.perspective1
和com.sample.perspective2
。
如何使用核心表达式实现此目的?
最佳答案
您可以使用 OR 运算元素:
<definition id="onValidationPerspective">
<or>
<with ...
<with ...
</or>
</definition>
关于eclipse-plugin - 基于透视在工具栏上显示命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10191373/