Class SelectionEnabler

  • public final class SelectionEnabler
    extends Object
    Determines the enablement status given a selection. This calculation is done based on the definition of the enablesFor attribute, enablement element, and the selection element found in the IConfigurationElement provided.

    This class can be instantiated by clients. It is not intended to be extended.

    3.0 Note: The dependency on org.eclipse.jface.text for ITextSelection must be severed It may be possible to do with IActionFilter generic workbench registers IActionFilter for "size" property against IStructuredSelection workbench text registers IActionFilter for "size" property against ITextSelection code here: sel.getAdapter(IActionFilter.class) As an interim solution, use reflection to access selections implementing ITextSelection
    • Constructor Detail

      • SelectionEnabler

        public SelectionEnabler​(IConfigurationElement configElement)
        Create a new instance of the receiver.
        configElement -
    • Method Detail

      • verifyNameMatch

        public static boolean verifyNameMatch​(String name,
                                              String filter)
        Verifies that the given name matches the given wildcard filter. Returns true if it does.
        name -
        filter -
        true if there is a match
      • hashCode

        public int hashCode()
        Computes the hash code for this object based on the id.
        hashCode in class Object
        The hash code for this object.
      • isEnabledForSelection

        public boolean isEnabledForSelection​(ISelection selection)
        Check if the receiver is enabled for the given selection.
        selection -
        true if the given selection matches the conditions specified in IConfirgurationElement.