public ValidationResult validate(final IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
if (resource.getType() != IResource.FILE)
return null;
ValidationResult result = new ValidationResult();
final IReporter reporter = result.getReporter(monitor);
if (fragmentCheck((IFile) resource)) {
IStructuredModel model = null;
try {
model = StructuredModelManager.getModelManager().getModelForRead((IFile) resource);
if (!reporter.isCancelled() && model instanceof IDOMModel) {
reporter.removeAllMessages(this, resource);
validate((IFile) resource, kind, state, monitor, (IDOMModel) model, reporter);
}
}
catch (IOException e) {
Logger.logException(e);