Eclipse plugin 基于透视在工具栏上显示命令

Eclipse plugin 基于透视在工具栏上显示命令,eclipse-plugin,Eclipse Plugin,我想根据透视图在工具栏上显示一个命令。我使用核心表达式来实现这一点,如下所示 <extension point="org.eclipse.core.expressions.definitions"> <definition id="onValidationPerspective"> <with variable="activeWorkbenchWindow.activePerspective">

我想根据透视图在工具栏上显示一个命令。我使用核心表达式来实现这一点,如下所示

   <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>

我在命令标签中使用了它,如下所示

   <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>