eclipse.ui.menus的名称过滤器 [英] Name filter for eclipse.ui.menus

查看:178
本文介绍了eclipse.ui.menus的名称过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个菜单贡献,通过 org.eclipse.ui.menus 扩展点实现。我只想为特定的文件扩展名(例如* .pld)提供这个菜单的贡献,但是我不知道如何用visibleWhen这样做。任何想法?

I've got a menu contribution, realised through org.eclipse.ui.menus extension point. I'd like to offer this menu contribution only for specific file extensions (e.g. *.pld), but I couldn't figure out how to do this with "visibleWhen". Any ideas?

---------------更新----------------
我的扩展点到目前为止:

---------------Update---------------- My extension point so far:

<extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="false"
            locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu?before=additions">
         <command
               commandId="org.variability.configurator.commands.createPlc"
               icon="icons/PlcWizard.png"
               label="Create Product"
               style="push">
            <visibleWhen
                  checkEnabled="false">

            </visibleWhen>
         </command>
      </menuContribution>
   </extension>

干杯,
Phil

Cheers, Phil

推荐答案

有几个属性测试可以使用:

There are a couple of property tests you can use:

<test
   property="org.eclipse.core.resources.name"
   value="*.pld">
</test>

<test
   property="org.eclipse.core.resources.extension"
   value="pld">
</test>

您将需要迭代选择,以便在以下情况下完全可见:

You will need to iterate over the selection so the full visible when would be something like:

<visibleWhen
      checkEnabled="false">
    <iterate
         ifEmpty="false"
         operator="or">
        <test
            property="org.eclipse.core.resources.name"
            value="*.pld">
        </test>
    </iterate>
</visibleWhen>

这篇关于eclipse.ui.menus的名称过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆