|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.text.source.AnnotationModel
Standard implementation of IAnnotationModel
. This class can directly
be used by clients. Subclasses may adapt this annotation model to other exsisting
annotation mechanisms.
Field Summary | |
protected ArrayList |
fAnnotationModelListeners
The list of annotation model listeners |
protected Map |
fAnnotations
The list of managed annotations |
protected IDocument |
fDocument
The document conntected with this model |
Constructor Summary | |
AnnotationModel()
Creates a new annotation model. |
Method Summary | |
void |
addAnnotation(Annotation annotation,
Position position)
Adds a annotation to this annotation model. |
protected void |
addAnnotation(Annotation annotation,
Position position,
boolean fireModelChanged)
Adds the given annotation to this model. |
void |
addAnnotationModelListener(IAnnotationModelListener listener)
Registers the annotation model listener with this annotation model. |
protected void |
addPosition(IDocument document,
Position position)
Adds the given position to the default position category of the given document. |
protected void |
cleanup(boolean fireModelChanged)
Removes all annotations from the model whose associated positions have been deleted. |
void |
connect(IDocument document)
Connects the annotation model to a document. |
protected void |
connected()
Hook method. |
void |
disconnect(IDocument document)
Disconnects this model from a document. |
protected void |
disconnected()
Hook method. |
protected void |
fireModelChanged()
Informs all annotation model listeners that this model has been changed. |
protected void |
fireModelChanged(AnnotationModelEvent event)
Informs all annotation model listeners that this model has been changed as described in the annotation model event. |
Iterator |
getAnnotationIterator()
Returns all annotations managed by this model. |
protected Iterator |
getAnnotationIterator(boolean cleanup)
Returns all annotations managed by this model. |
Position |
getPosition(Annotation annotation)
Returns the position associated with the given annotation. |
void |
removeAllAnnotations()
Removes all annotations from the annotation model and informs all model listeners about this change. |
protected void |
removeAllAnnotations(boolean fireModelChanged)
Removes all annotations from the annotation model. |
void |
removeAnnotation(Annotation annotation)
Removes the given annotation from the model. |
protected void |
removeAnnotation(Annotation annotation,
boolean fireModelChanged)
Removes the given annotation from the annotation model. |
void |
removeAnnotationModelListener(IAnnotationModelListener listener)
Removes the listener from the model's list of annotation model listeners. |
protected void |
removeAnnotations(List annotations,
boolean fireModelChanged,
boolean modelInitiated)
Removes the given annotations from this model. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Map fAnnotations
protected ArrayList fAnnotationModelListeners
protected IDocument fDocument
Constructor Detail |
public AnnotationModel()
Method Detail |
public void addAnnotation(Annotation annotation, Position position)
IAnnotationModel
addAnnotation
in interface IAnnotationModel
annotation
- the annotation to add, may not be null
position
- the position describing the range covered by this annotation,
may not be null
protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged)
annotation
- the annotation to addposition
- the associate positionpublic void addAnnotationModelListener(IAnnotationModelListener listener)
IAnnotationModel
addAnnotationModelListener
in interface IAnnotationModel
listener
- the listener to be registered, may not be null
protected void addPosition(IDocument document, Position position)
document
- the document to which to add the positionposition
- the position to addpublic void connect(IDocument document)
IAnnotationModel
connect
calls must mention the document the
model is already connected to. An annotation model primarily uses
connect
and disconnect
for reference counting
the document. Reference counting frees the clients from keeping tracker
whether a model has already been connected to a document.
connect
in interface IAnnotationModel
document
- the document the model gets connected to,
may not be null
IAnnotationModel.disconnect(org.eclipse.jface.text.IDocument)
protected void connected()
protected void disconnected()
public void disconnect(IDocument document)
IAnnotationModel
disconnect
in interface IAnnotationModel
document
- the document the model gets disconnected from,
may not be null
for further specification details
protected void fireModelChanged()
protected void fireModelChanged(AnnotationModelEvent event)
IAnnotationModelListenerExtension
.
All other listeners are notified by just calling modelChanged(IAnnotationModel)
.
event
- the event to be sent out to the listenersprotected void removeAnnotations(List annotations, boolean fireModelChanged, boolean modelInitiated)
modelInitiated
indicates whether the deletion has
been initiated by this model or by one of its clients.
annotations
- the annotations to be removedfireModelChanged
- indicates whether to notify all model listenersmodelInitiated
- indicates whether this changes has been initiated by this modelprotected void cleanup(boolean fireModelChanged)
fireModelChanged
- indicates whether to notify all model listenerspublic Iterator getAnnotationIterator()
IAnnotationModel
getAnnotationIterator
in interface IAnnotationModel
protected Iterator getAnnotationIterator(boolean cleanup)
cleanup
indicates whether all annotations whose associated positions are
deleted should previously be removed from the model.
cleanup
- indicates whether annotations with deleted associated positions are removed
public Position getPosition(Annotation annotation)
IAnnotationModel
getPosition
in interface IAnnotationModel
annotation
- the annotation whose position should be returned
null
if no
associated annotation existspublic void removeAllAnnotations()
protected void removeAllAnnotations(boolean fireModelChanged)
fireModelChanged
- indicates whether to notify all model listenerspublic void removeAnnotation(Annotation annotation)
IAnnotationModel
removeAnnotation
in interface IAnnotationModel
annotation
- the annotation to be removed from this model,
may not be null
protected void removeAnnotation(Annotation annotation, boolean fireModelChanged)
annotation
- the annotation to be removedfireModelChanged
- indicates whether to notify all model listenerspublic void removeAnnotationModelListener(IAnnotationModelListener listener)
IAnnotationModel
removeAnnotationModelListener
in interface IAnnotationModel
listener
- the listener to be removed, may not be null
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |