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?
答案 0 :(得分:1)
command
扩展点的org.eclipse.ui.menus
元素不支持enabledWhen
。它仅支持visibleWhen
。