|
Eclipse Platform Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.text.source.AnnotationPainter
Paints decorations for annotations provided by an annotation model and/or highlights them in the associated source viewer.
The annotation painter can be configured with drawing strategies. A drawing strategy defines the visual presentation of a particular type of annotation decoration.
Clients usually instantiate and configure objects of this class.
Nested Class Summary | |
static interface |
AnnotationPainter.IDrawingStrategy
A drawing strategy responsible for drawing a certain decoration. |
static class |
AnnotationPainter.NullStrategy
Drawing strategy that does nothing. |
static class |
AnnotationPainter.SquigglesStrategy
Squiggles drawing strategy. |
Field Summary |
Fields inherited from interface org.eclipse.jface.text.IPainter |
CONFIGURATION, INTERNAL, KEY_STROKE, MOUSE_BUTTON, SELECTION, TEXT_CHANGE |
Constructor Summary | |
AnnotationPainter(ISourceViewer sourceViewer,
IAnnotationAccess access)
Creates a new annotation painter for the given source viewer and with the given annotation access. |
Method Summary | |
void |
addAnnotationType(Object annotationType)
Adds the given annotation type to the list of annotation types whose annotations should be painted by this painter using squiggly drawing. |
void |
addAnnotationType(Object annotationType,
Object drawingStrategyID)
Adds the given annotation type to the list of annotation types whose annotations should be painted by this painter using the given drawing strategy. |
void |
addDrawingStrategy(Object id,
AnnotationPainter.IDrawingStrategy strategy)
Registers a new drawing strategy under the given ID. |
void |
addHighlightAnnotationType(Object annotationType)
Adds the given annotation type to the list of annotation types whose annotations should be highlighted this painter. |
void |
applyTextPresentation(TextPresentation tp)
This method is called when a text presentation is about to be applied to the text viewer. |
void |
deactivate(boolean redraw)
Deactivates this painter. |
void |
dispose()
Disposes this painter. |
protected IAnnotationModel |
findAnnotationModel(ISourceViewer sourceViewer)
Retrieves the annotation model from the given source viewer. |
boolean |
isPaintingAnnotations()
Returns whether the list of annotation types whose annotations are painted by this painter contains at least on element. |
protected boolean |
isRepaintReason(int reason)
Returns whether the given reason causes a repaint. |
void |
modelChanged(AnnotationModelEvent event)
Called if a model change occurred on the given model. |
void |
modelChanged(IAnnotationModel model)
Called if a model change occurred on the given model. |
void |
paint(int reason)
Requests this painter to repaint because of the given reason. |
void |
paintControl(PaintEvent event)
Sent when a paint event occurs for the control. |
void |
removeAllAnnotationTypes()
Clears the list of annotation types whose annotations are painted by this painter. |
void |
removeAnnotationType(Object annotationType)
Removes the given annotation type from the list of annotation types whose annotations are painted by this painter. |
void |
removeHighlightAnnotationType(Object annotationType)
Removes the given annotation type from the list of annotation types whose annotations are highlighted by this painter. |
void |
setAnnotationTypeColor(Object annotationType,
Color color)
Sets the color in which the squiggly for the given annotation type should be drawn. |
void |
setPositionManager(IPaintPositionManager manager)
Sets the paint position manager that can be used by this painter or removes any previously set paint position manager. |
protected boolean |
skip(Annotation annotation)
Should the given annotation be skipped when handling draw requests? |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AnnotationPainter(ISourceViewer sourceViewer, IAnnotationAccess access)
sourceViewer
- the source viewer for this painteraccess
- the annotation access for this painterMethod Detail |
public void applyTextPresentation(TextPresentation tp)
ITextPresentationListener
applyTextPresentation
in interface ITextPresentationListener
tp
- the current text presentationpublic void modelChanged(IAnnotationModel model)
IAnnotationModelListener
Replaced by IAnnotationModelListenerExtension.modelChanged(AnnotationModelEvent)
.
modelChanged
in interface IAnnotationModelListener
model
- the changed annotation modelpublic void modelChanged(AnnotationModelEvent event)
IAnnotationModelListenerExtension
modelChanged
in interface IAnnotationModelListenerExtension
event
- the event to be sent outpublic void setAnnotationTypeColor(Object annotationType, Color color)
annotationType
- the annotation typecolor
- the colorpublic void addAnnotationType(Object annotationType)
annotationType
- the annotation typepublic void addAnnotationType(Object annotationType, Object drawingStrategyID)
TODO This is new API and subject to change.
annotationType
- the annotation typedrawingStrategyID
- the id of the drawing strategy that should be used for this annotation typepublic void addDrawingStrategy(Object id, AnnotationPainter.IDrawingStrategy strategy)
id
, the old strategy gets replaced.
The given id can be referenced when adding annotation types, see
addAnnotationType(Object, Object)
.
TODO This is new API and subject to change.
id
- the identifier under which the strategy can be referenced, not null
strategy
- the new strategypublic void addHighlightAnnotationType(Object annotationType)
annotationType
- the annotation typepublic void removeAnnotationType(Object annotationType)
annotationType
- the annotation typepublic void removeHighlightAnnotationType(Object annotationType)
annotationType
- the annotation typepublic void removeAllAnnotationTypes()
public boolean isPaintingAnnotations()
true
if there is an annotation type whose annotations are paintedpublic void dispose()
IPainter
dispose
in interface IPainter
IPainter.deactivate(boolean)
public void paintControl(PaintEvent event)
PaintListener
paintControl
in interface PaintListener
event
- an event containing information about the paintprotected boolean skip(Annotation annotation)
annotation
- the annotation
true
iff the given annotation should be
skipped when handling draw requestspublic void deactivate(boolean redraw)
IPainter
redraw
indicates whether the painter
should remove any decoration it previously applied. A deactivated painter
can be reactivated by calling paint
.
deactivate
in interface IPainter
redraw
- true
if any previously applied decoration
should be removedIPainter.paint(int)
protected boolean isRepaintReason(int reason)
reason
- the reason
true
if repaint reason, false
otherwiseprotected IAnnotationModel findAnnotationModel(ISourceViewer sourceViewer)
sourceViewer
- the source viewer
null
if none can be foundpublic void paint(int reason)
IPainter
paint
in interface IPainter
reason
- the repaint reason, value is one of the constants defined
in this interfacepublic void setPositionManager(IPaintPositionManager manager)
IPainter
setPositionManager
in interface IPainter
manager
- the paint position manager or null
|
Eclipse Platform Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.