Search in sources :

Example 6 with NestedValidatorContext

use of org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext in project sling by apache.

the class IgnoreMissingGrammarXmlValidator method validate.

/** Perform the validation using version 2 of the validation framework. Copied from {@link AbstractNestedValidator#validate(IResource,
     * int, ValidationState, IProgressMonitor). Cannot use original one as that skips resources starting with "." */
@Override
public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
    ValidationResult result = new ValidationResult();
    IFile file = null;
    if (resource instanceof IFile)
        file = (IFile) resource;
    if (file != null && shouldValidate(file)) {
        IReporter reporter = result.getReporter(monitor);
        NestedValidatorContext nestedcontext = getNestedContext(state, false);
        boolean teardownRequired = false;
        if (nestedcontext == null) {
            // validationstart was not called, so manually setup and tear down
            nestedcontext = getNestedContext(state, true);
            nestedcontext.setProject(file.getProject());
            setupValidation(nestedcontext);
            teardownRequired = true;
        } else {
            nestedcontext.setProject(file.getProject());
        }
        doValidate(file, null, result, reporter, nestedcontext);
        if (teardownRequired)
            teardownValidation(nestedcontext);
    }
    return result;
}
Also used : IFile(org.eclipse.core.resources.IFile) IReporter(org.eclipse.wst.validation.internal.provisional.core.IReporter) NestedValidatorContext(org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext) ValidationResult(org.eclipse.wst.validation.ValidationResult)

Aggregations

NestedValidatorContext (org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext)6 XMLNestedValidatorContext (org.eclipse.wst.xml.core.internal.validation.XMLNestedValidatorContext)3 InputStream (java.io.InputStream)2 IFile (org.eclipse.core.resources.IFile)2 IOException (java.io.IOException)1 URL (java.net.URL)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 ValidationResult (org.eclipse.wst.validation.ValidationResult)1 IReporter (org.eclipse.wst.validation.internal.provisional.core.IReporter)1 ValidationReport (org.eclipse.wst.xml.core.internal.validation.core.ValidationReport)1