protected void validate(Resource resource, EObject element, final CheckMode mode, final CancelIndicator monitor,
IAcceptor<Issue> acceptor) {
try {
Map<Object, Object> options = Maps.newHashMap();
options.put(CheckMode.KEY, mode);
options.put(CancelableDiagnostician.CANCEL_INDICATOR, monitor);
options.put(ConcreteSyntaxEValidator.DISABLE_CONCRETE_SYNTAX_EVALIDATOR, Boolean.TRUE);
options.put(EValidator.class, diagnostician);
if (resource instanceof XtextResource) {
options.put(AbstractInjectableValidator.CURRENT_LANGUAGE_NAME,
((XtextResource) resource).getLanguageName());
}
Diagnostic diagnostic = diagnostician.validate(element, options);
if (!diagnostic.getChildren().isEmpty()) {
for (Diagnostic childDiagnostic : diagnostic.getChildren()) {
issueFromEValidatorDiagnostic(childDiagnostic, acceptor);
}
} else {
issueFromEValidatorDiagnostic(diagnostic, acceptor);
}
} catch (RuntimeException e) {
log.error(e.getMessage(), e);
}
}