Eclipse Platform
2.1

org.eclipse.jface.text.source
Class AnnotationPainter

java.lang.Object
  |
  +--org.eclipse.jface.text.source.AnnotationPainter
All Implemented Interfaces:
EventListener, IAnnotationModelListener, IPainter, PaintListener, org.eclipse.swt.internal.SWTEventListener

public class AnnotationPainter
extends Object
implements IPainter, PaintListener, IAnnotationModelListener

Paints annotations provided by an annotation model as squigglies onto an associated source viewer. Clients usually instantiate and configure objects of this class.

Since:
2.1

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.
 void deactivate(boolean redraw)
          Deactivates this painter.
 void dispose()
          Disposes this painter.
 boolean isPaintingAnnotations()
          Returns whether the list of annotation types whose annotations are painted by this painter contains at least on element.
 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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationPainter

public AnnotationPainter(ISourceViewer sourceViewer,
                         IAnnotationAccess access)
Creates a new annotation painter for the given source viewer and with the given annotation access. The painter is uninitialized, i.e. no annotation types are configured to be painted.
Parameters:
sourceViewer - the source viewer for this painter
access - the annotation access for this painter
Method Detail

modelChanged

public void modelChanged(IAnnotationModel model)
Description copied from interface: IAnnotationModelListener
Called if a model change occurred on the given model.
Specified by:
modelChanged in interface IAnnotationModelListener
Following copied from interface: org.eclipse.jface.text.source.IAnnotationModelListener
Parameters:
model - the changed annotation model

setAnnotationTypeColor

public void setAnnotationTypeColor(Object annotationType,
                                   Color color)
Sets the color in which the squiggly for the given annotation type should be drawn.
Parameters:
annotationType - the annotation type
color - the color

addAnnotationType

public void addAnnotationType(Object annotationType)
Adds the given annotation type to the list of annotation types whose annotations should be painted by this painter. If the annotation type is already in this list, this method is without effect.
Parameters:
annotationType - the annotation type

removeAnnotationType

public void removeAnnotationType(Object annotationType)
Removes the given annotation type from the list of annotation types whose annotations are painted by this painter. If the annotation type is not in this list, this method is wihtout effect.
Parameters:
annotationType - the annotation type

removeAllAnnotationTypes

public void removeAllAnnotationTypes()
Clears the list of annotation types whose annotations are painted by this painter.

isPaintingAnnotations

public boolean isPaintingAnnotations()
Returns whether the list of annotation types whose annotations are painted by this painter contains at least on element.
Returns:
true if there is an annotation type whose annotations are painted

dispose

public void dispose()
Description copied from interface: IPainter
Disposes this painter. Prior to disposing, a painter should be deactivated. A disposed painter can not be reactivated.
Specified by:
dispose in interface IPainter
Following copied from interface: org.eclipse.jface.text.IPainter
See Also:
IPainter.deactivate(boolean)

paintControl

public void paintControl(PaintEvent event)
Description copied from interface: PaintListener
Sent when a paint event occurs for the control.
Specified by:
paintControl in interface PaintListener
Following copied from interface: org.eclipse.swt.events.PaintListener
Parameters:
e - an event containing information about the paint

deactivate

public void deactivate(boolean redraw)
Description copied from interface: IPainter
Deactivates this painter. If the painter has not been activated before, this call does not have any effect. redraw indicates whether the painter should remove any decoration it previously applied. A deactivated painter can be reactivated by calling paint.
Specified by:
deactivate in interface IPainter
Following copied from interface: org.eclipse.jface.text.IPainter
Parameters:
redraw - true if any previously applied decoration should be removed
See Also:
IPainter.paint(int)

paint

public void paint(int reason)
Description copied from interface: IPainter
Requests this painter to repaint because of the given reason. Based on the given reason the painter can decide whether it will repaint or not. If it repaints and is not yet activated, it wil activate itself.
Specified by:
paint in interface IPainter
Following copied from interface: org.eclipse.jface.text.IPainter
Parameters:
reason - the repaint reason, value is one of the constants defined in this interface

setPositionManager

public void setPositionManager(IPaintPositionManager manager)
Description copied from interface: IPainter
Sets the paint position manager that can be used by this painter or removes any previously set paint position manager.
Specified by:
setPositionManager in interface IPainter
Following copied from interface: org.eclipse.jface.text.IPainter
Parameters:
manager - the paint position manager or null

Eclipse Platform
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.