Package org.eclipse.ui
Class ActiveShellExpression
- java.lang.Object
-
- org.eclipse.core.expressions.Expression
-
- org.eclipse.ui.ActiveShellExpression
-
public final class ActiveShellExpression extends Expression
An expression that checks the active shell variable. The variable name is
ISources.ACTIVE_SHELL_NAMEand falls back toISources.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
Fields Modifier and Type Field Description static intSOURCESThe 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
Constructors Constructor Description ActiveShellExpression(Shell activeShell)Constructs a new instance ofActiveShellExpression
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollectExpressionInfo(ExpressionInfo info)Expression information for this expression.protected intcomputeHashCode()Method to compute the hash code for this object.booleanequals(Object object)EvaluationResultevaluate(IEvaluationContext context)Evaluates this expression.StringtoString()-
Methods inherited from class org.eclipse.core.expressions.Expression
computeExpressionInfo, equals, equals, hashCode, hashCode, hashCode
-
-
-
-
Field Detail
-
SOURCES
public static final int SOURCES
The sources value to use with this expression.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ActiveShellExpression
public ActiveShellExpression(Shell activeShell)
Constructs a new instance ofActiveShellExpression- Parameters:
activeShell- The shell to match with the active shell;nullif it will match any active shell.
-
-
Method Detail
-
collectExpressionInfo
public void collectExpressionInfo(ExpressionInfo info)
Expression information for this expression. Namely active shell and active workbench window name.- Overrides:
collectExpressionInfoin classExpression- Parameters:
info- the expression information object used to collect the information- Since:
- 3.2
-
computeHashCode
protected int computeHashCode()
Description copied from class:ExpressionMethod to compute the hash code for this object. The result returned from this method in cached in thefHashCodefield. 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:
computeHashCodein classExpression- Returns:
- a hash code for this object.
-
evaluate
public EvaluationResult evaluate(IEvaluationContext context)
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:
evaluatein classExpression- Parameters:
context- The context from which the current state is determined; must not benull.- Returns:
EvaluationResult.TRUEif the shell is active;EvaluationResult.FALSEotherwise.
-
-