edu.rice.cs.drjava.ui
Class ErrorCaretListener

java.lang.Object
  extended by edu.rice.cs.drjava.ui.ErrorCaretListener
All Implemented Interfaces:
EventListener, CaretListener

public class ErrorCaretListener
extends Object
implements CaretListener

Listens to the caret in the associated DefinitionsPane and highlights the text containing CompilerErrors.

Version:
$Id: ErrorCaretListener.java 5553 2012-05-01 17:28:45Z rcartwright $

Field Summary
private  DefinitionsPane _definitionsPane
           
protected  MainFrame _frame
           
private  OpenDefinitionsDocument _openDoc
           
 
Constructor Summary
ErrorCaretListener(OpenDefinitionsDocument doc, DefinitionsPane defPane, MainFrame frame)
          Constructs a new caret listener to highlight errors.
 
Method Summary
private  void _highlightErrorInSource(Position pos)
          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 removeHighlight()
          Hides the error highlight in the document.
 void updateHighlight(int curPos)
          Update the highlight appropriately.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_openDoc

private final OpenDefinitionsDocument _openDoc

_definitionsPane

private final DefinitionsPane _definitionsPane

_frame

protected final MainFrame _frame
Constructor Detail

ErrorCaretListener

public ErrorCaretListener(OpenDefinitionsDocument doc,
                          DefinitionsPane defPane,
                          MainFrame frame)
Constructs a new caret listener to highlight errors.

Method Detail

getOpenDefDoc

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


caretUpdate

public void caretUpdate(CaretEvent evt)
After each update to the caret, determine if changes in highlighting need to be made. Highlights the line if the compiler output tab is showing. Only runs in the event thread.

Specified by:
caretUpdate in interface CaretListener

updateHighlight

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


removeHighlight

public void removeHighlight()
Hides the error highlight in the document.


_highlightErrorInSource

private void _highlightErrorInSource(Position pos)
Highlights the given error in the source. Only runs in event thread.

Parameters:
pos - the position of the error