Eclipse Platform
2.1

org.eclipse.jface.text
Interface IPainter

All Known Implementing Classes:
CursorLinePainter, MarginPainter, AnnotationPainter, MatchingCharacterPainter

public interface IPainter

A painter is responsible for creating, managing, updating, and removing visual decorations of an ITextViewer. Examples are the highlighting of the cursor line, the print marging, or the highlighting of matching peer characters such as pairs of brackets. Clients may implement this interface. Painters should be registered with a PaintManager. The paint manager tracks several classes of events issued by an ITextViewer and reacts by appropriately invoking the registered painters.

Painters can be activated or deactivated. Usually, painters are initially deactivated and are activated by the first call to their paint method. Painters can be deactivated by calling deactivate. Deactivated painter can be reactivated by calling paint again.

Painters usually have to manage state information. E.g., a painter painting a cursor line highlight must redraw the previous and the actual cursor line in the advent of a change of the cursor position. This state information must usually be adapted to changes of the viewer's content. In order to support this common scenario, the PaintManager gives a painter access to a IPaintPositionUpdater. The painter can use this updater to manage its state information.

Since:
2.1
See Also:
PaintManager

Field Summary
static int CONFIGURATION
          Constant describing the reason of a repaint request: paint manager or painter configuration changed.
static int INTERNAL
          Constant describing the reason of a repaint request: paint manager internal change.
static int KEY_STROKE
          Constant describing the reason of a repaint request: key pressed.
static int MOUSE_BUTTON
          Constant describing the reason of a repaint request: mouse button pressed.
static int SELECTION
          Constant describing the reason of a repaint request: selection changed.
static int TEXT_CHANGE
          Constant describing the reason of a repaint request: text changed.
 
Method Summary
 void deactivate(boolean redraw)
          Deactivates this painter.
 void dispose()
          Disposes this painter.
 void paint(int reason)
          Requests this painter to repaint because of the given reason.
 void setPositionManager(IPaintPositionManager manager)
          Sets the paint position manager that can be used by this painter or removes any previously set paint position manager.
 

Field Detail

SELECTION

public static final int SELECTION
Constant describing the reason of a repaint request: selection changed.

TEXT_CHANGE

public static final int TEXT_CHANGE
Constant describing the reason of a repaint request: text changed.

KEY_STROKE

public static final int KEY_STROKE
Constant describing the reason of a repaint request: key pressed.

MOUSE_BUTTON

public static final int MOUSE_BUTTON
Constant describing the reason of a repaint request: mouse button pressed.

INTERNAL

public static final int INTERNAL
Constant describing the reason of a repaint request: paint manager internal change.

CONFIGURATION

public static final int CONFIGURATION
Constant describing the reason of a repaint request: paint manager or painter configuration changed.
Method Detail

dispose

public void dispose()
Disposes this painter. Prior to disposing, a painter should be deactivated. A disposed painter can not be reactivated.
See Also:
deactivate(boolean)

paint

public void paint(int reason)
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.
Parameters:
reason - the repaint reason, value is one of the constants defined in this interface

deactivate

public void deactivate(boolean redraw)
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.
Parameters:
redraw - true if any previously applied decoration should be removed
See Also:
paint(int)

setPositionManager

public void setPositionManager(IPaintPositionManager manager)
Sets the paint position manager that can be used by this painter or removes any previously set paint position manager.
Parameters:
manager - the paint position manager or null

Eclipse Platform
2.1

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