Villie
Villie

Reputation: 281

Eclipse Plugin: Property tester never gets called

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?

Upvotes: 0

Views: 655

Answers (1)

greg-449
greg-449

Reputation: 111217

The command element of the org.eclipse.ui.menus extension point does not support enabledWhen. It only supports visibleWhen.

Upvotes: 1

Related Questions