Package org.eclipse.ui.internal
Class ActionExpression
java.lang.Object
org.eclipse.ui.internal.ActionExpression
An ActionExpression is used to evaluate the enablement / visibility criteria
for an action.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Constant definition for AND.static final String
Constant definition for NOT.static final String
Constant definition for objectClass.static final String
Constant definition for objectState.static final String
Constant definition for OR.static final String
Constant definition for pluginState.static final String
Constant definition for systemProperty. -
Constructor Summary
ConstructorDescriptionActionExpression
(String expressionType, String expressionValue) Create an instance of the receiver with the given expression type and value.ActionExpression
(IConfigurationElement element) Creates an action expression for the given configuration element. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
String[]
Extract the object class test from the expression.final int
hashCode()
Computes the hash code for this object based on the id.boolean
isEnabledFor
(Object object) Returns whether the expression is valid for the given object.boolean
isEnabledFor
(IStructuredSelection selection) Returns whether the expression is valid for all elements of the given selection.boolean
isEnabledForExpression
(Object object, String expressionType) Returns whether or not the receiver is potentially valid for the object via just the extension type.valuesForExpression
(String expressionType) Return the values of the expression type that the receiver is enabled for.
-
Field Details
-
EXP_TYPE_AND
Constant definition for AND.- See Also:
-
EXP_TYPE_NOT
Constant definition for NOT.- See Also:
-
EXP_TYPE_OBJECT_CLASS
Constant definition for objectClass.- See Also:
-
EXP_TYPE_OBJECT_STATE
Constant definition for objectState.- See Also:
-
EXP_TYPE_OR
Constant definition for OR.- See Also:
-
EXP_TYPE_PLUG_IN_STATE
Constant definition for pluginState.- See Also:
-
EXP_TYPE_SYSTEM_PROPERTY
Constant definition for systemProperty.- See Also:
-
-
Constructor Details
-
ActionExpression
Creates an action expression for the given configuration element.- Parameters:
element
- The element to build the expression from.
-
ActionExpression
Create an instance of the receiver with the given expression type and value. Currently the only supported expression type isEXP_TYPE_OBJECT_CLASS
.- Parameters:
expressionType
- The expression constant we are creating an instance of.expressionValue
- The name of the class we are creating an expression for.
-
-
Method Details
-
equals
-
extractObjectClasses
Extract the object class test from the expression. This allows clients (e.g. the decorator manager) to handle object class testing in a more optimized way. This method removes the objectClass test from the expression and returns the object class. The expression is not changed and anull
is returned if no object class is found.- Returns:
- the object class or
null
if none was found.
-
hashCode
public final int hashCode()Computes the hash code for this object based on the id. -
isEnabledFor
Returns whether the expression is valid for all elements of the given selection.- Parameters:
selection
- the structured selection to use- Returns:
- boolean whether the expression is valid for the selection.
-
isEnabledFor
Returns whether the expression is valid for the given object.- Parameters:
object
- the object to validate against (can benull
)- Returns:
- boolean whether the expression is valid for the object.
-
isEnabledForExpression
Returns whether or not the receiver is potentially valid for the object via just the extension type. Currently the only supported expression type isEXP_TYPE_OBJECT_CLASS
.- Parameters:
object
- the object to validate against (can benull
)expressionType
- the expression type to consider- Returns:
- boolean whether the expression is potentially valid for the object.
-
valuesForExpression
Return the values of the expression type that the receiver is enabled for. If the receiver is not enabled for the expressionType then returnnull
.- Parameters:
expressionType
- the expression type to consider- Returns:
- Collection if there are values for this expression or
null
if this is not possible in the receiver or any of it's children
-