edu.rice.cs.drjava.model.debug.jpda
Class PendingRequestManager

java.lang.Object
  extended by edu.rice.cs.drjava.model.debug.jpda.PendingRequestManager

public class PendingRequestManager
extends Object

Keeps track of DocumentDebugActions that are waiting to be resolved when the classes they corresponed to are prepared. (Only DocumentDebugActions have reference types which can be prepared.)

Version:
$Id: PendingRequestManager.java 5442 2011-08-16 09:11:12Z rcartwright $

Field Summary
private  JPDADebugger _manager
           
private  HashMap<String,Vector<DocumentDebugAction<?>>> _pendingActions
           
 
Constructor Summary
PendingRequestManager(JPDADebugger manager)
           
 
Method Summary
 void addPendingRequest(DocumentDebugAction<?> action)
          Called if a breakpoint is set before its class is prepared
 void classPrepared(com.sun.jdi.event.ClassPrepareEvent event)
          Called by the EventHandler whenever a ClassPrepareEvent occurs.
 int LLDDALineNum(DocumentDebugAction<?> dda)
          Method to change Language Level line numbers into their java file counterparts
private  boolean recursiveFindLineNumber(int lineNumber, com.sun.jdi.ReferenceType rt)
          Recursively look through all nested types to see if the line number exists.
 void removePendingRequest(DocumentDebugAction<?> action)
          Called if a breakpoint is set and removed before its class is prepared
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_manager

private JPDADebugger _manager

_pendingActions

private HashMap<String,Vector<DocumentDebugAction<?>>> _pendingActions
Constructor Detail

PendingRequestManager

public PendingRequestManager(JPDADebugger manager)
Method Detail

addPendingRequest

public void addPendingRequest(DocumentDebugAction<?> action)
Called if a breakpoint is set before its class is prepared

Parameters:
action - The DebugAction that is pending

removePendingRequest

public void removePendingRequest(DocumentDebugAction<?> action)
Called if a breakpoint is set and removed before its class is prepared

Parameters:
action - The DebugAction that was set and removed

recursiveFindLineNumber

private boolean recursiveFindLineNumber(int lineNumber,
                                        com.sun.jdi.ReferenceType rt)
Recursively look through all nested types to see if the line number exists.

Parameters:
lineNumber - line number to look for
rt - reference type to start at
Returns:
true if line number is found

LLDDALineNum

public int LLDDALineNum(DocumentDebugAction<?> dda)
Method to change Language Level line numbers into their java file counterparts

Parameters:
dda - the DocumentDebugAction whose line needs to be adjusted
Returns:
the correct line number for the .java file

classPrepared

public void classPrepared(com.sun.jdi.event.ClassPrepareEvent event)
                   throws DebugException
Called by the EventHandler whenever a ClassPrepareEvent occurs. This will take the event, get the class that was prepared, lookup the Vector of DebugAction that was waiting for this class's preparation, iterate through this Vector, and attempt to create the Breakpoints that were pending. Since the keys to the Hashtable are the names of the outer class, the $ and everything after it must be cropped off from the class name in order to do the lookup. During the lookup, however, the line number of each action is checked to see if the line number is contained in the given event's ReferenceType. If not, we ignore that pending action since it is not in the class that was just prepared, but may be in one of its inner classes.

Parameters:
event - The ClassPrepareEvent that just occured
Throws:
DebugException