public class NamesAreUniqueValidationHelper extends java.lang.Object implements INamesAreUniqueValidationHelper
INamesAreUniqueValidationHelper.Context, INamesAreUniqueValidationHelper.ContextProvider| Constructor and Description |
|---|
NamesAreUniqueValidationHelper() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkDescriptionForDuplicatedName(IEObjectDescription description,
java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Map<QualifiedName,IEObjectDescription>> clusterTypeToName,
ValidationMessageAcceptor acceptor)
|
void |
checkUniqueNames(INamesAreUniqueValidationHelper.Context context,
ValidationMessageAcceptor acceptor)
Create errors for objects that have the same name according to the given context.
|
void |
checkUniqueNames(java.lang.Iterable<IEObjectDescription> descriptions,
org.eclipse.xtext.util.CancelIndicator cancelIndicator,
ValidationMessageAcceptor acceptor)
Deprecated.
Since Xtext 2.22 implementations should adhere to the context provided via
checkUniqueNames(org.eclipse.xtext.validation.INamesAreUniqueValidationHelper.Context, ValidationMessageAcceptor). |
void |
checkUniqueNames(java.lang.Iterable<IEObjectDescription> descriptions,
ValidationMessageAcceptor acceptor)
Deprecated.
Since Xtext 2.22 implementations should adhere to the context provided via
checkUniqueNames(org.eclipse.xtext.validation.INamesAreUniqueValidationHelper.Context, ValidationMessageAcceptor). |
protected void |
createDuplicateNameError(IEObjectDescription description,
org.eclipse.emf.ecore.EClass clusterType,
ValidationMessageAcceptor acceptor) |
protected void |
doCheckUniqueIn(IEObjectDescription description,
INamesAreUniqueValidationHelper.Context context,
ValidationMessageAcceptor acceptor) |
protected void |
doCheckUniqueNames(INamesAreUniqueValidationHelper.Context context,
ValidationMessageAcceptor acceptor) |
protected org.eclipse.emf.ecore.EClass |
getAssociatedClusterType(org.eclipse.emf.ecore.EClass eClass)
Return the type that describes the set of instances that should have unique names.
|
protected org.eclipse.emf.ecore.EClass |
getClusterType(IEObjectDescription description) |
protected com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EClass> |
getClusterTypes()
Initialize the set of clustering types.
|
protected org.eclipse.emf.ecore.EObject |
getContainerForErrorMessage(org.eclipse.emf.ecore.EObject object) |
java.lang.String |
getDuplicateNameErrorMessage(IEObjectDescription description,
org.eclipse.emf.ecore.EClass clusterType,
org.eclipse.emf.ecore.EStructuralFeature feature)
Build the error message for duplicated names.
|
protected java.lang.String |
getErrorCode()
Returns
null. |
protected org.eclipse.emf.ecore.EStructuralFeature |
getNameFeature(org.eclipse.emf.ecore.EObject object) |
protected java.lang.String |
getTypeLabel(org.eclipse.emf.ecore.EClass eClass) |
protected boolean |
isContainerInformationHelpful(IEObjectDescription description,
org.eclipse.emf.ecore.EObject container,
java.lang.String containerTypeLabel,
org.eclipse.emf.ecore.EStructuralFeature containerNameFeature) |
protected boolean |
isContainerInformationHelpful(IEObjectDescription description,
java.lang.String shortName) |
protected boolean |
isDuplicate(IEObjectDescription description,
IEObjectDescription candidate)
Called with two descriptions that have the same name.
|
protected com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EClass> getClusterTypes()
Initialize the set of clustering types. A type is considered to be clustering if any instance of that type has to
have a unique name when it is transformed to an IEObjectDescription. Instances
that do not belong to the same cluster may have the same exported name.
A clustering type will often be some kind of root type in a type hierarchy.
@Deprecated public void checkUniqueNames(java.lang.Iterable<IEObjectDescription> descriptions, ValidationMessageAcceptor acceptor)
checkUniqueNames(org.eclipse.xtext.validation.INamesAreUniqueValidationHelper.Context, ValidationMessageAcceptor).INamesAreUniqueValidationHelpercheckUniqueNames in interface INamesAreUniqueValidationHelperINamesAreUniqueValidationHelper.checkUniqueNames(Iterable, CancelIndicator, ValidationMessageAcceptor)@Deprecated public void checkUniqueNames(java.lang.Iterable<IEObjectDescription> descriptions, org.eclipse.xtext.util.CancelIndicator cancelIndicator, ValidationMessageAcceptor acceptor)
checkUniqueNames(org.eclipse.xtext.validation.INamesAreUniqueValidationHelper.Context, ValidationMessageAcceptor).Create errors for objects that have the same name. Objects that do not belong to the same cluster will not get any errors. The cancel indicator may be used to abort the validation.
The cancel indicator will be queried everytime a description has been processed. It should provide a fast answer about its canceled state.checkUniqueNames in interface INamesAreUniqueValidationHelperpublic void checkUniqueNames(INamesAreUniqueValidationHelper.Context context, ValidationMessageAcceptor acceptor)
INamesAreUniqueValidationHelpercheckUniqueNames in interface INamesAreUniqueValidationHelperprotected void doCheckUniqueNames(INamesAreUniqueValidationHelper.Context context, ValidationMessageAcceptor acceptor)
protected void doCheckUniqueIn(IEObjectDescription description, INamesAreUniqueValidationHelper.Context context, ValidationMessageAcceptor acceptor)
protected boolean isDuplicate(IEObjectDescription description, IEObjectDescription candidate)
@Deprecated protected void checkDescriptionForDuplicatedName(IEObjectDescription description, java.util.Map<org.eclipse.emf.ecore.EClass,java.util.Map<QualifiedName,IEObjectDescription>> clusterTypeToName, ValidationMessageAcceptor acceptor)
protected void createDuplicateNameError(IEObjectDescription description, org.eclipse.emf.ecore.EClass clusterType, ValidationMessageAcceptor acceptor)
protected java.lang.String getErrorCode()
null. Clients may override if they desire to attach an error code to the created errors.public java.lang.String getDuplicateNameErrorMessage(IEObjectDescription description, org.eclipse.emf.ecore.EClass clusterType, org.eclipse.emf.ecore.EStructuralFeature feature)
protected boolean isContainerInformationHelpful(IEObjectDescription description, org.eclipse.emf.ecore.EObject container, java.lang.String containerTypeLabel, org.eclipse.emf.ecore.EStructuralFeature containerNameFeature)
protected boolean isContainerInformationHelpful(IEObjectDescription description, java.lang.String shortName)
protected org.eclipse.emf.ecore.EObject getContainerForErrorMessage(org.eclipse.emf.ecore.EObject object)
protected java.lang.String getTypeLabel(org.eclipse.emf.ecore.EClass eClass)
protected org.eclipse.emf.ecore.EStructuralFeature getNameFeature(org.eclipse.emf.ecore.EObject object)
protected org.eclipse.emf.ecore.EClass getClusterType(IEObjectDescription description)
null if the given description does not participate in the unique name
validation.getAssociatedClusterType(EClass)protected org.eclipse.emf.ecore.EClass getAssociatedClusterType(org.eclipse.emf.ecore.EClass eClass)
getClusterTypes()). Only the first super type will be taken into account
when walking the hierarchy.
Return null if objects of the given type are not subject to validation.