/** * Informs all annotation model listeners that this model has been changed. */ protected void fireModelChanged() { AnnotationModelEvent modelEvent= null; synchronized(getLockObject()) { if (fModelEvent != null) { modelEvent= fModelEvent; fModelEvent= null; } } if (modelEvent != null) fireModelChanged(modelEvent); }
/** * Informs all annotation model listeners that this model has been changed. */ protected void fireModelChanged() { AnnotationModelEvent modelEvent= null; synchronized(getLockObject()) { if (fModelEvent != null) { modelEvent= fModelEvent; fModelEvent= null; } } if (modelEvent != null) fireModelChanged(modelEvent); }
/** * Returns the current annotation model event. This is the event that will be sent out * when calling <code>fireModelChanged</code>. * * @return the current annotation model event * @since 3.0 */ protected final AnnotationModelEvent getAnnotationModelEvent() { synchronized (getLockObject()) { if (fModelEvent == null) { fModelEvent= createAnnotationModelEvent(); fModelEvent.markWorldChange(false); fModificationStamp= new Object(); } return fModelEvent; } }
/** * Returns the current annotation model event. This is the event that will be sent out * when calling <code>fireModelChanged</code>. * * @return the current annotation model event * @since 3.0 */ protected final AnnotationModelEvent getAnnotationModelEvent() { synchronized (getLockObject()) { if (fModelEvent == null) { fModelEvent= createAnnotationModelEvent(); fModelEvent.markWorldChange(false); fModificationStamp= new Object(); } return fModelEvent; } }
/** * Modifies the given annotation if the annotation is managed by this * annotation model. * <p> * If requested, all annotation model change listeners will be informed * about the change. * * @param annotation the annotation to be modified * @param fireModelChanged indicates whether to notify all model listeners * @since 3.0 */ protected void modifyAnnotation(Annotation annotation, boolean fireModelChanged) { if (fAnnotations.containsKey(annotation)) { synchronized (getLockObject()) { getAnnotationModelEvent().annotationChanged(annotation); } 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(); } }
/** * Adds the given annotation to this model. Associates the * annotation with the given position. If requested, all annotation * model listeners are informed about this model change. If the annotation * is already managed by this model nothing happens. * * @param annotation the annotation to add * @param position the associate position * @param fireModelChanged indicates whether to notify all model listeners * @throws BadLocationException if the position is not a valid document position */ protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) throws BadLocationException { if (!fAnnotations.containsKey(annotation)) { addPosition(fDocument, position); fAnnotations.put(annotation, position); fPositions.put(position, annotation); synchronized (getLockObject()) { getAnnotationModelEvent().annotationAdded(annotation); } 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(); } }
/** * Adds the given annotation to this model. Associates the * annotation with the given position. If requested, all annotation * model listeners are informed about this model change. If the annotation * is already managed by this model nothing happens. * * @param annotation the annotation to add * @param position the associate position * @param fireModelChanged indicates whether to notify all model listeners * @throws BadLocationException if the position is not a valid document position */ protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) throws BadLocationException { if (!fAnnotations.containsKey(annotation)) { addPosition(fDocument, position); fAnnotations.put(annotation, position); fPositions.put(position, annotation); synchronized (getLockObject()) { getAnnotationModelEvent().annotationAdded(annotation); } if (fireModelChanged) fireModelChanged(); } }
/** * Modifies the given annotation if the annotation is managed by this * annotation model. * <p> * If requested, all annotation model change listeners will be informed * about the change. * * @param annotation the annotation to be modified * @param fireModelChanged indicates whether to notify all model listeners * @since 3.0 */ protected void modifyAnnotation(Annotation annotation, boolean fireModelChanged) { if (fAnnotations.containsKey(annotation)) { synchronized (getLockObject()) { getAnnotationModelEvent().annotationChanged(annotation); } if (fireModelChanged) fireModelChanged(); } }
synchronized (getLockObject()) { if (fModelEvent != null) new Thread() {
synchronized (getLockObject()) { if (fModelEvent != null) new Thread() {
/** * 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(); }
synchronized (getLockObject()) { getAnnotationModelEvent().annotationChanged(annotation);
synchronized (getLockObject()) { getAnnotationModelEvent().annotationChanged(annotation);
Object annotationLockObject = annotationModel.getLockObject(); if (annotationLockObject == null) { annotationLockObject = annotationModel;