**********************************************************************/
package net.sourceforge.phpdt.internal.debug.core.model;
+import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy;
+
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.core.model.IVariable;
-import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy;
-import net.sourceforge.phpdt.internal.debug.core.model.PHPDebugTarget;
-public class PHPStackFrame implements IStackFrame {
+public class PHPStackFrame extends PHPDebugElement implements IStackFrame {
private PHPThread thread;
private String file;
private String description;
public PHPStackFrame(PHPThread thread, String file, int line, int index, String desc, int modno) {
+ super (null);
this.lineNumber = line;
this.index = index;
this.file = file;
this.thread = thread;
this.description = desc;
this.modno = modno;
- }
-
+ }
+
public PHPStackFrame(PHPThread thread, String file, int line, int index) {
+ super (null);
this.lineNumber = line;
this.index = index;
this.file = file;
this.thread = thread;
- }
-
+ }
+
public IThread getThread() {
return thread;
}
-
+
public void setThread(PHPThread thread) {
this.thread = thread;
}
-
+
public IVariable[] getVariables() throws DebugException {
if (variables == null) {
variables = this.getPHPDBGProxy().readVariables(this);
}
return variables;
}
-
+
public IVariable findVariable(String s) throws DebugException {
if (this.hasVariables()) {
String name="$"+s;
if((variables[i].getName()).equals(name))
return variables[i];
}
- }
+ }
return null;
}
-
+
public boolean hasVariables() throws DebugException {
if (variables == null) {
return false;
}
return variables.length > 0;
}
-
+
public int getLineNumber() {
return lineNumber;
}
-
+
public int getCharStart() throws DebugException {
// not supported
return -1;
}
-
+
public int getCharEnd() throws DebugException {
// not supported
return -1;
}
-
+
public String getName() {
if(!this.getDescription().equals(""))
return this.getDescription() + " [line: " + this.getLineNumber() + "]";
public String getFileName() {
return file;
}
-
+
public void setDescription(String desc) {
this.description= desc;
}
public String getDescription() {
return this.description;
}
-
+
public IRegisterGroup[] getRegisterGroups() throws DebugException {
return null;
}
-
+
public boolean hasRegisterGroups() throws DebugException {
return false;
}
-
+
public String getModelIdentifier() {
return this.getThread().getModelIdentifier();
}
-
+
public IDebugTarget getDebugTarget() {
return this.getThread().getDebugTarget();
}
-
+
public ILaunch getLaunch() {
return this.getDebugTarget().getLaunch();
}
-
+
public boolean canStepInto() {
return canResume();
}
-
+
public boolean canStepOver() {
return canResume();
}
-
+
public boolean canStepReturn() {
return canResume();
}
-
+
public boolean isStepping() {
return false;
}
-
+
public void stepInto() throws DebugException {
thread.prepareForResume() ;
- this.getPHPDBGProxy().readStepIntoEnd(PHPStackFrame.this) ;
+ this.getPHPDBGProxy().readStepIntoEnd(PHPStackFrame.this) ;
DebugEvent ev = new DebugEvent(this.getThread(), DebugEvent.RESUME, DebugEvent.STEP_INTO);
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { ev });
}
-
+
public void stepOver() throws DebugException {
thread.prepareForResume() ;
this.getPHPDBGProxy().readStepOverEnd(PHPStackFrame.this) ;
public void stepReturn() throws DebugException {
thread.prepareForResume() ;
- this.getPHPDBGProxy().readStepReturnEnd(PHPStackFrame.this) ;
+ this.getPHPDBGProxy().readStepReturnEnd(PHPStackFrame.this) ;
DebugEvent ev = new DebugEvent(this.getThread(), DebugEvent.RESUME, DebugEvent.STEP_RETURN);
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { ev });
+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { ev });
}
-
+
public boolean canResume() {
return this.getThread().canResume();
}
-
+
public boolean canSuspend() {
return this.getThread().canSuspend();
}
-
+
public boolean isSuspended() {
return this.getThread().isSuspended();
- }
-
+ }
+
public void resume() throws DebugException {
this.getThread().resume();
}
-
+
public void suspend() throws DebugException {
}
-
+
public boolean canTerminate() {
return this.getThread().canTerminate();
}
-
+
public boolean isTerminated() {
return this.getThread().isTerminated();
- }
-
+ }
+
public void terminate() throws DebugException {
getPHPDBGProxy().stop();
- }
-
- public Object getAdapter(Class arg0) {
- if (arg0==PHPStackFrame.class)
- return this;
- else
- return null;
}
public int getIndex() {
public void setFile(String file) {
this.file = file;
}
-
+
public int getModNo() {
return modno;
}