Package org.eclipse.ui
Class SelectionEnabler
- java.lang.Object
-
- org.eclipse.ui.SelectionEnabler
-
public final class SelectionEnabler extends Object
Determines the enablement status given a selection. This calculation is done based on the definition of theenablesForattribute,enablementelement, and theselectionelement found in theIConfigurationElementprovided.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
Fields Modifier and Type Field Description static intANY_NUMBERstatic intMULTIPLEstatic intNONEstatic intNONE_OR_ONEstatic intONE_OR_MOREstatic intUNKNOWN
-
Constructor Summary
Constructors Constructor Description SelectionEnabler(IConfigurationElement configElement)Create a new instance of the receiver.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object object)inthashCode()Computes the hash code for this object based on the id.booleanisEnabledForSelection(ISelection selection)Check if the receiver is enabled for the given selection.static booleanverifyNameMatch(String name, String filter)Verifies that the given name matches the given wildcard filter.
-
-
-
Field Detail
-
ANY_NUMBER
public static final int ANY_NUMBER
- See Also:
- Constant Field Values
-
MULTIPLE
public static final int MULTIPLE
- See Also:
- Constant Field Values
-
NONE
public static final int NONE
- See Also:
- Constant Field Values
-
NONE_OR_ONE
public static final int NONE_OR_ONE
- See Also:
- Constant Field Values
-
ONE_OR_MORE
public static final int ONE_OR_MORE
- See Also:
- Constant Field Values
-
UNKNOWN
public static final int UNKNOWN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SelectionEnabler
public SelectionEnabler(IConfigurationElement configElement)
Create a new instance of the receiver.- Parameters:
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.- Parameters:
name-filter-- Returns:
trueif there is a match
-
hashCode
public int hashCode()
Computes the hash code for this object based on the id.
-
isEnabledForSelection
public boolean isEnabledForSelection(ISelection selection)
Check if the receiver is enabled for the given selection.- Parameters:
selection-- Returns:
trueif the given selection matches the conditions specified inIConfirgurationElement.
-
-