edu.rice.cs.drjava.ui
Class JUnitErrorCaretListener

java.lang.Object
  |
  +--edu.rice.cs.drjava.ui.JUnitErrorCaretListener
All Implemented Interfaces:
CaretListener, EventListener

public class JUnitErrorCaretListener
extends Object
implements CaretListener

Listens to the caret in a particular DefinitionsPane and highlights the source containing JUnitErrors as appropriate.

Version:
$Id: JUnitErrorCaretListener.java,v 1.5 2002/09/02 21:24:12 csreis Exp $

Field Summary
private  DefinitionsPane _definitionsPane
           
private  Document _document
           
private  JUnitPanel.JUnitErrorListPane _errorListPane
           
private  JUnitErrorModel _model
           
private  OpenDefinitionsDocument _openDoc
           
private  Position[] _positions
           
private  boolean _shouldHighlight
           
 
Constructor Summary
JUnitErrorCaretListener(OpenDefinitionsDocument doc, JUnitPanel.JUnitErrorListPane errorListPane, DefinitionsPane defPane)
          Constructs a new caret listener to highlight JUnit errors.
 
Method Summary
private  void _highlightErrorInSource(int newIndex)
          Highlights the given error in the source.
 void caretUpdate(CaretEvent evt)
          After each update to the caret, determine if changes in highlighting need to be made.
 OpenDefinitionsDocument getOpenDefDoc()
          Gets the OpenDefinitionsDocument corresponding to this listener.
 void resetErrorModel()
          Resets the JUnitErrorModel after a new test.
 boolean shouldHighlight()
          Indicates that the given error should or should not be highlighted.
 void shouldHighlight(boolean sH)
          Sets whether the given error should or should not be highlighted.
 void updateHighlight(int curPos)
          Update the highlight appropriately.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_openDoc

private final OpenDefinitionsDocument _openDoc

_errorListPane

private final JUnitPanel.JUnitErrorListPane _errorListPane

_definitionsPane

private final DefinitionsPane _definitionsPane

_document

private final Document _document

_model

private JUnitErrorModel _model

_positions

private Position[] _positions

_shouldHighlight

private boolean _shouldHighlight
Constructor Detail

JUnitErrorCaretListener

public JUnitErrorCaretListener(OpenDefinitionsDocument doc,
                               JUnitPanel.JUnitErrorListPane errorListPane,
                               DefinitionsPane defPane)
Constructs a new caret listener to highlight JUnit errors.
Method Detail

getOpenDefDoc

public OpenDefinitionsDocument getOpenDefDoc()
Gets the OpenDefinitionsDocument corresponding to this listener.

resetErrorModel

public void resetErrorModel()
Resets the JUnitErrorModel after a new test.

caretUpdate

public void caretUpdate(CaretEvent evt)
After each update to the caret, determine if changes in highlighting need to be made.
Specified by:
caretUpdate in interface CaretListener

updateHighlight

public void updateHighlight(int curPos)
Update the highlight appropriately.

shouldHighlight

public void shouldHighlight(boolean sH)
Sets whether the given error should or should not be highlighted. Errors without location do not highlight the source.

shouldHighlight

public boolean shouldHighlight()
Indicates that the given error should or should not be highlighted. Errors without location do not highlight the source.

_highlightErrorInSource

private void _highlightErrorInSource(int newIndex)
Highlights the given error in the source.
Parameters:
newIndex - Index into _errors array