1) CLASSNAME is specified by the property 'name' == CLASSNAME. When doing it by the...
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / php / model / XDebugThread.java
index 91d1868..2e00970 100644 (file)
@@ -6,11 +6,8 @@
  */
 package net.sourceforge.phpeclipse.xdebug.php.model;
 
-import java.net.MalformedURLException;
-import java.net.URL;
-
 import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils;
-import net.sourceforge.phpeclipse.xdebug.core.xdebug.ResponseListener.XDebugResponse;
+import net.sourceforge.phpeclipse.xdebug.core.xdebug.XDebugResponse;
 
 import org.eclipse.debug.core.DebugEvent;
 import org.eclipse.debug.core.DebugException;
@@ -102,28 +99,14 @@ public class XDebugThread extends XDebugElement implements IThread, IDebugEventS
                Node response = lastResponse.getParentNode();
                NodeList frames = response.getChildNodes();
                XDebugStackFrame[] theFrames = new XDebugStackFrame[frames.getLength()];
+               
                for (int i = 0; i < frames.getLength(); i++) {
                        Node stackNode = frames.item(i);
-                       XDebugStackFrame frame = new XDebugStackFrame(this/*fThread*/, i);
-                       String level =PHPDebugUtils.getAttributeValue(stackNode,"level");
-                       if (!"".equals(level))
-                               frame.setLevel(Integer.parseInt(level));
-       
-                       frame.setType(PHPDebugUtils.getAttributeValue(stackNode,"type"));
                        String fileName=PHPDebugUtils.unescapeString(PHPDebugUtils.getAttributeValue(stackNode,"filename"));
-                       String lineNo=PHPDebugUtils.getAttributeValue(stackNode,"lineno");
+                       String lineNo = PHPDebugUtils.getAttributeValue(stackNode,"lineno");
        
-                       if (!"".equals(lineNo))
-                               frame.setLineNumber(Integer.parseInt(lineNo));
-                       
-                       frame.setWhere(PHPDebugUtils.getAttributeValue(stackNode,"where"));
+                       XDebugStackFrame frame = new XDebugStackFrame(this/*fThread*/, i, /*type*/PHPDebugUtils.getAttributeValue(stackNode,"type"), /*lineno*/Integer.parseInt(lineNo), /*where*/PHPDebugUtils.getAttributeValue(stackNode,"where"), fileName);
                        
-                       try {
-                               frame.setFullName(new URL(fileName));
-                       } catch (MalformedURLException e) {
-                               e.printStackTrace();
-                       }
-               
                        frame.incrementStepCounter();
                        
                        theFrames[i] = frame;
@@ -204,22 +187,22 @@ public class XDebugThread extends XDebugElement implements IThread, IDebugEventS
         * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
         */
        public boolean isSuspended() {
-               return fTarget.isSuspended();
+               return getDebugTarget().isSuspended();
        }
        
        /* (non-Javadoc)
         * @see org.eclipse.debug.core.model.ISuspendResume#resume()
         */
        public void resume() throws DebugException {
-               fBreakpoints=null;
-               fTarget.resume();
+               fBreakpoints = null;
+               getDebugTarget().resume();
        }
        
        /* (non-Javadoc)
         * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
         */
        public void suspend() throws DebugException {
-               fTarget.suspend();
+               getDebugTarget().suspend();
        }
        
        /* (non-Javadoc)
@@ -258,24 +241,24 @@ public class XDebugThread extends XDebugElement implements IThread, IDebugEventS
         * @see org.eclipse.debug.core.model.IStep#stepInto()
         */
        public void stepInto() throws DebugException {
-               fBreakpoints=null;
-               fTarget.step_into();
+               fBreakpoints = null;
+               ((XDebugTarget) getDebugTarget()).step_into();
        }
 
        /* (non-Javadoc)
         * @see org.eclipse.debug.core.model.IStep#stepOver()
         */
        public void stepOver() throws DebugException {
-               fBreakpoints=null;
-               fTarget.step_over();
+               fBreakpoints = null;
+               ((XDebugTarget) getDebugTarget()).step_over();
        }
 
        /* (non-Javadoc)
         * @see org.eclipse.debug.core.model.IStep#stepReturn()
         */
        public void stepReturn() throws DebugException {
-               fBreakpoints=null;
-               fTarget.step_out();
+               fBreakpoints = null;
+               ((XDebugTarget) getDebugTarget()).step_out();
        }
 
        /* (non-Javadoc)
@@ -296,7 +279,7 @@ public class XDebugThread extends XDebugElement implements IThread, IDebugEventS
         * @see org.eclipse.debug.core.model.ITerminate#terminate()
         */
        public void terminate() throws DebugException {
-               fTarget.getDebugConnection().stop();
+               ((XDebugTarget) getDebugTarget()).getDebugConnection().stop();
                fTerminated = true;
        }
        
@@ -321,4 +304,24 @@ public class XDebugThread extends XDebugElement implements IThread, IDebugEventS
        public void removeEventListeners() {
                DebugPlugin.getDefault().removeDebugEventListener(this);
        }
+       
+       /**
+        * Fires a <code>RESUME</code> event for this element with
+        * the given detail.
+        * 
+        * @param detail event detail code
+        */
+       public void fireResumeEvent(int detail) {
+               fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail));
+       }
+
+       /**
+        * Fires a <code>SUSPEND</code> event for this element with
+        * the given detail.
+        * 
+        * @param detail event detail code
+        */
+       public void fireSuspendEvent(int detail) {
+               fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail));
+       }
 }
\ No newline at end of file