Package org.eclipse.jface.text.source
Class AnnotationModelEvent
java.lang.Object
org.eclipse.jface.text.source.AnnotationModelEvent
Specification of changes applied to annotation models. The event carries the
changed annotation model as well as added, removed, and modified annotations.
An event can be sealed. Afterwards it can not be modified. Thus, the normal process is that an empty event is created, filled with the changed information, and before it is sent to the listeners, the event is sealed.
- Since:
- 2.0
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a new annotation model event for the given model.AnnotationModelEvent
(IAnnotationModel model, boolean isWorldChange) Creates a new annotation model event for the given model. -
Method Summary
Modifier and TypeMethodDescriptionvoid
annotationAdded
(Annotation annotation) Adds the given annotation to the set of annotations that are reported as being added from the model.void
annotationChanged
(Annotation annotation) Adds the given annotation to the set of annotations that are reported as being changed from the model.void
annotationRemoved
(Annotation annotation) Adds the given annotation to the set of annotations that are reported as being removed from the model.void
annotationRemoved
(Annotation annotation, Position position) Adds the given annotation to the set of annotations that are reported as being removed from the model.Returns the added annotations.Returns the model this event refers to.Returns the changed annotations.getPositionOfRemovedAnnotation
(Annotation annotation) Returns the position of the removed annotation at that point in time when the annotation has been removed.Returns the removed annotations.boolean
isEmpty()
Returns whether this annotation model event is empty or not.boolean
isValid()
Returns whether this annotation model event is still valid.boolean
Returns whether this annotation model events contains detailed information about the modifications applied to the event annotation model or whether it represents a world change.void
Seals this event.
-
Constructor Details
-
AnnotationModelEvent
Creates a new annotation model event for the given model.- Parameters:
model
- the model
-
AnnotationModelEvent
Creates a new annotation model event for the given model.- Parameters:
model
- the modelisWorldChange
-true
if world change- Since:
- 3.0
-
-
Method Details
-
getAnnotationModel
Returns the model this event refers to.- Returns:
- the model this events belongs to
-
annotationAdded
Adds the given annotation to the set of annotations that are reported as being added from the model. If this event is considered a world change, it is no longer so after this method has successfully finished.- Parameters:
annotation
- the added annotation- Since:
- 3.0
-
getAddedAnnotations
Returns the added annotations.- Returns:
- the added annotations
- Since:
- 3.0
-
annotationRemoved
Adds the given annotation to the set of annotations that are reported as being removed from the model. If this event is considered a world change, it is no longer so after this method has successfully finished.- Parameters:
annotation
- the removed annotation- Since:
- 3.0
-
annotationRemoved
Adds the given annotation to the set of annotations that are reported as being removed from the model. If this event is considered a world change, it is no longer so after this method has successfully finished.- Parameters:
annotation
- the removed annotationposition
- the position of the removed annotation- Since:
- 3.0
-
getRemovedAnnotations
Returns the removed annotations.- Returns:
- the removed annotations
- Since:
- 3.0
-
getPositionOfRemovedAnnotation
Returns the position of the removed annotation at that point in time when the annotation has been removed.- Parameters:
annotation
- the removed annotation- Returns:
- the position of the removed annotation or
null
- Since:
- 3.0
-
annotationChanged
Adds the given annotation to the set of annotations that are reported as being changed from the model. If this event is considered a world change, it is no longer so after this method has successfully finished.- Parameters:
annotation
- the changed annotation- Since:
- 3.0
-
getChangedAnnotations
Returns the changed annotations.- Returns:
- the changed annotations
- Since:
- 3.0
-
isEmpty
public boolean isEmpty()Returns whether this annotation model event is empty or not. If this event represents a world change, this method returnsfalse
although the event does not carry any added, removed, or changed annotations.- Returns:
true
if this event is empty- Since:
- 3.0
-
isWorldChange
public boolean isWorldChange()Returns whether this annotation model events contains detailed information about the modifications applied to the event annotation model or whether it represents a world change. I.e. everything in the model might have changed.- Returns:
true
if world change,false
otherwise- Since:
- 3.0
-
isValid
public boolean isValid()Returns whether this annotation model event is still valid.- Returns:
true
if this event is still valid,false
otherwise- Since:
- 3.0
-
markSealed
public void markSealed()Seals this event. Any direct modification to the annotation model after the event has been sealed invalidates this event.- Since:
- 3.0
-