Package org.eclipse.jface.text.source
Interface IAnnotationModelExtension
-
- All Known Implementing Classes:
AbstractMarkerAnnotationModel
,AnnotationModel
,ProjectionAnnotationModel
,ResourceMarkerAnnotationModel
public interface IAnnotationModelExtension
ExtendsIAnnotationModel
with 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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAnnotationModel(Object key, IAnnotationModel attachment)
Attachesattachment
to the receiver.IAnnotationModel
getAnnotationModel(Object key)
Returns the attachedIAnnotationModel
forkey
, ornull
if none is attached forkey
.Object
getModificationStamp()
Returns the modification stamp of this annotation model.void
modifyAnnotationPosition(Annotation annotation, Position position)
Modifies the position associated with the given annotation to equal the given position.void
removeAllAnnotations()
Removes all annotations from this annotation model.IAnnotationModel
removeAnnotationModel(Object key)
Removes and returns the attachedIAnnotationModel
forkey
.void
replaceAnnotations(Annotation[] annotationsToRemove, Map<? extends Annotation,? extends Position> annotationsToAdd)
Adds and removes annotations to/from this annotation model in a single step.
-
-
-
Method Detail
-
addAnnotationModel
void addAnnotationModel(Object key, IAnnotationModel attachment)
Attachesattachment
to the receiver. Connectsattachment
to the currently connected document. Ifattachment
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 attachedIAnnotationModel
-
getAnnotationModel
IAnnotationModel getAnnotationModel(Object key)
Returns the attachedIAnnotationModel
forkey
, ornull
if none is attached forkey
.- Parameters:
key
- the key through which the attachment is identified.- Returns:
- an
IAnnotationModel
attached underkey
, ornull
-
removeAnnotationModel
IAnnotationModel removeAnnotationModel(Object key)
Removes and returns the attachedIAnnotationModel
forkey
.- Parameters:
key
- the key through which the attachment is identified.- Returns:
- an
IAnnotationModel
attached underkey
, ornull
-
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 benull
annotationsToAdd
- the annotations which will be added, may benull
each map entry has anAnnotation
as key and aPosition
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 isnull
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 modifiedposition
- 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
-
-