use of org.eclipse.che.ide.api.editor.text.annotation.Annotation in project che by eclipse.
the class GutterAnnotationRenderer method onAnnotationModel.
@Override
public void onAnnotationModel(final AnnotationModelEvent event) {
// remove removed and changed annotations
for (final Annotation annotation : event.getRemovedAnnotations()) {
LOG.fine("Remove annotation: " + annotation);
removeAnnotationItem(event, annotation);
}
for (final Annotation annotation : event.getChangedAnnotations()) {
LOG.fine("Remove changed annotation: " + annotation);
removeAnnotationItem(event, annotation);
}
// add new and changed (new version) annotation
for (final Annotation annotation : event.getAddedAnnotations()) {
LOG.fine("Add annotation: " + annotation);
addAnnotationItem(event.getAnnotationModel(), annotation);
}
for (final Annotation annotation : event.getChangedAnnotations()) {
LOG.fine("Add back changed annotation: " + annotation);
addAnnotationItem(event.getAnnotationModel(), annotation);
}
}
use of org.eclipse.che.ide.api.editor.text.annotation.Annotation in project che by eclipse.
the class MinimapAnnotationRenderer method onAnnotationModel.
@Override
public void onAnnotationModel(final AnnotationModelEvent event) {
// annotation is mutable, not easy to use a set
final Map<Integer, List<Annotation>> toRestore = new HashMap<>();
// remove removed and changed annotations
for (final Annotation annotation : event.getRemovedAnnotations()) {
LOG.fine("Remove annotation: " + annotation);
removeAnnotationItem(event, annotation, toRestore);
}
for (final Annotation annotation : event.getChangedAnnotations()) {
LOG.fine("Remove changed annotation: " + annotation);
removeAnnotationItem(event, annotation, toRestore);
}
final Map<String, String> decorations = event.getAnnotationModel().getAnnotationStyle();
// restore annotations that were deleted but shouldn't have
for (final List<Annotation> annotations : toRestore.values()) {
for (final Annotation annotation : annotations) {
addAnnotationItem(event.getAnnotationModel(), annotation, decorations);
}
}
// add new and changed (new version) annotation
for (final Annotation annotation : event.getAddedAnnotations()) {
LOG.fine("Add annotation: " + annotation);
addAnnotationItem(event.getAnnotationModel(), annotation, decorations);
}
for (final Annotation annotation : event.getChangedAnnotations()) {
LOG.fine("Add back changed annotation: " + annotation);
addAnnotationItem(event.getAnnotationModel(), annotation, decorations);
}
}
use of org.eclipse.che.ide.api.editor.text.annotation.Annotation 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);
}
use of org.eclipse.che.ide.api.editor.text.annotation.Annotation in project che by eclipse.
the class RegionIterator method next.
@Override
public Annotation next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
final Annotation result = next;
next = findNext();
return result;
}
use of org.eclipse.che.ide.api.editor.text.annotation.Annotation in project che by eclipse.
the class AnnotationsIterator method next.
@Override
public Annotation next() {
final Annotation result = next;
next = findNext();
return result;
}
Aggregations