com.aptana.ide.debug.internal.core.model
Class JSDebugTarget

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.debug.core.model.DebugElement
          extended by com.aptana.ide.debug.internal.core.model.JSDebugElement
              extended by com.aptana.ide.debug.internal.core.model.JSDebugTarget
All Implemented Interfaces:
IDetailFormattersChangeListener, IJSDebugTarget, org.eclipse.core.runtime.IAdaptable, org.eclipse.debug.core.IBreakpointListener, org.eclipse.debug.core.IBreakpointManagerListener, org.eclipse.debug.core.model.IDebugElement, org.eclipse.debug.core.model.IDebugTarget, org.eclipse.debug.core.model.IDisconnect, org.eclipse.debug.core.model.IMemoryBlockRetrieval, org.eclipse.debug.core.model.IStepFilters, org.eclipse.debug.core.model.ISuspendResume, org.eclipse.debug.core.model.ITerminate

public class JSDebugTarget
extends JSDebugElement
implements IJSDebugTarget, org.eclipse.debug.core.IBreakpointManagerListener, IDetailFormattersChangeListener

Author:
Max Stepanov

Field Summary
protected static int COMMAND_TIMEOUT
          COMMAND_TIMEOUT
static int SOCKET_TIMEOUT
          SOCKET_TIMEOUT
 
Constructor Summary
JSDebugTarget(org.eclipse.debug.core.ILaunch launch, org.eclipse.debug.core.model.IProcess process, HttpServerProcess httpServer, LocalResourceMapper resourceMapper, java.net.Socket socket, boolean debugMode)
          JSDebugTarget
 
Method Summary
 void breakpointAdded(org.eclipse.debug.core.model.IBreakpoint breakpoint)
           
 void breakpointChanged(org.eclipse.debug.core.model.IBreakpoint breakpoint, org.eclipse.core.resources.IMarkerDelta delta)
           
 void breakpointManagerEnablementChanged(boolean enabled)
           
 void breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint breakpoint, org.eclipse.core.resources.IMarkerDelta delta)
           
 boolean canDisconnect()
           
 boolean canResume()
           
 boolean canSuspend()
           
 boolean canTerminate()
           
 java.lang.String computeValueDetails(org.eclipse.debug.core.model.IValue value)
          computeValueDetails
 void detailFormattersChanged()
          detailFormattersChanged
 void disconnect()
           
protected  java.lang.Object evaluateExpression(java.lang.String expression, org.eclipse.debug.core.model.IDebugElement context)
          evaluateExpression
protected  org.eclipse.debug.core.model.IBreakpoint findBreakpointAt(java.lang.String filename, int lineNumber)
          findBreakpointAt
protected  org.eclipse.debug.core.model.IBreakpoint findBreakpointIn(java.lang.String filename, int lineNumber, org.eclipse.debug.core.model.IBreakpoint[] breakpoints)
          findBreakpointIn
protected  org.eclipse.debug.core.model.IVariable findVariable(java.lang.String variableName, org.eclipse.debug.core.model.IDebugElement context)
          findVariable
 java.lang.Object getAdapter(java.lang.Class adapter)
           
 java.lang.String getAttribute(java.lang.String key)
          Returns the value of a client defined attribute.
 org.eclipse.debug.core.model.IDebugTarget getDebugTarget()
           
 org.eclipse.debug.core.ILaunch getLaunch()
           
 org.eclipse.debug.core.model.IMemoryBlock getMemoryBlock(long startAddress, long length)
           
 java.lang.String getName()
           
 org.eclipse.debug.core.model.IProcess getProcess()
           
 java.lang.String[] getStepFilters()
          Returns the list of active step filters in this target.
 org.eclipse.debug.core.model.IThread[] getThreads()
           
 IJSScriptElement[] getTopScriptElements()
          getTopScriptElements
protected  void handleMessage(java.lang.String message)
          handleMessage
 boolean hasThreads()
           
 boolean isDisconnected()
           
 boolean isFilterConstructors()
          Returns whether constructors are filtered when stepping, if step filters are enabled.
 boolean isStepFiltersEnabled()
           
 boolean isSuspended()
           
 boolean isTerminated()
           
protected  org.eclipse.debug.core.model.IVariable[] loadVariables(java.lang.String qualifier)
          loadVariables
 void openURL(java.net.URL url)
          openURL
protected  java.lang.String readMessage()
          readMessage
protected  java.lang.String resolveSourceFile(java.lang.String sourceFile)
          Returns absolute path for local files or leaves path(URL) unchanged
 void resume()
           
protected  void sendCommand(java.lang.String command)
          sendCommand
protected  void sendCommand(java.lang.String reqid, java.lang.String command)
          sendCommand
protected  java.lang.String[] sendCommandAndWait(java.lang.String command)
          sendCommandAndWait
protected  java.lang.String[] sendCommandAndWait(java.lang.String command, java.lang.String reqid)
          sendCommandAndWait
 void setAttribute(java.lang.String key, java.lang.String value)
          Sets the value of a client defined attribute.
 void setFilterConstructors(boolean filter)
          Sets whether to filter constructors when stepping.
 void setStepFilters(java.lang.String[] list)
          Sets the list of active step filters in this target.
 void setStepFiltersEnabled(boolean enabled)
           
protected  java.lang.Object setValue(org.eclipse.debug.core.model.IVariable variable, org.eclipse.debug.core.model.IValue newValue)
          setValue
 boolean supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint breakpoint)
           
 boolean supportsStepFilters()
           
 boolean supportsStorageRetrieval()
           
 void suspend()
           
 void terminate()
           
 
Methods inherited from class com.aptana.ide.debug.internal.core.model.JSDebugElement
getModelIdentifier, throwDebugException, throwDebugException, throwDebugException, throwNotImplemented
 
Methods inherited from class org.eclipse.debug.core.model.DebugElement
fireChangeEvent, fireCreationEvent, fireEvent, fireResumeEvent, fireSuspendEvent, fireTerminateEvent, notSupported, requestFailed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.debug.core.model.IDebugElement
getModelIdentifier
 

Field Detail

SOCKET_TIMEOUT

public static final int SOCKET_TIMEOUT
SOCKET_TIMEOUT

See Also:
Constant Field Values

COMMAND_TIMEOUT

protected static final int COMMAND_TIMEOUT
COMMAND_TIMEOUT

See Also:
Constant Field Values
Constructor Detail

JSDebugTarget

public JSDebugTarget(org.eclipse.debug.core.ILaunch launch,
                     org.eclipse.debug.core.model.IProcess process,
                     HttpServerProcess httpServer,
                     LocalResourceMapper resourceMapper,
                     java.net.Socket socket,
                     boolean debugMode)
              throws org.eclipse.core.runtime.CoreException
JSDebugTarget

Parameters:
launch -
process -
httpServer -
resourceMapper -
socket -
debugMode -
Throws:
org.eclipse.core.runtime.CoreException
Method Detail

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Overrides:
getAdapter in class org.eclipse.debug.core.model.DebugElement
See Also:
IAdaptable.getAdapter(java.lang.Class)

readMessage

protected java.lang.String readMessage()
                                throws java.io.IOException
readMessage

Returns:
String
Throws:
java.io.IOException

handleMessage

protected void handleMessage(java.lang.String message)
handleMessage

Parameters:
message -

sendCommand

protected void sendCommand(java.lang.String command)
                    throws org.eclipse.debug.core.DebugException
sendCommand

Parameters:
command -
Throws:
org.eclipse.debug.core.DebugException

sendCommand

protected void sendCommand(java.lang.String reqid,
                           java.lang.String command)
                    throws org.eclipse.debug.core.DebugException
sendCommand

Parameters:
reqid -
command -
Throws:
org.eclipse.debug.core.DebugException

sendCommandAndWait

protected java.lang.String[] sendCommandAndWait(java.lang.String command)
                                         throws org.eclipse.debug.core.DebugException
sendCommandAndWait

Parameters:
command -
Returns:
String[]
Throws:
org.eclipse.debug.core.DebugException

sendCommandAndWait

protected java.lang.String[] sendCommandAndWait(java.lang.String command,
                                                java.lang.String reqid)
                                         throws org.eclipse.debug.core.DebugException
sendCommandAndWait

Parameters:
command -
reqid -
Returns:
String[]
Throws:
org.eclipse.debug.core.DebugException

getLaunch

public org.eclipse.debug.core.ILaunch getLaunch()
Specified by:
getLaunch in interface org.eclipse.debug.core.model.IDebugElement
Overrides:
getLaunch in class org.eclipse.debug.core.model.DebugElement
See Also:
IDebugElement.getLaunch()

getDebugTarget

public org.eclipse.debug.core.model.IDebugTarget getDebugTarget()
Specified by:
getDebugTarget in interface org.eclipse.debug.core.model.IDebugElement
Overrides:
getDebugTarget in class org.eclipse.debug.core.model.DebugElement
See Also:
IDebugElement.getDebugTarget()

getProcess

public org.eclipse.debug.core.model.IProcess getProcess()
Specified by:
getProcess in interface org.eclipse.debug.core.model.IDebugTarget
See Also:
IDebugTarget.getProcess()

getThreads

public org.eclipse.debug.core.model.IThread[] getThreads()
                                                  throws org.eclipse.debug.core.DebugException
Specified by:
getThreads in interface org.eclipse.debug.core.model.IDebugTarget
Throws:
org.eclipse.debug.core.DebugException
See Also:
IDebugTarget.getThreads()

hasThreads

public boolean hasThreads()
                   throws org.eclipse.debug.core.DebugException
Specified by:
hasThreads in interface org.eclipse.debug.core.model.IDebugTarget
Throws:
org.eclipse.debug.core.DebugException
See Also:
IDebugTarget.hasThreads()

getName

public java.lang.String getName()
                         throws org.eclipse.debug.core.DebugException
Specified by:
getName in interface org.eclipse.debug.core.model.IDebugTarget
Throws:
org.eclipse.debug.core.DebugException
See Also:
IDebugTarget.getName()

supportsBreakpoint

public boolean supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint breakpoint)
Specified by:
supportsBreakpoint in interface org.eclipse.debug.core.model.IDebugTarget
See Also:
IDebugTarget.supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint)

canTerminate

public boolean canTerminate()
Specified by:
canTerminate in interface org.eclipse.debug.core.model.ITerminate
See Also:
ITerminate.canTerminate()

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface org.eclipse.debug.core.model.ITerminate
See Also:
ITerminate.isTerminated()

terminate

public void terminate()
               throws org.eclipse.debug.core.DebugException
Specified by:
terminate in interface org.eclipse.debug.core.model.ITerminate
Throws:
org.eclipse.debug.core.DebugException
See Also:
ITerminate.terminate()

canResume

public boolean canResume()
Specified by:
canResume in interface org.eclipse.debug.core.model.ISuspendResume
See Also:
ISuspendResume.canResume()

canSuspend

public boolean canSuspend()
Specified by:
canSuspend in interface org.eclipse.debug.core.model.ISuspendResume
See Also:
ISuspendResume.canSuspend()

isSuspended

public boolean isSuspended()
Specified by:
isSuspended in interface org.eclipse.debug.core.model.ISuspendResume
See Also:
ISuspendResume.isSuspended()

resume

public void resume()
            throws org.eclipse.debug.core.DebugException
Specified by:
resume in interface org.eclipse.debug.core.model.ISuspendResume
Throws:
org.eclipse.debug.core.DebugException
See Also:
ISuspendResume.resume()

suspend

public void suspend()
             throws org.eclipse.debug.core.DebugException
Specified by:
suspend in interface org.eclipse.debug.core.model.ISuspendResume
Throws:
org.eclipse.debug.core.DebugException
See Also:
ISuspendResume.suspend()

breakpointAdded

public void breakpointAdded(org.eclipse.debug.core.model.IBreakpoint breakpoint)
Specified by:
breakpointAdded in interface org.eclipse.debug.core.IBreakpointListener
See Also:
IBreakpointListener.breakpointAdded(org.eclipse.debug.core.model.IBreakpoint)

breakpointRemoved

public void breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint breakpoint,
                              org.eclipse.core.resources.IMarkerDelta delta)
Specified by:
breakpointRemoved in interface org.eclipse.debug.core.IBreakpointListener
See Also:
IBreakpointListener.breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)

breakpointChanged

public void breakpointChanged(org.eclipse.debug.core.model.IBreakpoint breakpoint,
                              org.eclipse.core.resources.IMarkerDelta delta)
Specified by:
breakpointChanged in interface org.eclipse.debug.core.IBreakpointListener
See Also:
IBreakpointListener.breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)

canDisconnect

public boolean canDisconnect()
Specified by:
canDisconnect in interface org.eclipse.debug.core.model.IDisconnect
See Also:
IDisconnect.canDisconnect()

disconnect

public void disconnect()
                throws org.eclipse.debug.core.DebugException
Specified by:
disconnect in interface org.eclipse.debug.core.model.IDisconnect
Throws:
org.eclipse.debug.core.DebugException
See Also:
IDisconnect.disconnect()

isDisconnected

public boolean isDisconnected()
Specified by:
isDisconnected in interface org.eclipse.debug.core.model.IDisconnect
See Also:
IDisconnect.isDisconnected()

supportsStorageRetrieval

public boolean supportsStorageRetrieval()
Specified by:
supportsStorageRetrieval in interface org.eclipse.debug.core.model.IMemoryBlockRetrieval
See Also:
IMemoryBlockRetrieval.supportsStorageRetrieval()

getMemoryBlock

public org.eclipse.debug.core.model.IMemoryBlock getMemoryBlock(long startAddress,
                                                                long length)
                                                         throws org.eclipse.debug.core.DebugException
Specified by:
getMemoryBlock in interface org.eclipse.debug.core.model.IMemoryBlockRetrieval
Throws:
org.eclipse.debug.core.DebugException
See Also:
IMemoryBlockRetrieval.getMemoryBlock(long, long)

isFilterConstructors

public boolean isFilterConstructors()
Description copied from interface: IJSDebugTarget
Returns whether constructors are filtered when stepping, if step filters are enabled.

Specified by:
isFilterConstructors in interface IJSDebugTarget
Returns:
whether constructors are filtered when stepping
See Also:
IJSDebugTarget.isFilterConstructors()

setFilterConstructors

public void setFilterConstructors(boolean filter)
Description copied from interface: IJSDebugTarget
Sets whether to filter constructors when stepping.

Specified by:
setFilterConstructors in interface IJSDebugTarget
Parameters:
filter - whether to filter constructors when stepping
See Also:
IJSDebugTarget.setFilterConstructors(boolean)

isStepFiltersEnabled

public boolean isStepFiltersEnabled()
Specified by:
isStepFiltersEnabled in interface org.eclipse.debug.core.model.IStepFilters
See Also:
IStepFilters.isStepFiltersEnabled()

setStepFiltersEnabled

public void setStepFiltersEnabled(boolean enabled)
Specified by:
setStepFiltersEnabled in interface org.eclipse.debug.core.model.IStepFilters
See Also:
IStepFilters.setStepFiltersEnabled(boolean)

supportsStepFilters

public boolean supportsStepFilters()
Specified by:
supportsStepFilters in interface org.eclipse.debug.core.model.IStepFilters
See Also:
IStepFilters.supportsStepFilters()

getStepFilters

public java.lang.String[] getStepFilters()
Description copied from interface: IJSDebugTarget
Returns the list of active step filters in this target. The list is a collection of Strings. Each string is the fully qualified name/pattern of a type/package to filter when stepping. For example java.lang.* or java.lang.String.

Specified by:
getStepFilters in interface IJSDebugTarget
Returns:
the list of active step filters, or null
See Also:
IJSDebugTarget.getStepFilters()

setStepFilters

public void setStepFilters(java.lang.String[] list)
Description copied from interface: IJSDebugTarget
Sets the list of active step filters in this target. The list is a collection of Strings. Each string is the fully qualified name/pattern of a type/package to filter when stepping. For example java.lang.* or java.lang.String.

Specified by:
setStepFilters in interface IJSDebugTarget
Parameters:
list - active step filters, or null
See Also:
IJSDebugTarget.setStepFilters(java.lang.String[])

getAttribute

public java.lang.String getAttribute(java.lang.String key)
Description copied from interface: IJSDebugTarget
Returns the value of a client defined attribute.

Specified by:
getAttribute in interface IJSDebugTarget
Parameters:
key - the attribute key
Returns:
value the attribute value, or null if undefined
See Also:
IJSDebugTarget.getAttribute(java.lang.String)

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.String value)
Description copied from interface: IJSDebugTarget
Sets the value of a client defined attribute.

Specified by:
setAttribute in interface IJSDebugTarget
Parameters:
key - the attribute key
value - the attribute value
See Also:
IJSDebugTarget.setAttribute(java.lang.String, java.lang.String)

detailFormattersChanged

public void detailFormattersChanged()
Description copied from interface: IDetailFormattersChangeListener
detailFormattersChanged

Specified by:
detailFormattersChanged in interface IDetailFormattersChangeListener
See Also:
IDetailFormattersChangeListener.detailFormattersChanged()

openURL

public void openURL(java.net.URL url)
             throws org.eclipse.debug.core.DebugException
openURL

Parameters:
url -
Throws:
org.eclipse.debug.core.DebugException

breakpointManagerEnablementChanged

public void breakpointManagerEnablementChanged(boolean enabled)
Specified by:
breakpointManagerEnablementChanged in interface org.eclipse.debug.core.IBreakpointManagerListener
See Also:
IBreakpointManagerListener.breakpointManagerEnablementChanged(boolean)

loadVariables

protected org.eclipse.debug.core.model.IVariable[] loadVariables(java.lang.String qualifier)
                                                          throws org.eclipse.debug.core.DebugException
loadVariables

Parameters:
qualifier -
Returns:
IVariable[]
Throws:
org.eclipse.debug.core.DebugException

evaluateExpression

protected java.lang.Object evaluateExpression(java.lang.String expression,
                                              org.eclipse.debug.core.model.IDebugElement context)
                                       throws org.eclipse.debug.core.DebugException
evaluateExpression

Parameters:
expression -
context -
Returns:
Object
Throws:
org.eclipse.debug.core.DebugException

setValue

protected java.lang.Object setValue(org.eclipse.debug.core.model.IVariable variable,
                                    org.eclipse.debug.core.model.IValue newValue)
                             throws org.eclipse.debug.core.DebugException
setValue

Parameters:
variable -
newValue -
Returns:
Object
Throws:
org.eclipse.debug.core.DebugException

computeValueDetails

public java.lang.String computeValueDetails(org.eclipse.debug.core.model.IValue value)
                                     throws org.eclipse.debug.core.DebugException
Description copied from interface: IJSDebugTarget
computeValueDetails

Specified by:
computeValueDetails in interface IJSDebugTarget
Returns:
String
Throws:
org.eclipse.debug.core.DebugException
See Also:
IJSDebugTarget.computeValueDetails(org.eclipse.debug.core.model.IValue)

findVariable

protected org.eclipse.debug.core.model.IVariable findVariable(java.lang.String variableName,
                                                              org.eclipse.debug.core.model.IDebugElement context)
                                                       throws org.eclipse.debug.core.DebugException
findVariable

Parameters:
variableName -
context -
Returns:
IVariable
Throws:
org.eclipse.debug.core.DebugException

findBreakpointAt

protected org.eclipse.debug.core.model.IBreakpoint findBreakpointAt(java.lang.String filename,
                                                                    int lineNumber)
findBreakpointAt

Parameters:
filename -
lineNumber -
Returns:
IBreakpoint

findBreakpointIn

protected org.eclipse.debug.core.model.IBreakpoint findBreakpointIn(java.lang.String filename,
                                                                    int lineNumber,
                                                                    org.eclipse.debug.core.model.IBreakpoint[] breakpoints)
findBreakpointIn

Parameters:
filename -
lineNumber -
breakpoints -
Returns:
IBreakpoint

resolveSourceFile

protected java.lang.String resolveSourceFile(java.lang.String sourceFile)
Returns absolute path for local files or leaves path(URL) unchanged

Parameters:
sourceFile -
Returns:
String

getTopScriptElements

public IJSScriptElement[] getTopScriptElements()
Description copied from interface: IJSDebugTarget
getTopScriptElements

Specified by:
getTopScriptElements in interface IJSDebugTarget
Returns:
IJSScriptElement[]
See Also:
IJSDebugTarget.getTopScriptElements()