edu.rice.cs.drjava.model
Class DefaultLightWeightParsingControl

java.lang.Object
  extended by edu.rice.cs.drjava.model.DefaultLightWeightParsingControl
All Implemented Interfaces:
LightWeightParsingControl

public final class DefaultLightWeightParsingControl
extends Object
implements LightWeightParsingControl

Default light-weight parsing control. This class is declared final because it cannot be robustly subclassed because the constructor starts a thread.

Version:
$Id$

Constructor Summary
DefaultLightWeightParsingControl(AbstractGlobalModel model)
          Create the default light-weight parsing control.
 
Method Summary
 void addListener(LightWeightParsingListener l)
          Add the listener to this controller.
 void delay()
          Delay the next update.
 String getEnclosingClassName(OpenDefinitionsDocument doc)
          Return the last enclosing class name for the specified document, "" if not inside a class, or null if unknown.
 List<LightWeightParsingListener> getListeners()
           
 void removeAllListeners()
          Remove all listeners from this controller.
 void removeListener(LightWeightParsingListener l)
          Remove the listener from this controller.
 void reset()
          Reset light-weight parsing.
 void setAutomaticUpdates(boolean b)
          Start or stop automatic updates.
 void update(OpenDefinitionsDocument doc)
          Perform light-weight parsing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLightWeightParsingControl

public DefaultLightWeightParsingControl(AbstractGlobalModel model)
Create the default light-weight parsing control. Starts a new thread.

Parameters:
model - the model
Method Detail

update

public void update(OpenDefinitionsDocument doc)
Perform light-weight parsing.

Specified by:
update in interface LightWeightParsingControl
Parameters:
doc - the document to parse.

setAutomaticUpdates

public void setAutomaticUpdates(boolean b)
Start or stop automatic updates.

Specified by:
setAutomaticUpdates in interface LightWeightParsingControl
Parameters:
b - true to start or false to stop automatic updates

delay

public void delay()
Delay the next update.

Specified by:
delay in interface LightWeightParsingControl

reset

public void reset()
Reset light-weight parsing. Forget everything.

Specified by:
reset in interface LightWeightParsingControl

getEnclosingClassName

public String getEnclosingClassName(OpenDefinitionsDocument doc)
Return the last enclosing class name for the specified document, "" if not inside a class, or null if unknown. WARNING: In long source files and when contained in anonymous inner classes, this function might take a LONG time.

Specified by:
getEnclosingClassName in interface LightWeightParsingControl
Parameters:
doc - the document for which we want the information
Returns:
the enclosing class name

addListener

public void addListener(LightWeightParsingListener l)
Add the listener to this controller.

Specified by:
addListener in interface LightWeightParsingControl
Parameters:
l - listener to add

removeListener

public void removeListener(LightWeightParsingListener l)
Remove the listener from this controller.

Specified by:
removeListener in interface LightWeightParsingControl

removeAllListeners

public void removeAllListeners()
Remove all listeners from this controller.

Specified by:
removeAllListeners in interface LightWeightParsingControl

getListeners

public List<LightWeightParsingListener> getListeners()
Specified by:
getListeners in interface LightWeightParsingControl
Returns:
a copy of the list of listeners.