/** * Removes the all annotations. */ private void removeAllAnnotations() { // Remove all annotation from the model IAnnotationModel annotationModel = getDocumentProvider().getAnnotationModel(getEditorInput()); ((IAnnotationModelExtension) annotationModel).removeAllAnnotations(); }
/** * Sync annotations. */ private void syncAnnotations() { removeAllAnnotations(); // Remove all annotation from the model IAnnotationModel annotationModel = getDocumentProvider().getAnnotationModel(getEditorInput()); ((IAnnotationModelExtension) annotationModel).removeAllAnnotations(); // Add all annotation to the model // copy annotations into annotation model final Iterator<AnnotationFS> mAnnotations = getDocument().getCAS().getAnnotationIndex() .iterator(); // TODO: Build first a map, and then pass all annotations at once Map annotationsToAdd = new HashMap(); while (mAnnotations.hasNext()) { AnnotationFS annotationFS = mAnnotations.next(); annotationsToAdd.put(new EclipseAnnotationPeer(annotationFS), new Position( annotationFS.getBegin(), annotationFS.getEnd() - annotationFS.getBegin())); } ((IAnnotationModelExtension) annotationModel).replaceAnnotations(null, annotationsToAdd); }
( ( IAnnotationModelExtension ) annotationModel ).removeAllAnnotations();
( ( IAnnotationModelExtension ) sourceViewer.getAnnotationModel() ).removeAllAnnotations();