2012-04-17 23 views
2

我想基於透視圖在工具欄上顯示命令。我已經使用核心表達式來實現這一點,如下所示。基於透視圖在工具欄上顯示命令

<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.perspective1com.sample.perspective2在工具欄上顯示命令。

如何使用核心表達式實現此目的?

回答

1

可以使用或操作元素:

<definition id="onValidationPerspective"> 
    <or> 
     <with ... 
     <with ... 
    </or> 
</definition> 
+0

感謝您的指針,它的工作完美。 – Syam 2012-04-18 05:20:16

1
<definition id="onValidationPerspective"> 
    <with variable="activeWorkbenchWindow.activePerspective"> 
     <or> 
      <equals value="com.sample.perspective1"/> 
      <equals value="com.sample.perspective2"/> 
     </or> 
    </with> 
</definition>