1) Remove the empty root node from PHPVariable list.
authorrobekras <robekras>
Tue, 8 Nov 2005 19:32:32 +0000 (19:32 +0000)
committerrobekras <robekras>
Tue, 8 Nov 2005 19:32:32 +0000 (19:32 +0000)
net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java

index 6405a9e..ddcfcb5 100644 (file)
@@ -426,9 +426,16 @@ public class PHPDBGInterface {
                DBGVarList      = evalStr.getVariables ();
 
                if (DBGVarList.size () > 0) {                                                           // Did we get back variables?
-                       PHPVariable var = (PHPVariable) DBGVarList.get (0);             // Yes, then get the first PHPVariable 
+                       PHPVariable var = (PHPVariable) DBGVarList.get (0);             // Yes, then get the first PHPVariable
+                       PHPValue    val = (PHPValue) var.getValue ();           // Get the value
 
-                       if (var.getName ().equals ("")) {                                               // The eclipse variable view cannot handle Variables which have an empty name
+                       if (var.getName ().equals ("")) {                                               // Is the root node an empty node (usually it is)
+                               DBGVarList = val.getChildVariables ();              // Then remove the empty node.
+                                                                                                                                       // With removing the empty root node, it wouldn't be necessary to
+                                                                                                                                       // set the name to an empty string. So the code below is just for
+                                                                                                                                       // info or in case the users want to have the empty root node.
+
+                                                                                                                                       // The eclipse variable view cannot handle Variables which have an empty name
                                                                                                                                        // when it comes to variable tree restore operation. Without a name, no restore!
                                var.setName (" ");                                                              // Give a name to the variable root node. Even if it is only a space :-)
                        }                                                                                                               // TODO the best would be to remove the empty root node, but this would
@@ -465,7 +472,10 @@ public class PHPDBGInterface {
                // Add command data
                DBGPacket.addFrame(DBGFrame1);
 
-               if(proxy.getSocket().isClosed()) return;
+               if (proxy.getSocket ().isClosed ()) {                   // Do we have a socket for DBG communication?
+                       return;                                                                                         //  No, then leave here
+               }
+
                DBGPacket.sendPacket(os);
 
                waitResponse(1000);
@@ -491,7 +501,9 @@ public class PHPDBGInterface {
                // Add command data
                DBGPacket.addFrame(DBGFrame1);
 
-               if(proxy.getSocket().isClosed()) return null;
+               if (proxy.getSocket ().isClosed ()) {                       // Do we have a socket for DBG communication?
+                       return null;                                                                                    //  No, then leave here
+               }
                DBGPacket.sendPacket(os);
 
                waitResponse(1000);