Interface INamesAreUniqueValidationHelper.Context
-
- All Known Implementing Classes:
DefaultUniqueNameContext,LocalUniqueNameContext,UniqueInResourceContext
- Enclosing interface:
- INamesAreUniqueValidationHelper
@Beta public static interface INamesAreUniqueValidationHelper.ContextProvides context information to the validation that allows to introspect the scope in which the validation for unique names is supposed to happen.
The term
clusterTypeis used to denote a(super-)typeof 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 ofFields,ProceduresandFunctionsmay provide 2 different cluster types.- All fields must have a unique name.
- The executable procedure and functions use the same namespace and may not have duplicate names.
- Since:
- 2.22
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description org.eclipse.xtext.util.CancelIndicatorcancelIndicator()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 theirgetValidationScope(IEObjectDescription, EClass).ISelectablegetValidationScope(IEObjectDescription description, org.eclipse.emf.ecore.EClass clusterType)Returns anISelectablethat can be queried for elements with a given name to find duplicates.default booleanisCaseSensitive(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 booleanisUnique()Context implementations that do know from their construction if they will or won't contain any duplicates, can overrideisUnique()to provide a more efficient means to validate allcandidatesat once.
-
-
-
Method Detail
-
getValidationScope
ISelectable getValidationScope(IEObjectDescription description, org.eclipse.emf.ecore.EClass clusterType)
Returns an
ISelectablethat 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.
- Parameters:
description- the description of the validated object.clusterType- the root type of the validated type hierarchy.- Returns:
- the validation scope.
-
getObjectsToValidate
java.lang.Iterable<IEObjectDescription> getObjectsToValidate()
Returns the objects that should be checked for uniqueness in the context of theirgetValidationScope(IEObjectDescription, EClass).
-
cancelIndicator
org.eclipse.xtext.util.CancelIndicator cancelIndicator()
The cancel-indicator that shall be used.
-
isCaseSensitive
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.- See Also:
ICaseInsensitivityHelper
-
isUnique
default boolean isUnique()
Context implementations that do know from their construction if they will or won't contain any duplicates, can overrideisUnique()to provide a more efficient means to validate allcandidatesat once.
-
-