Java 类org.eclipse.xtext.validation.DiagnosticConverterImpl 实例源码

项目:EASyProducer    文件:CommonXtextEditor.java   
/**
 * Processes the messages.
 * 
 * @param result the translation result
 * @throws CoreException in case of marker processing problems
 */
private void processMessages(TranslationResult<?> result) throws CoreException {
    final IResource res = getResource();
    res.deleteMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO);
    DiagnosticConverterImpl conv = new DiagnosticConverterImpl();
    final MarkerCreator markerCreator = new MarkerCreator();
    for (int m = 0; m < result.getMessageCount(); m++) {
        Message message = result.getMessage(m);
        conv.convertValidatorDiagnostic(ValidationUtils.processMessage(message), new IAcceptor<Issue>() {

            @Override
            public void accept(Issue issue) {
                try {
                    markerCreator.createMarker(issue, res, IMarker.PROBLEM);
                } catch (CoreException e) {
                    getLogger().exception(e);
                }
            }
        });
    }
}