Jump to: navigation, search

Difference between revisions of "Command Core Expressions"

(New page: Core expressions are declarative or programmatic expressions based on the org.eclipse.core.expressions plugin. = Expressions and the Command Framework = The [[Platform Command Framework]...)
 
(Expressions and the Command Framework)
Line 4: Line 4:
  
 
The [[Platform Command Framework]] uses core expressions for enabledWhen and activeWhen for handlers, programmatic activation of contexts, and for visibleWhen for menu contributions.  The command framework provides the IEvaluationContext that command core expressions are evaluate against.
 
The [[Platform Command Framework]] uses core expressions for enabledWhen and activeWhen for handlers, programmatic activation of contexts, and for visibleWhen for menu contributions.  The command framework provides the IEvaluationContext that command core expressions are evaluate against.
 +
 +
The IEvaluationContext provides a default variable for evaluations, and a number of named variables.  In the command framework, we provide the global selection as a <code>java.util.Collection</code> as the default variable.  It can either be empty, have one entry (if the ISelection was something like an ITextSelection), or have the contents of an IStructuredSelection.
 +
 +
The &lt;with/&gt; element can be used to change which variable the child expression elements are evaluating against.
 +
 +
= Variables and the Command Framework =
 +
 +
ISources provides the variables.
 +
 +
= Expression examples =
 +
 +
Here are some examples.  I'll pretend all of the examples are deciding when a handler is active.
 +
 +
== selection ==
 +
 +
<activeWhen>
 +
</activeWhen>

Revision as of 07:33, 12 June 2007

Core expressions are declarative or programmatic expressions based on the org.eclipse.core.expressions plugin.

Expressions and the Command Framework

The Platform Command Framework uses core expressions for enabledWhen and activeWhen for handlers, programmatic activation of contexts, and for visibleWhen for menu contributions. The command framework provides the IEvaluationContext that command core expressions are evaluate against.

The IEvaluationContext provides a default variable for evaluations, and a number of named variables. In the command framework, we provide the global selection as a java.util.Collection as the default variable. It can either be empty, have one entry (if the ISelection was something like an ITextSelection), or have the contents of an IStructuredSelection.

The <with/> element can be used to change which variable the child expression elements are evaluating against.

Variables and the Command Framework

ISources provides the variables.

Expression examples

Here are some examples. I'll pretend all of the examples are deciding when a handler is active.

selection

<activeWhen>
</activeWhen>