我有一个菜单贡献,通过 org.eclipse.ui.menus
扩展点实现。我只想为特定的文件扩展名(例如 *.pld)提供此菜单贡献,但我不知道如何使用“visibleWhen”执行此操作。有什么想法吗?
----------------更新---------------- 到目前为止我的扩展点:
<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>
干杯, 菲尔
最佳答案
您可以使用几个属性测试:
<test
property="org.eclipse.core.resources.name"
value="*.pld">
</test>
和
<test
property="org.eclipse.core.resources.extension"
value="pld">
</test>
您将需要遍历选择,以便完整可见的时间如下:
<visibleWhen
checkEnabled="false">
<iterate
ifEmpty="false"
operator="or">
<test
property="org.eclipse.core.resources.name"
value="*.pld">
</test>
</iterate>
</visibleWhen>
关于java - eclipse.ui.menus 的名称过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19776876/