启用和禁用org.eclipse.ui.actionSets

时间:2013-07-26 11:08:56

标签: eclipse eclipse-plugin

我有一个以这种方式定义的菜单项:

<extension point="org.eclipse.ui.actionSets">
<actionSet
   description="My Sample"
   id="MySample.actionSet"
   label="My Sample"
   visible="true">
   <menu
     id="mysample.actionset.menu1"
     label="My Sample">
     <groupMarker
       name="mysample.groupCreatesimilar">
     </groupMarker>
   </menu>
   <action
      class="org.mysample.actions.create.MyCreateCodeAction"
      definitionId="MySample.myCreateCode.command"
      id="MySample.myCreateCode.command"
      label="Create Sample Code"
      menubarPath="mysample.actionset.menu1/mysample.groupMarker2">
    </action>
</actionSet>
</extension>

上面的actionSet还有很多其他动作。我希望根据首选项变量的值启用或禁用操作(菜单)“创建示例代码”。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

在enablement属性中,您可以编写一个属性测试器,您可以在其中测试您的首选变量。

有关物业测试人员的更多信息

http://wiki.eclipse.org/Platform_Expression_Framework http://www.robertwloch.net/2011/01/eclipse-tips-tricks-property-testers-with-command-core-expressions/

同样作为建议,您不应该使用动作集,因为它们已被弃用。应该使用命令。除非您使用遗留代码:)