Modified: 1764120 - Variables View doesn't show global vars in class context
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.core / src / net / sourceforge / phpdt / internal / debug / core / model / PHPStackFrame.java
index dcd372e..c9cde49 100644 (file)
@@ -14,11 +14,12 @@ package net.sourceforge.phpdt.internal.debug.core.model;
 import java.util.Arrays;
 import java.util.Vector;
 
+import net.sourceforge.phpdt.internal.debug.core.PHPDBGBase;
 import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy;
 
+import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.debug.core.DebugEvent;
 import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.model.IDebugTarget;
 import org.eclipse.debug.core.model.IRegisterGroup;
@@ -31,20 +32,21 @@ import org.eclipse.debug.core.model.IVariable;
  * TODO Remove the variables array and use only the varList vector
  *      Have also to change hasVariables
  */
-public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Comparable{
-
-       private PHPThread               thread;                         // The thread to which this stackframe belongs
-       private String                  file;               // The file name???
-       private int                     lineNumber;         //
-       private int                     index;              //
-       private int                     modno;              //
-       private PHPVariable[]   variables;          // The array of variables TODO: better introduce a vector?
-       private Vector          varList  = new Vector ();
-       private String                  description;        // The source file name with the full path on target/remote system
-       private boolean         fUpToDate;          // Indicates whether the variable list within this stackframe is
-                                                                                               // up-to-date
-       private boolean         fAvailable;         // Needed when updating the stackframe list, shows whether the stackframe
-                                                                                               // is within the list which was received from dbg
+public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Comparable {
+
+       private PHPThread               thread;                                 // The thread to which this stackframe belongs
+       private String          file;                                   // The file name???
+       private int                     lineNumber;
+       private int                     index;
+       private int                     modno;
+       private int                     scope_id;                               // scope id
+       private PHPVariable[]   variables;                              // The array of variables TODO: better introduce a vector?
+       private Vector          varList = new Vector();
+       private String          description;                    // The source file name with the full path on target/remote system
+       private boolean                 fUpToDate;                              // Indicates whether the variable list within this stackframe is
+                                                                                                       // up-to-date
+       private boolean                 fAvailable;                     // Needed when updating the stackframe list, shows whether the stackframe
+                                                                                                       // is within the list which was received from dbg
 
        /**
         *
@@ -54,17 +56,20 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa
         * @param index
         * @param desc
         * @param modno
+        * @param scope_id
         */
-       public PHPStackFrame (PHPThread thread, String file, int line, int index, String desc, int modno) {
-               super (null);
+       public PHPStackFrame(PHPThread thread, String file, int line, int index,
+                       String desc, int modno, int scope_id) {
+               super(null);
 
-               this.lineNumber  = line;
-               this.index           = index;
-               this.file            = file;
-               this.thread      = thread;
+               this.lineNumber = line;
+               this.index = index;
+               this.file = file;
+               this.thread = thread;
                this.description = desc;
-               this.modno               = modno;
-               this.fUpToDate   = false;
+               this.modno = modno;
+               this.scope_id = scope_id;
+               this.fUpToDate = false;
        }
 
        /**
@@ -85,6 +90,22 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa
        }
 
        /**
+        * 
+        * @return scope id
+        */
+       public int getScopeID() {
+               return scope_id;
+       }
+
+       /**
+        * 
+        */
+       public void setScopeID(int scope_id) {
+               this.scope_id = scope_id;
+               setUpToDate(false);
+       }
+
+       /**
         *
         */
        public IThread getThread () {
@@ -294,7 +315,6 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa
                }
        }
 
-
        /**
         *
         * This function returns the array of PHPVariables for this stackframe
@@ -308,12 +328,12 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa
         * @return The array of PHPVariables for this stackframe.
         */
        public IVariable[] getVariables() throws DebugException {
-               if (!isUpToDate ()) {
-                       resetHasChangedInfo (varList);
-                       updateVariableList (varList, this.getPHPDBGProxy ().readVariables (this));
-                       setUpToDate (true);
+               if (!isUpToDate()) {
+                       resetHasChangedInfo(varList);
+                       updateVariableList(varList, this.getPHPDBGProxy().readVariables(this));
+                       setUpToDate(true);
 
-                       variables = (PHPVariable[]) varList.toArray (new PHPVariable[varList.size ()]);
+                       variables = (PHPVariable[]) varList.toArray(new PHPVariable[varList.size()]);
                        Arrays.sort(variables, new PHPVariableComparator());
                }
 
@@ -513,8 +533,8 @@ public class PHPStackFrame extends PHPDebugElement implements IStackFrame, Compa
                thread.prepareForResume (DebugEvent.STEP_RETURN);
                this.getPHPDBGProxy ().readStepReturnEnd (PHPStackFrame.this) ;
 
-               ev = new DebugEvent (this.getThread (), DebugEvent.RESUME, DebugEvent.STEP_RETURN);
-               DebugPlugin.getDefault ().fireDebugEventSet (new DebugEvent[] { ev });
+               //ev = new DebugEvent (this.getThread (), DebugEvent.RESUME, DebugEvent.STEP_RETURN);
+               //DebugPlugin.getDefault ().fireDebugEventSet (new DebugEvent[] { ev });
        }