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



出现弹出式菜单有两个条件,我在我的plugin.xml中使用<visibleWhen>标记内的<instanceof..> ?我已经使用了<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>

任何意见都会很有帮助的!

谢谢,阿巴斯

我认为你使用<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>

最新更新