Package org.eclipse.ui
Class SelectionEnabler
java.lang.Object
org.eclipse.ui.SelectionEnabler
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.
- Since:
- 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
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Enablement mode value for ANY_NUMBERstatic final int
Enablement mode value for MULTIPLEstatic final int
Enablement mode value for NONEstatic final int
Enablement mode value for NONE_OR_ONEstatic final int
Enablement mode value for ONE_OR_MOREstatic final int
Enablement mode value for UNKNOWN -
Constructor Summary
ConstructorDescriptionSelectionEnabler
(IConfigurationElement configElement) Create a new instance of the receiver. -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
Computes the hash code for this object based on the id.boolean
isEnabledForSelection
(ISelection selection) Check if the receiver is enabled for the given selection.static boolean
verifyNameMatch
(String name, String filter) Verifies that the given name matches the given wildcard filter.
-
Field Details
-
ANY_NUMBER
public static final int ANY_NUMBEREnablement mode value for ANY_NUMBER- See Also:
-
MULTIPLE
public static final int MULTIPLEEnablement mode value for MULTIPLE- See Also:
-
NONE
public static final int NONEEnablement mode value for NONE- See Also:
-
NONE_OR_ONE
public static final int NONE_OR_ONEEnablement mode value for NONE_OR_ONE- See Also:
-
ONE_OR_MORE
public static final int ONE_OR_MOREEnablement mode value for ONE_OR_MORE- See Also:
-
UNKNOWN
public static final int UNKNOWNEnablement mode value for UNKNOWN- See Also:
-
-
Constructor Details
-
SelectionEnabler
Create a new instance of the receiver.- Parameters:
configElement
- the configuration element to parse
-
-
Method Details
-
verifyNameMatch
Verifies that the given name matches the given wildcard filter. Returns true if it does.- Parameters:
name
- the name to matchfilter
- the filter to match to- Returns:
true
if there is a match
-
equals
-
hashCode
public int hashCode()Computes the hash code for this object based on the id. -
isEnabledForSelection
Check if the receiver is enabled for the given selection.- Parameters:
selection
- the selection- Returns:
true
if the given selection matches the conditions specified inIConfirgurationElement
.
-