Search in sources :

Example 1 with AbstractDeclarativeValidator

use of org.eclipse.xtext.validation.AbstractDeclarativeValidator in project ow by vtst.

the class ValidatorPageHelper method getValidator.

/**
   * @return The validator configured by the property page.
   * The default package looks for an AbstractDeclarativeValidator associated with the package.
   */
protected AbstractDeclarativeValidator getValidator() {
    if (ePackage == null) {
        showErrorMessageDuringInit("EPackage not injected");
        return null;
    }
    EValidator validator = eValidatorRegistry.getEValidator(ePackage);
    if (validator == null) {
        showErrorMessageDuringInit("No validator found for the current package");
        return null;
    }
    ArrayList<AbstractDeclarativeValidator> declarativeValidators = new ArrayList<AbstractDeclarativeValidator>(1);
    getValidatorRec(validator, declarativeValidators);
    if (declarativeValidators.size() != 1) {
        showErrorMessageDuringInit("Found the following declarative validators: ");
        for (AbstractDeclarativeValidator v : declarativeValidators) showErrorMessageDuringInit(v.getClass().getName());
        return null;
    }
    return declarativeValidators.get(0);
}
Also used : AbstractDeclarativeValidator(org.eclipse.xtext.validation.AbstractDeclarativeValidator) ArrayList(java.util.ArrayList) EValidator(org.eclipse.emf.ecore.EValidator) CompositeEValidator(org.eclipse.xtext.validation.CompositeEValidator)

Aggregations

ArrayList (java.util.ArrayList)1 EValidator (org.eclipse.emf.ecore.EValidator)1 AbstractDeclarativeValidator (org.eclipse.xtext.validation.AbstractDeclarativeValidator)1 CompositeEValidator (org.eclipse.xtext.validation.CompositeEValidator)1