Eclipse Plugin: Property tester never gets called

时间:2017-11-02 15:40:37

标签: eclipse plugins eclipse-plugin

I am trying to include a property tester variable in my plugin which checks a custom code condition and based on that returns a boolean value. The property tester is used against a toolbar icon which is enabled and disabled based on property tester value.

Below is how I am declaring the property tester in my plugin.xml:-

<extension point="org.eclipse.core.expressions.propertyTesters">
    <propertyTester
        class="org.eclipse.intro.test.IsFoobarPropertyTester"
        id="org.eclipse.intro.IsFoobarPropertyTester"
        namespace="org.eclipse.test.FooBar"
        properties="isFooBar"
        type="java.lang.Object">
    </propertyTester>
</extension>

And below is how I am attaching the property tester to toolbar menu item:-

<toolbar id="org.eclipse.intro.FooToolbar">
    <command
          commandId="org.eclipse.intro.FooCommand"
          icon="intro/css/graphics/fooicon.png"
          tooltip="Foo Menu."
          id="org.eclipse.intro.FooCommand">
        <enabledWhen>
            <test property="org.eclipse.test.FooBar.isFooBar"
                  forcePluginActivation="true">
            </test>
        </enabledWhen>
    </command>
 </toolbar>

Now when I run the eclipse plugin, the property tester's test() never gets called. Even the constructor of property tester is getting called. Is there any configuraiton I have to do explicitly on eclipe to make it run?

1 个答案:

答案 0 :(得分:1)

command扩展点的org.eclipse.ui.menus元素不支持enabledWhen。它仅支持visibleWhen