如何在<visiblewhen>中使用多个<instanceof>条件?</visiblewhen> </instanceof>

时间:2011-08-13 13:29:11

标签: eclipse-plugin eclipse-rcp instanceof

弹出菜单有两个条件,我在plugin.xml中使用<instanceof..>标签内的<visibleWhen>?我使用了<or>...<instance of>...</or>,但它似乎不起作用。以下是代码

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

任何输入都会非常有用!

谢谢, 阿巴斯

1 个答案:

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