@Override public void disconnect(IDocument document) { Assert.isTrue(fDocument == document); for (Iterator<Object> it= fAttachments.keySet().iterator(); it.hasNext();) { IAnnotationModel model= fAttachments.get(it.next()); model.disconnect(document); } -- fOpenConnections; if (fOpenConnections == 0) { disconnected(); document.removeDocumentListener(fDocumentListener); Iterator<Position> e= getAnnotationMap().valuesIterator(); while (e.hasNext()) { Position p= e.next(); removePosition(document, p); } fDocument= null; } }
/** * Removes the given annotation from the annotation model. * If requested inform all model change listeners about this change. * * @param annotation the annotation to be removed * @param fireModelChanged indicates whether to notify all model listeners */ protected void removeAnnotation(Annotation annotation, boolean fireModelChanged) { if (fAnnotations.containsKey(annotation)) { Position p= null; p= fAnnotations.get(annotation); if (fDocument != null) { removePosition(fDocument, p); // p.delete(); } fAnnotations.remove(annotation); fPositions.remove(p); synchronized (getLockObject()) { getAnnotationModelEvent().annotationRemoved(annotation, p); } if (fireModelChanged) fireModelChanged(); } }
/** * Removes the given annotation from the annotation model. * If requested inform all model change listeners about this change. * * @param annotation the annotation to be removed * @param fireModelChanged indicates whether to notify all model listeners */ protected void removeAnnotation(Annotation annotation, boolean fireModelChanged) { if (fAnnotations.containsKey(annotation)) { Position p= null; p= fAnnotations.get(annotation); if (fDocument != null) { removePosition(fDocument, p); // p.delete(); } fAnnotations.remove(annotation); fPositions.remove(p); synchronized (getLockObject()) { getAnnotationModelEvent().annotationRemoved(annotation, p); } if (fireModelChanged) fireModelChanged(); } }
@Override public void disconnect(IDocument document) { Assert.isTrue(fDocument == document); for (IAnnotationModel model : fAttachments.values()) { model.disconnect(document); } -- fOpenConnections; if (fOpenConnections == 0) { disconnected(); document.removeDocumentListener(fDocumentListener); Iterator<Position> e= getAnnotationMap().valuesIterator(); while (e.hasNext()) { Position p= e.next(); removePosition(document, p); } fDocument= null; } }
/** * Removes all annotations from the annotation model. If requested * inform all model change listeners about this change. * * @param fireModelChanged indicates whether to notify all model listeners */ protected void removeAllAnnotations(boolean fireModelChanged) { if (fDocument != null) { Iterator<Annotation> e= getAnnotationMap().keySetIterator(); while (e.hasNext()) { Annotation a= e.next(); Position p= fAnnotations.get(a); removePosition(fDocument, p); // p.delete(); synchronized (getLockObject()) { getAnnotationModelEvent().annotationRemoved(a, p); } } } fAnnotations.clear(); fPositions.clear(); if (fireModelChanged) fireModelChanged(); }
/** * Removes all annotations from the annotation model. If requested * inform all model change listeners about this change. * * @param fireModelChanged indicates whether to notify all model listeners */ protected void removeAllAnnotations(boolean fireModelChanged) { if (fDocument != null) { Iterator<Annotation> e= getAnnotationMap().keySetIterator(); while (e.hasNext()) { Annotation a= e.next(); Position p= fAnnotations.get(a); removePosition(fDocument, p); // p.delete(); synchronized (getLockObject()) { getAnnotationModelEvent().annotationRemoved(a, p); } } } fAnnotations.clear(); fPositions.clear(); if (fireModelChanged) fireModelChanged(); }