2 * Created on 23.11.2004
4 * TODO To change the template for this generated file go to
5 * Window - Preferences - Java - Code Style - Code Templates
7 package net.sourceforge.phpeclipse.xdebug.core;
9 import org.eclipse.debug.core.DebugException;
10 import org.eclipse.debug.core.model.IBreakpoint;
11 import org.eclipse.debug.core.model.IStackFrame;
12 import org.eclipse.debug.core.model.IThread;
17 * TODO To change the template for this generated type comment go to
18 * Window - Preferences - Java - Code Style - Code Templates
20 public class XDebugThread extends XDebugElement implements IThread {
23 * Breakpoints this thread is suspended at or <code>null</code>
26 private IBreakpoint[] fBreakpoints;
29 * Whether this thread is stepping
31 private boolean fStepping = false;
34 * Constructs a new thread for the given target
38 public XDebugThread(XDebugTarget target) {
43 * @see org.eclipse.debug.core.model.IThread#getStackFrames()
45 public IStackFrame[] getStackFrames() throws DebugException {
47 return ((XDebugTarget)getDebugTarget()).getStackFrames();
49 return new IStackFrame[0];
53 * @see org.eclipse.debug.core.model.IThread#hasStackFrames()
55 public boolean hasStackFrames() throws DebugException {
59 * @see org.eclipse.debug.core.model.IThread#getPriority()
61 public int getPriority() throws DebugException {
65 * @see org.eclipse.debug.core.model.IThread#getTopStackFrame()
67 public IStackFrame getTopStackFrame() throws DebugException {
68 IStackFrame[] frames = getStackFrames();
69 if (frames.length > 0) {
75 * @see org.eclipse.debug.core.model.IThread#getName()
77 public String getName() throws DebugException {
81 * @see org.eclipse.debug.core.model.IThread#getBreakpoints()
83 public IBreakpoint[] getBreakpoints() {
84 if (fBreakpoints == null) {
85 return new IBreakpoint[0];
90 * Sets the breakpoints this thread is suspended at, or <code>null</code>
93 * @param breakpoints the breakpoints this thread is suspended at, or <code>null</code>
96 protected void setBreakpoints(IBreakpoint[] breakpoints) {
97 fBreakpoints = breakpoints;
100 * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
102 public boolean canResume() {
103 return isSuspended();
106 * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
108 public boolean canSuspend() {
109 return !isSuspended();
112 * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
114 public boolean isSuspended() {
115 return getDebugTarget().isSuspended();
118 * @see org.eclipse.debug.core.model.ISuspendResume#resume()
120 public void resume() throws DebugException {
121 getDebugTarget().resume();
124 * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
126 public void suspend() throws DebugException {
127 getDebugTarget().suspend();
130 * @see org.eclipse.debug.core.model.IStep#canStepInto()
132 public boolean canStepInto() {
136 * @see org.eclipse.debug.core.model.IStep#canStepOver()
138 public boolean canStepOver() {
139 return isSuspended();
142 * @see org.eclipse.debug.core.model.IStep#canStepReturn()
144 public boolean canStepReturn() {
148 * @see org.eclipse.debug.core.model.IStep#isStepping()
150 public boolean isStepping() {
154 * @see org.eclipse.debug.core.model.IStep#stepInto()
156 public void stepInto() throws DebugException {
159 * @see org.eclipse.debug.core.model.IStep#stepOver()
161 public void stepOver() throws DebugException {
162 ((XDebugTarget)getDebugTarget()).step();
165 * @see org.eclipse.debug.core.model.IStep#stepReturn()
167 public void stepReturn() throws DebugException {
170 * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
172 public boolean canTerminate() {
173 return !isTerminated();
176 * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
178 public boolean isTerminated() {
179 return getDebugTarget().isTerminated();
182 * @see org.eclipse.debug.core.model.ITerminate#terminate()
184 public void terminate() throws DebugException {
185 getDebugTarget().terminate();
189 * Sets whether this thread is stepping
191 * @param stepping whether stepping
193 protected void setStepping(boolean stepping) {
194 fStepping = stepping;