@Override public Object getLockObject() { return getAnnotationMap().getLockObject(); }
@Override public void setLockObject(Object lockObject) { getAnnotationMap().setLockObject(lockObject); }
@Override public Object getLockObject() { return getAnnotationMap().getLockObject(); }
@Override public void setLockObject(Object lockObject) { getAnnotationMap().setLockObject(lockObject); }
/** * Returns all annotations managed by this model. <code>cleanup</code> * indicates whether all annotations whose associated positions are * deleted should previously be removed from the model. * * @param cleanup indicates whether annotations with deleted associated positions are removed * @return all annotations managed by this model */ protected Iterator<Annotation> getAnnotationIterator(boolean cleanup) { if (cleanup) cleanup(true); return getAnnotationMap().keySetIterator(); }
/** * Returns all annotations managed by this model. <code>cleanup</code> * indicates whether all annotations whose associated positions are * deleted should previously be removed from the model. * * @param cleanup indicates whether annotations with deleted associated positions are removed * @return all annotations managed by this model */ protected Iterator<Annotation> getAnnotationIterator(boolean cleanup) { if (cleanup) cleanup(true); return getAnnotationMap().keySetIterator(); }
@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; } }
@Override public void connect(IDocument document) { Assert.isTrue(fDocument == null || fDocument == document); if (fDocument == null) { fDocument= document; Iterator<Position> e= getAnnotationMap().valuesIterator(); while (e.hasNext()) try { addPosition(document, e.next()); } catch (BadLocationException x) { // ignore invalid position } } ++ fOpenConnections; if (fOpenConnections == 1) { document.addDocumentListener(fDocumentListener); connected(); } for (Iterator<Object> it= fAttachments.keySet().iterator(); it.hasNext();) { IAnnotationModel model= fAttachments.get(it.next()); model.connect(document); } }
@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; } }
Iterator<Annotation> e= getAnnotationMap().keySetIterator(); while (e.hasNext()) { Annotation a= e.next();
@Override public void connect(IDocument document) { Assert.isTrue(fDocument == null || fDocument == document); if (fDocument == null) { fDocument= document; Iterator<Position> e= getAnnotationMap().valuesIterator(); while (e.hasNext()) try { addPosition(document, e.next()); } catch (BadLocationException x) { // ignore invalid position } } ++ fOpenConnections; if (fOpenConnections == 1) { document.addDocumentListener(fDocumentListener); connected(); } for (IAnnotationModel model : fAttachments.values()) { model.connect(document); } }
Iterator<Annotation> e= getAnnotationMap().keySetIterator(); while (e.hasNext()) { Annotation a= e.next();
/** * 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(); }