use of org.eclipse.wst.validation.ValidationResult in project webtools.sourceediting by eclipse.
the class StreamingMarkupValidator method validate.
/* (non-Javadoc)
* @see org.eclipse.wst.validation.AbstractValidator#validate(org.eclipse.core.resources.IResource, int, org.eclipse.wst.validation.ValidationState, org.eclipse.core.runtime.IProgressMonitor)
*/
public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
if (resource.getType() != IResource.FILE)
return null;
ValidationResult result = new ValidationResult();
fReporter = result.getReporter(monitor);
validateFile((IFile) resource, fReporter);
return result;
}
use of org.eclipse.wst.validation.ValidationResult in project webtools.sourceediting by eclipse.
the class AbstractNestedValidator method validate.
/**
* Perform the validation using version 2 of the validation framework.
*/
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());
}
validate(file, null, result, reporter, nestedcontext);
if (teardownRequired)
teardownValidation(nestedcontext);
}
return result;
}
use of org.eclipse.wst.validation.ValidationResult in project webtools.sourceediting by eclipse.
the class Validator method validate.
@Override
public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
ValidationResult res = super.validate(resource, kind, state, monitor);
if (resource.getType() == IResource.FILE) {
StylesheetModel stylesheet = XSLCore.getInstance().getStylesheet((IFile) resource);
IFile[] dependencies = stylesheet.getFileDependencies().toArray(new IFile[0]);
res.setDependsOn(dependencies);
}
return res;
}
use of org.eclipse.wst.validation.ValidationResult in project webtools.sourceediting by eclipse.
the class MarkupValidator method validate.
/* (non-Javadoc)
* @see org.eclipse.wst.validation.AbstractValidator#validate(org.eclipse.core.resources.IResource, int, org.eclipse.wst.validation.ValidationState, org.eclipse.core.runtime.IProgressMonitor)
*/
public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
if (resource.getType() != IResource.FILE)
return null;
ValidationResult result = new ValidationResult();
fReporter = result.getReporter(monitor);
validateV1File((IFile) resource, fReporter);
return result;
}
use of org.eclipse.wst.validation.ValidationResult in project sling by apache.
the class ContentProjectValidator method validate.
@Override
public ValidationResult validate(ValidationEvent event, ValidationState state, IProgressMonitor monitor) {
ValidationResult res = new ValidationResult();
if (!okToValidate) {
return res;
}
okToValidate = false;
IResource resource = event.getResource();
IProject project = resource.getProject();
IPath syncDir = ProjectUtil.getSyncDirectoryValue(project);
IResource member = project.findMember(syncDir);
try {
// we assume this is the only validator putting validation markers with that id on the project itself
deleteValidationMarkers(project);
if (member == null) {
addValidatorMessage(res, project, "Configured sync dir " + syncDir + " does not exist");
} else if (member.getType() != IResource.FOLDER) {
addValidatorMessage(res, project, "Configured sync dir " + syncDir + " is not a directory");
}
} catch (CoreException e) {
getLogger().warn("Failed validating content project " + resource.getFullPath(), e);
}
return res;
}
Aggregations