edu.rice.cs.drjava.model.debug.jpda
Class DebugAction<T extends com.sun.jdi.request.EventRequest>

java.lang.Object
  extended by edu.rice.cs.drjava.model.debug.jpda.DebugAction<T>
Direct Known Subclasses:
DocumentDebugAction, Step

public abstract class DebugAction<T extends com.sun.jdi.request.EventRequest>
extends Object

Keeps track of information about any request to the debugger, such as Breakpoints.

Version:
$Id: DebugAction.java 4419 2008-03-27 06:58:07Z rcartwright $

Field Summary
protected  int _countFilter
           
protected  boolean _isEnabled
           
protected  int _lineNumber
           
protected  JPDADebugger _manager
           
protected  Vector<T> _requests
          Vector of EventRequests.
protected  int _suspendPolicy
           
static int ANY_LINE
           
 
Constructor Summary
DebugAction(JPDADebugger manager)
          Creates a new DebugAction.
 
Method Summary
protected  void _createRequests()
          Creates an appropriate EventRequest from the EventRequestManager and stores it in the _request field.
protected  void _initializeRequests()
          This should always be called from the constructor of the subclass.
protected  void _prepareRequest(T request)
          Prepares this EventRequest with the current stored values.
protected  void _prepareRequests(Vector<T> requests)
          Prepares all relevant EventRequests with the current stored values.
 boolean createRequests()
          Creates an EventRequest corresponding to this DebugAction, using the given ReferenceType.
 int getLineNumber()
          Returns the line number this DebugAction occurs on
 Vector<T> getRequests()
          Returns the EventRequest corresponding to this DebugAction, if it has been created, null otherwise.
 boolean isEnabled()
           
 void setEnabled(boolean isEnabled)
          Enable/disable the breakpoint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_LINE

public static final int ANY_LINE
See Also:
Constant Field Values

_manager

protected final JPDADebugger _manager

_requests

protected final Vector<T extends com.sun.jdi.request.EventRequest> _requests
Vector of EventRequests. There might be more than one, since there can be multiple reference types for one class. They all share the same attributes, though, so the other fields don't need to be vectors.


_suspendPolicy

protected volatile int _suspendPolicy

_isEnabled

protected volatile boolean _isEnabled

_countFilter

protected volatile int _countFilter

_lineNumber

protected volatile int _lineNumber
Constructor Detail

DebugAction

public DebugAction(JPDADebugger manager)
Creates a new DebugAction. Automatically tries to create the EventRequest if a ReferenceType can be found, or else adds this object to the PendingRequestManager. Any subclass should automatically call _initializeRequest in its constructor.

Parameters:
manager - JPDADebugger in charge
Method Detail

getRequests

public Vector<T> getRequests()
Returns the EventRequest corresponding to this DebugAction, if it has been created, null otherwise.


getLineNumber

public int getLineNumber()
Returns the line number this DebugAction occurs on


createRequests

public boolean createRequests()
                       throws DebugException
Creates an EventRequest corresponding to this DebugAction, using the given ReferenceType. This is called either from the DebugAction constructor or the PendingRequestManager, depending on when the ReferenceType becomes available. This DebugAction must be an instance of DocumentDebugAction since a ReferenceType is being used.

Returns:
true if the EventRequest is successfully created
Throws:
DebugException

_initializeRequests

protected void _initializeRequests()
                            throws DebugException
This should always be called from the constructor of the subclass. Tries to create all applicable EventRequests for this DebugAction.

Throws:
DebugException

_createRequests

protected void _createRequests()
                        throws DebugException
Creates an appropriate EventRequest from the EventRequestManager and stores it in the _request field.

Throws:
DebugException - if the request could not be created.

_prepareRequests

protected void _prepareRequests(Vector<T> requests)
Prepares all relevant EventRequests with the current stored values.

Parameters:
requests - the EventRequests to prepare

_prepareRequest

protected void _prepareRequest(T request)
Prepares this EventRequest with the current stored values.

Parameters:
request - the EventRequest to prepare

isEnabled

public boolean isEnabled()
Returns:
true if breakpoint is enabled.

setEnabled

public void setEnabled(boolean isEnabled)
Enable/disable the breakpoint.