Refactory.
authorincastrix <incastrix>
Fri, 19 Sep 2008 03:46:26 +0000 (03:46 +0000)
committerincastrix <incastrix>
Fri, 19 Sep 2008 03:46:26 +0000 (03:46 +0000)
net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugTarget.java

index ee034ec..2257e84 100644 (file)
@@ -70,7 +70,6 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
         * @param launch containing launch
         * @param process process of the interpreter
         * @param ideKey 
-        * @param pathMap Pathmap for the debug session
         * @exception CoreException if unable to connect to host
         */     
        public XDebugTarget(ILaunch launch, IProcess process, String ideKey) throws CoreException {
@@ -179,8 +178,6 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
                        XDebugCorePlugin.getBreakpointManager().removeBreakpointListener(this);
                        fThread.fireTerminateEvent();
                        DebugPlugin.getDefault().removeDebugEventListener(this);
-                       /*if (fThread!=null)
-                               fThread.removeEventListeners();*/
                }
        }
 
@@ -274,8 +271,6 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
                                                        try {
                                                                if (breakpoint.isEnabled()) {
                                                                        if (marker != null) {
-                                                                               //XDebugResponse dr = fDebugConnection.breakpointSet(newPath.toString(), ((ILineBreakpoint)breakpoint).getLineNumber());
-
                                                                                int id = fDebugConnection.breakpointSet(newPath.toString(), ((ILineBreakpoint)breakpoint).getLineNumber(), marker.getAttribute(XDebugBreakpoint.HIT_COUNT,-1));
                                                                                XDebugResponse dr = getResponse(id);
                                                                                
@@ -395,14 +390,9 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
 
                Integer.parseInt(response.getValue());
                System.out.println("in Target.started()");
-               /*XDebugResponse response = fDebugConnection.featureGet("max_children");
-               String a1 = response.getValue();
-               System.out.println("max children:"+a1);
-               XDebugResponse response1 = fDebugConnection.featureGet("max_children");
-               String a2 = response1.getValue();
-               System.out.println("max depth:"+a2);*/
-               
-               
+
+               // Dirty hack
+               // Need to refactory plugin to get variables in lazy mode.
                int id1 = fDebugConnection.featureSet("max_depth", "1024" );
                XDebugResponse response1 = getResponse(id1);
                if (response1.getAttributeValue("success").equals("1") ) {
@@ -557,17 +547,10 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
                stopListener();
                fDebugConnection.close();
 
-/*             fThread.removeEventListeners();
-               fThread = null;
-               fThreads = new IThread[0];*/
-               
-/*             stopListener();
-               fDebugConnection.close();*/
-
                fSuspended = false;
 
                // Dirty hack to check debugging mode (remote or local)
-               if (fProcess!=null) {
+               if (fProcess != null) {
                        try {
                                terminate();
                        } catch (DebugException e) {
@@ -575,7 +558,7 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
                        }
                } else {
                        fDebugConnection = null;
-                       fThread.fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT));
+                       fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT));
                }
                
                fThread.removeEventListeners();
@@ -587,11 +570,9 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
                setDebugConnection(connection);
                System.out.println("* New Connection - XDebug.Target: " + fDebugConnection.getSessionID());
                
-//             fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CHANGE));
-               
                fThread = new XDebugThread(this);
                fThreads = new IThread[] {fThread};
-               fThread.fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CHANGE));
+               fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CHANGE));
                try {
                        started();
                } catch( DebugException e ){
@@ -619,7 +600,6 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
 
        }
        public Node getLocalVariables(int level) throws DebugException {
-//             XDebugResponse response = fDebugConnection.contextGet(level, 0);
                int id = fDebugConnection.contextGet(level, 0);
                XDebugResponse response = getResponse(id);
                
@@ -627,8 +607,6 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
        }
        
        public Node getGlobalVariables(int level) throws DebugException {
-               //XDebugResponse response = fDebugConnection.contextGet(level, 1);
-
                int id = fDebugConnection.contextGet(level, 1);
                XDebugResponse response = getResponse(id);
                
@@ -665,7 +643,6 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
                                                                        int id = fDebugConnection.breakpointGet(marker.getAttribute(XDebugLineBreakpoint.BREAKPOINT_ID,-1));
                                                                        XDebugResponse dr = getResponse(id);
                                                                        
-                                                                       //String bpid = dr.getAttributeValue("command");                                                                        
                                                                        Node hitCo = dr.getParentNode().getFirstChild();
                                                                        int hitCount = 0;
                                                                        if (hitCo.hasAttributes()) {
@@ -676,7 +653,6 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
                                                                                }
                                                                        }
 
-                                                                       //String hitCount = hitCo.getAttributeValue("hit_count");                                                                       
                                                                        if(PHPDebugUtils.unescapeString(filename).endsWith(endfilename)
                                                                                        && (lineBreakpoint.getLineNumber() == lineNumber) ) {
                                                                                if (marker.getAttribute(XDebugLineBreakpoint.HIT_COUNT, 0) > 0) {
@@ -703,8 +679,8 @@ public class XDebugTarget extends XDebugElement implements IDebugTarget, IDebugE
                fResponseListener.schedule();
        }
        
-       public /*boolean*/ void stopListener() {
-               /*return*/ fResponseListener.cancel(); //done(null); //.cancel();
+       public void stopListener() {
+               fResponseListener.cancel();
        }
        public XDebugResponse getResponse(int id) {
                XDebugResponse response = fResponseListener.getResponse(id);