org.eclipse.xtext.validation
Class NamesAreUniqueValidator

java.lang.Object
  extended by org.eclipse.xtext.validation.AbstractInjectableValidator
      extended by org.eclipse.xtext.validation.AbstractDeclarativeValidator
          extended by org.eclipse.xtext.validation.NamesAreUniqueValidator
All Implemented Interfaces:
org.eclipse.emf.ecore.EValidator, ValidationMessageAcceptor

public class NamesAreUniqueValidator
extends AbstractDeclarativeValidator

An EValidator implementation, that can be used via ComposedChecks generically to validate for duplicated exported objects.

It validates only the objects, that will be publicly available via an IResourceDescription. Local variables and similar objects have to be validated on their own. The INamesAreUniqueValidationHelper provides a convenient way to apply this kind of constraints.

Author:
Sebastian Zarnekow - Initial contribution and API

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.xtext.validation.AbstractDeclarativeValidator
AbstractDeclarativeValidator.State, AbstractDeclarativeValidator.StateAccess
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.EValidator
org.eclipse.emf.ecore.EValidator.Descriptor, org.eclipse.emf.ecore.EValidator.PatternMatcher, org.eclipse.emf.ecore.EValidator.Registry, org.eclipse.emf.ecore.EValidator.SubstitutionLabelProvider
 
Field Summary
 
Fields inherited from class org.eclipse.xtext.validation.AbstractInjectableValidator
CURRENT_LANGUAGE_NAME
 
Fields inherited from interface org.eclipse.xtext.validation.ValidationMessageAcceptor
INSIGNIFICANT_INDEX
 
Fields inherited from interface org.eclipse.emf.ecore.EValidator
MARKER, RELATED_URIS_ATTRIBUTE, URI_ATTRIBUTE
 
Constructor Summary
NamesAreUniqueValidator()
           
 
Method Summary
 void checkUniqueNamesInResourceOf(org.eclipse.emf.ecore.EObject eObject)
           
 void doCheckUniqueNames(org.eclipse.emf.ecore.resource.Resource resource, CancelIndicator cancelIndicator)
           
 INamesAreUniqueValidationHelper getHelper()
           
 IResourceServiceProvider.Registry getResourceServiceProviderRegistry()
           
 void register(EValidatorRegistrar registrar)
           
 void setHelper(INamesAreUniqueValidationHelper helper)
           
 void setResourceServiceProviderRegistry(IResourceServiceProvider.Registry resourceDescriptionManagerRegistry)
           
 
Methods inherited from class org.eclipse.xtext.validation.AbstractDeclarativeValidator
acceptError, acceptError, acceptInfo, acceptInfo, acceptWarning, acceptWarning, checkDone, createDiagnostic, createDiagnostic, error, error, error, error, error, error, error, getChain, getCheckMode, getContext, getCurrentMethod, getCurrentObject, getMessageAcceptor, guard, info, info, info, info, info, info, internalValidate, newInstance, setInjector, setMessageAcceptor, toDiagnosticSeverity, warning, warning, warning, warning, warning, warning, warning
 
Methods inherited from class org.eclipse.xtext.validation.AbstractInjectableValidator
getCurrentLanguage, getEPackages, isLanguageSpecific, isResponsible, validate, validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamesAreUniqueValidator

public NamesAreUniqueValidator()
Method Detail

register

public void register(EValidatorRegistrar registrar)
Overrides:
register in class AbstractInjectableValidator

checkUniqueNamesInResourceOf

public void checkUniqueNamesInResourceOf(org.eclipse.emf.ecore.EObject eObject)

doCheckUniqueNames

public void doCheckUniqueNames(org.eclipse.emf.ecore.resource.Resource resource,
                               CancelIndicator cancelIndicator)

setHelper

public void setHelper(INamesAreUniqueValidationHelper helper)

getHelper

public INamesAreUniqueValidationHelper getHelper()

setResourceServiceProviderRegistry

public void setResourceServiceProviderRegistry(IResourceServiceProvider.Registry resourceDescriptionManagerRegistry)

getResourceServiceProviderRegistry

public IResourceServiceProvider.Registry getResourceServiceProviderRegistry()