Search in sources :

Example 1 with OrionProblemOverlay

use of org.eclipse.che.ide.editor.orion.client.jso.OrionProblemOverlay in project che by eclipse.

the class OrionEditorWidget method showErrors.

public void showErrors(AnnotationModelEvent event) {
    List<Annotation> addedAnnotations = event.getAddedAnnotations();
    JsArray<OrionProblemOverlay> jsArray = JsArray.createArray().cast();
    AnnotationModel annotationModel = event.getAnnotationModel();
    OrionAnnotationSeverityProvider severityProvider = null;
    if (annotationModel instanceof OrionAnnotationSeverityProvider) {
        severityProvider = (OrionAnnotationSeverityProvider) annotationModel;
    }
    for (Annotation annotation : addedAnnotations) {
        Position position = annotationModel.getPosition(annotation);
        OrionProblemOverlay problem = JavaScriptObject.createObject().cast();
        problem.setDescription(annotation.getText());
        problem.setStart(position.getOffset());
        problem.setEnd(position.getOffset() + position.getLength());
        problem.setId("che-annotation");
        problem.setSeverity(getSeverity(annotation.getType(), severityProvider));
        jsArray.push(problem);
    }
    editorOverlay.showProblems(jsArray);
}
Also used : Position(org.eclipse.che.ide.api.editor.text.Position) OrionProblemOverlay(org.eclipse.che.ide.editor.orion.client.jso.OrionProblemOverlay) AnnotationModel(org.eclipse.che.ide.api.editor.annotation.AnnotationModel) Annotation(org.eclipse.che.ide.api.editor.text.annotation.Annotation)

Aggregations

AnnotationModel (org.eclipse.che.ide.api.editor.annotation.AnnotationModel)1 Position (org.eclipse.che.ide.api.editor.text.Position)1 Annotation (org.eclipse.che.ide.api.editor.text.annotation.Annotation)1 OrionProblemOverlay (org.eclipse.che.ide.editor.orion.client.jso.OrionProblemOverlay)1