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 classDefaultUniqueNameContext.BaseContextProviderBase class forINamesAreUniqueValidationHelper.ContextProvider.static classDefaultUniqueNameContext.BaseGlobalContextProviderBase class for non-local unique name validation context providers.static classDefaultUniqueNameContext.ContainerProvide a context for currentIContainer.static classDefaultUniqueNameContext.ExportedFromResourceA case sensitive validation context that ensures unique names among the exported names per single resource.static classDefaultUniqueNameContext.GlobalProvide a context for the entire index.static classDefaultUniqueNameContext.VisibleContainersProvide 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.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 theirINamesAreUniqueValidationHelper.Context.getValidationScope(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.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.-
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.ContextReturns 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.
- Specified by:
getValidationScopein 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.ContextAnswers whether the names in the given cluster must be treated in a case sensistive or insensitive manner.- Specified by:
isCaseSensitivein interfaceINamesAreUniqueValidationHelper.Context- See Also:
ICaseInsensitivityHelper
-
getObjectsToValidate
public java.lang.Iterable<IEObjectDescription> getObjectsToValidate()
Description copied from interface:INamesAreUniqueValidationHelper.ContextReturns the objects that should be checked for uniqueness in the context of theirINamesAreUniqueValidationHelper.Context.getValidationScope(IEObjectDescription, EClass).- Specified by:
getObjectsToValidatein interfaceINamesAreUniqueValidationHelper.Context
-
cancelIndicator
public org.eclipse.xtext.util.CancelIndicator cancelIndicator()
Description copied from interface:INamesAreUniqueValidationHelper.ContextThe cancel-indicator that shall be used.- Specified by:
cancelIndicatorin interfaceINamesAreUniqueValidationHelper.Context
-
-