Package org.eclipse.ui
Class ActiveShellExpression
java.lang.Object
org.eclipse.core.expressions.Expression
org.eclipse.ui.ActiveShellExpression
An expression that checks the active shell variable. The variable name is
ISources.ACTIVE_SHELL_NAME
and falls back to
ISources.ACTIVE_WORKBENCH_WINDOW
. That is, if the active shell
doesn't match, then it will be allowed to match the active workbench window.
- Since:
- 3.1
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The sources value to use with this expression.Fields inherited from class org.eclipse.core.expressions.Expression
ATT_VALUE, FALSE, HASH_CODE_NOT_COMPUTED, HASH_FACTOR, TRUE
-
Constructor Summary
ConstructorDescriptionActiveShellExpression
(Shell activeShell) Constructs a new instance ofActiveShellExpression
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Expression information for this expression.protected int
Method to compute the hash code for this object.boolean
evaluate
(IEvaluationContext context) Evaluates this expression.toString()
Methods inherited from class org.eclipse.core.expressions.Expression
computeExpressionInfo, equals, equals, hashCode, hashCode, hashCode
-
Field Details
-
SOURCES
public static final int SOURCESThe sources value to use with this expression.- See Also:
-
-
Constructor Details
-
ActiveShellExpression
Constructs a new instance ofActiveShellExpression
- Parameters:
activeShell
- The shell to match with the active shell;null
if it will match any active shell.
-
-
Method Details
-
collectExpressionInfo
Expression information for this expression. Namely active shell and active workbench window name.- Overrides:
collectExpressionInfo
in classExpression
- Parameters:
info
- the expression information object used to collect the information- Since:
- 3.2
-
computeHashCode
protected int computeHashCode()Description copied from class:Expression
Method to compute the hash code for this object. The result returned from this method in cached in thefHashCode
field. If the value returned from the method equalsExpression.HASH_CODE_NOT_COMPUTED
(e.g.-1
) then the value is incremented by one.This default implementation calls
super.hashCode()
- Overrides:
computeHashCode
in classExpression
- Returns:
- a hash code for this object.
-
equals
-
evaluate
Evaluates this expression. If the active shell defined by the context matches the shell from this expression, then this evaluates toEvaluationResult.TRUE
. Similarly, if the active workbench window shell defined by the context matches the shell from this expression, then this evaluates toEvaluationResult.TRUE
.- Specified by:
evaluate
in classExpression
- Parameters:
context
- The context from which the current state is determined; must not benull
.- Returns:
EvaluationResult.TRUE
if the shell is active;EvaluationResult.FALSE
otherwise.
-
toString
-