use of org.eclipse.che.api.languageserver.shared.lsapi.DiagnosticDTO in project che by eclipse.
the class PublishDiagnosticsProcessor method processDiagnostics.
public void processDiagnostics(PublishDiagnosticsParamsDTO diagnosticsMessage) {
EditorPartPresenter openedEditor = editorAgent.getOpenedEditor(new Path(diagnosticsMessage.getUri()));
//TODO add markers
if (openedEditor == null) {
return;
}
if (openedEditor instanceof TextEditor) {
TextEditorConfiguration editorConfiguration = ((TextEditor) openedEditor).getConfiguration();
AnnotationModel annotationModel = editorConfiguration.getAnnotationModel();
if (annotationModel != null && annotationModel instanceof DiagnosticCollector) {
DiagnosticCollector collector = (DiagnosticCollector) annotationModel;
collector.beginReporting();
try {
for (DiagnosticDTO diagnostic : diagnosticsMessage.getDiagnostics()) {
collector.acceptDiagnostic(diagnostic);
}
} finally {
collector.endReporting();
}
}
}
}
use of org.eclipse.che.api.languageserver.shared.lsapi.DiagnosticDTO in project che by eclipse.
the class LanguageServerAnnotationModel method reportDiagnostic.
private void reportDiagnostic() {
boolean temporaryProblemsChanged = false;
if (!generatedAnnotations.isEmpty()) {
temporaryProblemsChanged = true;
super.clear();
generatedAnnotations.clear();
}
if (diagnostics != null && !diagnostics.isEmpty()) {
for (final DiagnosticDTO diagnostic : diagnostics) {
final Position position = createPositionFromDiagnostic(diagnostic);
if (position != null) {
final DiagnosticAnnotation annotation = new DiagnosticAnnotation(diagnostic);
addAnnotation(annotation, position, false);
generatedAnnotations.add(annotation);
temporaryProblemsChanged = true;
}
}
}
if (temporaryProblemsChanged) {
fireModelChanged();
}
}
Aggregations