@Beta
public static interface INamesAreUniqueValidationHelper.Context
Provides context information to the validation that allows to introspect the scope in which the validation for unique names is supposed to happen.
The term clusterType is used to denote a (super-)type of the current object under
validation. When checking the name for uniqueness, all objects that are instances of the given cluster type are
considered. This can be used to define different namespaces. For example, a language that has the concepts of
Fields, Procedures and Functions may provide 2 different cluster types.
| Modifier and Type | Method and Description |
|---|---|
org.eclipse.xtext.util.CancelIndicator |
cancelIndicator()
The cancel-indicator that shall be used.
|
java.lang.Iterable<IEObjectDescription> |
getObjectsToValidate()
Returns the objects that should be checked for uniqueness in the context of their
getValidationScope(IEObjectDescription, EClass). |
ISelectable |
getValidationScope(IEObjectDescription description,
org.eclipse.emf.ecore.EClass clusterType)
Returns an
ISelectable that can be queried for elements with a given name to find duplicates. |
default boolean |
isCaseSensitive(org.eclipse.emf.ecore.EObject object,
org.eclipse.emf.ecore.EClass clusterType)
Answers whether the names in the given cluster must be treated in a case
sensistive or insensitive manner.
|
default boolean |
isUnique()
Context implementations that do know from their construction if they will or won't
contain any duplicates, can override
isUnique() to provide a more efficient means
to validate all candidates at once. |
ISelectable getValidationScope(IEObjectDescription description, org.eclipse.emf.ecore.EClass clusterType)
Returns an ISelectable that can be queried for elements with a given name to find duplicates.
Depending on the type of objects that have to have unique names, different selectables may be returned. Some objects must be unique per project, others must be globally unique or only unique per file. This API allows to fine tune the scope of the validation.
description - the description of the validated object.clusterType - the root type of the validated type hierarchy.java.lang.Iterable<IEObjectDescription> getObjectsToValidate()
getValidationScope(IEObjectDescription, EClass).org.eclipse.xtext.util.CancelIndicator cancelIndicator()
default boolean isCaseSensitive(org.eclipse.emf.ecore.EObject object,
org.eclipse.emf.ecore.EClass clusterType)
ICaseInsensitivityHelperdefault boolean isUnique()
isUnique() to provide a more efficient means
to validate all candidates at once.