Although it's possible to copy and paste expressions between places where they are used, it is preferable to re-use an identical expression.
Declare an expression using the expression's extension point, by opening the
plugin.xml
file of theclock.ui
project.<extension point="org.eclipse.core.expressions.definitions"> <definition id="when.hello.is.active"> <with variable="activeContexts"> <iterate operator="or"> <equals value="org.eclipse.jdt.ui.javaEditorScope"/> </iterate> </with> </definition> </extension>
If defined via the extension wizard, it will prompt to add dependency on the
org.eclipse.core.expressions
bundle. This isn't strictly necessary for this example to work.To use the definition, the enablement expressions needs to use the reference.
<extension point="org.eclipse.ui.menus"> <menuContribution allPopups="false" locationURI="menu:help?after...