2011-08-13 27 views
1

彈出式菜單出現有兩個條件,我在我的plugin.xml中的<visibleWhen>標記內使用<instanceof..>?我已經使用了<or>...<instance of>...</or>,但它似乎沒有工作。以下是密碼如何在<visibleWhen>中使用多個<instanceof>條件?

<visibleWhen> 
       <with variable="selection"> 
          <iterate ifEmpty="false" operator="or"> 

         <instanceof value="org.eclipse.core.resources.IFolder"/> 
         <test property="org.eclipse.core.resources.projectNature" 
          value="org.eclipse.wst.jsdt.core.jsNature"/> 
          <or> 
          <instanceof value="org.eclipse.core.resources.IProject"/> 
          <test property="org.eclipse.core.resources.projectNature" 
          value="org.eclipse.wst.jsdt.core.jsNature"/> 
          </or> 
        </iterate> 
        </with> 
       </visibleWhen> 

任何輸入都會非常有幫助!

感謝, 阿巴斯

+0

我注意到你有沒有投任何票,即使你已經接受的答案。見http://stackoverflow.com/faq#howtoask –

+0

阿列克謝,我需要至少15個回報點來做到這一點:) – Abbas

+0

糟糕,沒錯。對不起:) –

回答

3

我認爲你正在使用<or>錯誤(見http://wiki.eclipse.org/Command_Core_Expressions):

<with variable="selection"> 
    <iterate ifEmpty="false" operator="or"> 
     <or> 
      <and> 
       <instanceof value="org.eclipse.core.resources.IFolder"/> 
       <test property="org.eclipse.core.resources.projectNature" 
         value="org.eclipse.wst.jsdt.core.jsNature"/> 
      </and> 
      <and> 
       <instanceof value="org.eclipse.core.resources.IProject"/> 
       <test property="org.eclipse.core.resources.projectNature" 
         value="org.eclipse.wst.jsdt.core.jsNature"/> 
      </and> 
     </or> 
    </iterate> 
</with> 
+0

謝謝阿列克謝。您正確指出的用法不正確。這有點令人困惑,但這就是它的工作原理! – Abbas

相關問題