Class ActionExpression

java.lang.Object
org.eclipse.ui.internal.ActionExpression

public class ActionExpression extends Object
An ActionExpression is used to evaluate the enablement / visibility criteria for an action.
  • Field Details

  • Constructor Details

    • ActionExpression

      public ActionExpression(IConfigurationElement element)
      Creates an action expression for the given configuration element.
      Parameters:
      element - The element to build the expression from.
    • ActionExpression

      public ActionExpression(String expressionType, String expressionValue)
      Create an instance of the receiver with the given expression type and value. Currently the only supported expression type is EXP_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

      public final boolean equals(Object object)
      Overrides:
      equals in class Object
    • extractObjectClasses

      public String[] 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 a null 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.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code for this object.
    • isEnabledFor

      public boolean isEnabledFor(IStructuredSelection selection)
      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

      public boolean isEnabledFor(Object object)
      Returns whether the expression is valid for the given object.
      Parameters:
      object - the object to validate against (can be null)
      Returns:
      boolean whether the expression is valid for the object.
    • isEnabledForExpression

      public boolean isEnabledForExpression(Object object, String expressionType)
      Returns whether or not the receiver is potentially valid for the object via just the extension type. Currently the only supported expression type is EXP_TYPE_OBJECT_CLASS.
      Parameters:
      object - the object to validate against (can be null)
      expressionType - the expression type to consider
      Returns:
      boolean whether the expression is potentially valid for the object.
    • valuesForExpression

      public Collection<String> valuesForExpression(String expressionType)
      Return the values of the expression type that the receiver is enabled for. If the receiver is not enabled for the expressionType then return null.
      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