Interface IAnnotationModelExtension

All Known Implementing Classes:
AbstractMarkerAnnotationModel, AnnotationModel, ProjectionAnnotationModel, ResourceMarkerAnnotationModel

public interface IAnnotationModelExtension
Extends IAnnotationModelwith the ability piggyback other annotation models. It also introduces the concept of modification time stamps and adds methods for richer manipulation methods.
Since:
3.0
  • Method Details

    • addAnnotationModel

      void addAnnotationModel(Object key, IAnnotationModel attachment)
      Attaches attachment to the receiver. Connects attachment to the currently connected document. If attachment is already attached (even) under a different key), it is not attached again.
      Parameters:
      key - the key through which the attachment is identified.
      attachment - the attached IAnnotationModel
    • getAnnotationModel

      IAnnotationModel getAnnotationModel(Object key)
      Returns the attached IAnnotationModel for key, or null if none is attached for key.
      Parameters:
      key - the key through which the attachment is identified.
      Returns:
      an IAnnotationModel attached under key, or null
    • removeAnnotationModel

      IAnnotationModel removeAnnotationModel(Object key)
      Removes and returns the attached IAnnotationModel for key.
      Parameters:
      key - the key through which the attachment is identified.
      Returns:
      an IAnnotationModel attached under key, or null
    • replaceAnnotations

      void replaceAnnotations(Annotation[] annotationsToRemove, Map<? extends Annotation,? extends Position> annotationsToAdd) throws ClassCastException
      Adds and removes annotations to/from this annotation model in a single step. The annotations to remove are given in an array. The annotations to add are provided in a map associating the annotations with the positions at which they should be added. All registered annotation model listeners are informed about the change. If the model is connected to a document, the positions are automatically updated on document changes. Annotations that are already managed by this annotation model or are not associated with a valid position in the connected document have no effect.
      Parameters:
      annotationsToRemove - the annotations to be removed, may be null
      annotationsToAdd - the annotations which will be added, may be null each map entry has an Annotation as key and a Position as value
      Throws:
      ClassCastException - if one of the map key or values has a wrong type
    • modifyAnnotationPosition

      void modifyAnnotationPosition(Annotation annotation, Position position)
      Modifies the position associated with the given annotation to equal the given position. If the annotation is not yet managed by this annotation model, the annotation is added. If the given position is null the annotation is removed from the model. All annotation model change listeners will be informed about the change.
      Parameters:
      annotation - the annotation whose associated position should be modified
      position - the position to whose values the associated position should be changed
    • removeAllAnnotations

      void removeAllAnnotations()
      Removes all annotations from this annotation model.
    • getModificationStamp

      Object getModificationStamp()
      Returns the modification stamp of this annotation model.
      Returns:
      the modification stamp of this annotation model