org.eclipse.cdt.internal.ui
Class LineBackgroundPainter

java.lang.Object
  extended by org.eclipse.cdt.internal.ui.LineBackgroundPainter
All Implemented Interfaces:
java.util.EventListener, org.eclipse.jface.text.IPainter, org.eclipse.swt.custom.LineBackgroundListener, org.eclipse.swt.internal.SWTEventListener

public class LineBackgroundPainter
extends java.lang.Object
implements org.eclipse.jface.text.IPainter, org.eclipse.swt.custom.LineBackgroundListener

A painter for configurable background painting a range of text lines. Replicates also the functionality of the CursorLinePainter because only one LineBackgroundListener is allowed per StyledText widget.

Since:
4.0
Author:
anton.leherbauer@windriver.com

Field Summary
 
Fields inherited from interface org.eclipse.jface.text.IPainter
CONFIGURATION, INTERNAL, KEY_STROKE, MOUSE_BUTTON, SELECTION, TEXT_CHANGE
 
Constructor Summary
LineBackgroundPainter(org.eclipse.jface.text.ITextViewer textViewer)
          Creates a new painter for the given text viewer.
 
Method Summary
 void addHighlightPositions(java.util.List positions)
          Add highlight positions.
 void deactivate(boolean redraw)
           
 void dispose()
           
 void enableCursorLine(boolean enable)
          Enable/disable cursor line highlighting.
 boolean isDisposed()
          Query whether this painter is already disposed.
 void lineGetBackground(org.eclipse.swt.custom.LineBackgroundEvent event)
           
 void paint(int reason)
           
 void redraw()
          Trigger redraw of managed positions.
 void removeHighlightPositions(java.util.List positions)
          Remove highlight positions by identity.
 void replaceHighlightPositions(java.util.List removePositions, java.util.List addPositions)
          Replace given highlight positions in one step.
 void setBackgroundColor(java.lang.String positionType, org.eclipse.swt.graphics.Color color)
          Sets the color in which to draw the background of the given position type.
 void setCursorLineColor(org.eclipse.swt.graphics.Color cursorLineColor)
          Sets the color in which to draw the background of the cursor line.
 void setDefaultColor(org.eclipse.swt.graphics.Color color)
          Sets the color in which to draw the background of untyped positions.
 void setHighlightPositions(java.util.List positions)
          Set highlight positions.
 void setPositionManager(org.eclipse.jface.text.IPaintPositionManager manager)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineBackgroundPainter

public LineBackgroundPainter(org.eclipse.jface.text.ITextViewer textViewer)
Creates a new painter for the given text viewer.

Parameters:
textViewer -
Method Detail

setBackgroundColor

public void setBackgroundColor(java.lang.String positionType,
                               org.eclipse.swt.graphics.Color color)
Sets the color in which to draw the background of the given position type.

Parameters:
positionType - the position type for which to specify the background color
color - the color in which to draw the background of the given position type

setCursorLineColor

public void setCursorLineColor(org.eclipse.swt.graphics.Color cursorLineColor)
Sets the color in which to draw the background of the cursor line.

Parameters:
cursorLineColor - the color in which to draw the background of the cursor line

setDefaultColor

public void setDefaultColor(org.eclipse.swt.graphics.Color color)
Sets the color in which to draw the background of untyped positions.

Parameters:
color - the color in which to draw the background of untyped positions

enableCursorLine

public void enableCursorLine(boolean enable)
Enable/disable cursor line highlighting.

Parameters:
enable -

setHighlightPositions

public void setHighlightPositions(java.util.List positions)
Set highlight positions. It is assumed that all positions are up-to-date with respect to the text viewer document.

Parameters:
positions - a list of Positions

addHighlightPositions

public void addHighlightPositions(java.util.List positions)
Add highlight positions. It is assumed that all positions are up-to-date with respect to the text viewer document.

Parameters:
positions - a list of Positions

removeHighlightPositions

public void removeHighlightPositions(java.util.List positions)
Remove highlight positions by identity.

Parameters:
positions - a list of Positions

replaceHighlightPositions

public void replaceHighlightPositions(java.util.List removePositions,
                                      java.util.List addPositions)
Replace given highlight positions in one step.

Parameters:
removePositions - a list of Positions to remove
addPositions - a list of Positions to add

redraw

public void redraw()
Trigger redraw of managed positions.


dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.jface.text.IPainter

isDisposed

public boolean isDisposed()
Query whether this painter is already disposed.

Returns:
true if the painter is disposed

paint

public void paint(int reason)
Specified by:
paint in interface org.eclipse.jface.text.IPainter

deactivate

public void deactivate(boolean redraw)
Specified by:
deactivate in interface org.eclipse.jface.text.IPainter

setPositionManager

public void setPositionManager(org.eclipse.jface.text.IPaintPositionManager manager)
Specified by:
setPositionManager in interface org.eclipse.jface.text.IPainter

lineGetBackground

public void lineGetBackground(org.eclipse.swt.custom.LineBackgroundEvent event)
Specified by:
lineGetBackground in interface org.eclipse.swt.custom.LineBackgroundListener