Package org.eclipse.xtext.validation
Class DefaultUniqueNameContext
- java.lang.Object
-
- org.eclipse.xtext.validation.DefaultUniqueNameContext
-
- All Implemented Interfaces:
INamesAreUniqueValidationHelper.Context
- Direct Known Subclasses:
UniqueInResourceContext
@Beta public class DefaultUniqueNameContext extends java.lang.Object implements INamesAreUniqueValidationHelper.Context
Standard implementation of aINamesAreUniqueValidationHelper.Context
.- Since:
- 2.22
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultUniqueNameContext.BaseContextProvider
Base class forINamesAreUniqueValidationHelper.ContextProvider
.static class
DefaultUniqueNameContext.BaseGlobalContextProvider
Base class for non-local unique name validation context providers.static class
DefaultUniqueNameContext.Container
Provide a context for currentIContainer
.static class
DefaultUniqueNameContext.ExportedFromResource
A case sensitive validation context that ensures unique names among the exported names per single resource.static class
DefaultUniqueNameContext.Global
Provide a context for the entire index.static class
DefaultUniqueNameContext.VisibleContainers
Provide a context for all visiblecontainers
.
-
Constructor Summary
Constructors Constructor Description DefaultUniqueNameContext(IResourceDescription resourceDescription, ISelectable validationScope, ICaseInsensitivityHelper caseInsensitivityHelper, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 theirINamesAreUniqueValidationHelper.Context.getValidationScope(IEObjectDescription, EClass)
.ISelectable
getValidationScope(IEObjectDescription description, org.eclipse.emf.ecore.EClass clusterType)
Returns anISelectable
that can be queried for elements with a given name to find duplicates.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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.xtext.validation.INamesAreUniqueValidationHelper.Context
isUnique
-
-
-
-
Constructor Detail
-
DefaultUniqueNameContext
public DefaultUniqueNameContext(IResourceDescription resourceDescription, ISelectable validationScope, ICaseInsensitivityHelper caseInsensitivityHelper, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
-
-
Method Detail
-
getValidationScope
public ISelectable getValidationScope(IEObjectDescription description, org.eclipse.emf.ecore.EClass clusterType)
Description copied from interface:INamesAreUniqueValidationHelper.Context
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.
- Specified by:
getValidationScope
in interfaceINamesAreUniqueValidationHelper.Context
- Parameters:
description
- the description of the validated object.clusterType
- the root type of the validated type hierarchy.- Returns:
- the validation scope.
-
isCaseSensitive
public boolean isCaseSensitive(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EClass clusterType)
Description copied from interface:INamesAreUniqueValidationHelper.Context
Answers whether the names in the given cluster must be treated in a case sensistive or insensitive manner.- Specified by:
isCaseSensitive
in interfaceINamesAreUniqueValidationHelper.Context
- See Also:
ICaseInsensitivityHelper
-
getObjectsToValidate
public java.lang.Iterable<IEObjectDescription> getObjectsToValidate()
Description copied from interface:INamesAreUniqueValidationHelper.Context
Returns the objects that should be checked for uniqueness in the context of theirINamesAreUniqueValidationHelper.Context.getValidationScope(IEObjectDescription, EClass)
.- Specified by:
getObjectsToValidate
in interfaceINamesAreUniqueValidationHelper.Context
-
cancelIndicator
public org.eclipse.xtext.util.CancelIndicator cancelIndicator()
Description copied from interface:INamesAreUniqueValidationHelper.Context
The cancel-indicator that shall be used.- Specified by:
cancelIndicator
in interfaceINamesAreUniqueValidationHelper.Context
-
-