Visibility of context menu option [message #1036793] |
Mon, 08 April 2013 20:35 |
Jane M. Messages: 9 Registered: August 2011 |
Junior Member |
|
|
I want to use org.eclipse.core.expressions.definitions to make a context menu option visible conditionally. What expression should I use to evaluate whether the menu option displays based on a preference setting in the plugin. The preference is visible at runtime, so I set forcePluginActivation to true. I tried using the 'test' expression. Would the ProjectPropertyTester apply here? Or, maybe the 'test' expression isn't the correct one? The code below was an attempt but it doesn't work.
<extension
point="org.eclipse.core.expressions.definitions">
<definition
id="expression.">
<test
forcePluginActivation="true"
property="com.test.myPreference.PREF_CHECKED"
value="true">
</test>
</definition>
</extension>
Using the expression in my menuContribution. The CheckOut menu option displays if I don't implement the code above.
<menuContribution
allPopups="false"
locationURI="popup:org.eclipse.ui.popup.any?after=additions ">
<command
commandId="myplugin.myContribution.CheckOut"
mnemonic="C"
style="push">
<visibleWhen
checkEnabled="false">
<reference
definitionId="expression.onlyOneItemSelected">
</reference>
</visibleWhen>
</command>
</menuContribution>
|
|
|
Powered by
FUDForum. Page generated in 0.02082 seconds