org.eclipse.xtext.validation.NamesAreUniqueValidator Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.xtext.validation;
import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.resource.IResourceDescription;
import org.eclipse.xtext.resource.IResourceServiceProvider;
import org.eclipse.xtext.util.CancelIndicator;
import com.google.inject.Inject;
/**
*
* An {@link org.eclipse.emf.ecore.EValidator} implementation, that can be used via {@link ComposedChecks} generically
* to validate for duplicated exported objects.
*
*
* It validates only the objects, that will be publicly available via an {@link IResourceDescription}. Local
* variables and similar objects have to be validated on their own. The {@link INamesAreUniqueValidationHelper} provides
* a convenient way to apply this kind of constraints.
*
*
* @author Sebastian Zarnekow - Initial contribution and API
*/
public class NamesAreUniqueValidator extends AbstractDeclarativeValidator {
@Inject
private IResourceServiceProvider.Registry resourceServiceProviderRegistry = IResourceServiceProvider.Registry.INSTANCE;
@Inject
private INamesAreUniqueValidationHelper helper;
@Override
public void register(EValidatorRegistrar registrar) {
// library validator is not registered for a specific language
}
@Check
public void checkUniqueNamesInResourceOf(EObject eObject) {
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy