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

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

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

Superclasses all DebugActions that are associated with specific OpenDefinitionsDocuments.

Version:
$Id: DocumentDebugAction.java 4422 2008-03-27 15:08:58Z rcartwright $

Field Summary
protected  String _className
           
protected  OpenDefinitionsDocument _doc
           
protected  String _exactClassName
           
protected  File _file
           
protected  int _offset
           
 int SHORT_DOC_MAX_LENGTH
           
 
Fields inherited from class edu.rice.cs.drjava.model.debug.jpda.DebugAction
_countFilter, _isEnabled, _lineNumber, _manager, _requests, _suspendPolicy, ANY_LINE
 
Constructor Summary
DocumentDebugAction(JPDADebugger manager, OpenDefinitionsDocument doc, int offset)
          Creates a new DocumentDebugAction.
 
Method Summary
protected abstract  void _createRequests(Vector<com.sun.jdi.ReferenceType> refTypes)
          Creates appropriate EventRequests from the EventRequestManager and stores them in the _requests field.
protected  void _initializeRequests(Vector<com.sun.jdi.ReferenceType> refTypes)
          This should always be called from the constructor of the subclass.
protected  void _prepareRequest(T request)
          Prepares this EventRequest with the current stored values.
 boolean createRequests(Vector<com.sun.jdi.ReferenceType> refTypes)
          Creates EventRequests corresponding to this DebugAction, using the given ReferenceTypes.
 String getClassName()
          Returns the class name this DebugAction occurs in.
 OpenDefinitionsDocument getDocument()
          Returns the document this DebugAction occurs in.
 String getExactClassName()
           
 File getFile()
          Returns the file this DebugAction occurs in.
 int getOffset()
           
 
Methods inherited from class edu.rice.cs.drjava.model.debug.jpda.DebugAction
_createRequests, _initializeRequests, _prepareRequests, createRequests, getLineNumber, getRequests, isEnabled, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_className

protected volatile String _className

_exactClassName

protected volatile String _exactClassName

_file

protected volatile File _file

_doc

protected volatile OpenDefinitionsDocument _doc

_offset

protected int _offset

SHORT_DOC_MAX_LENGTH

public final int SHORT_DOC_MAX_LENGTH
See Also:
Constant Field Values
Constructor Detail

DocumentDebugAction

public DocumentDebugAction(JPDADebugger manager,
                           OpenDefinitionsDocument doc,
                           int offset)
                    throws DebugException
Creates a new DocumentDebugAction. 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
doc - Document this action corresponds to
offset - Offset into the document that the action affects
Throws:
DebugException
Method Detail

getClassName

public String getClassName()
Returns the class name this DebugAction occurs in.


getFile

public File getFile()
Returns the file this DebugAction occurs in.


getDocument

public OpenDefinitionsDocument getDocument()
Returns the document this DebugAction occurs in.


getOffset

public int getOffset()
Returns:
offset of this debug action.

getExactClassName

public String getExactClassName()
Returns:
exact class name, or null if not available.

createRequests

public boolean createRequests(Vector<com.sun.jdi.ReferenceType> refTypes)
                       throws DebugException
Creates EventRequests corresponding to this DebugAction, using the given ReferenceTypes. This is called either from the DebugAction constructor or the PendingRequestManager, depending on when the ReferenceTypes become available. (There may be multiple reference types for the same class if a custom class loader is used.)

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

_initializeRequests

protected void _initializeRequests(Vector<com.sun.jdi.ReferenceType> refTypes)
                            throws DebugException
This should always be called from the constructor of the subclass. Attempts to create EventRequests on the given ReferenceTypes, and also adds this action to the pending request manager (so identical classes loaded in the future will also have this action).

Throws:
DebugException

_createRequests

protected abstract void _createRequests(Vector<com.sun.jdi.ReferenceType> refTypes)
                                 throws DebugException
Creates appropriate EventRequests from the EventRequestManager and stores them in the _requests field.

Parameters:
refTypes - All (identical) ReferenceTypes to which this action applies. (There may be multiple if a custom class loader is in use.)
Throws:
DebugException - if the requests could not be created.

_prepareRequest

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

Overrides:
_prepareRequest in class DebugAction<T extends com.sun.jdi.request.EventRequest>
Parameters:
request - the EventRequest to prepare