1) Improvements for the XDebug plugin.
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / php / model / XDebugVariable.java
index 553a400..35b04a0 100644 (file)
@@ -20,10 +20,12 @@ import org.w3c.dom.Node;
  * Window - Preferences - Java - Code Style - Code Templates
  */
 public class XDebugVariable extends XDebugElement implements IVariable {
-       private String fName;
-       private XDebugStackFrame fFrame;
+       private String                          fName;
+       private XDebugStackFrame        fFrame;
        private XDebugAbstractValue fValue;
-       private String fFacet;
+       private String                          fFacet;
+       private XDebugVariable          fParent;                // The parent variable (a back link)
+
        
        /**
         * Constructs a variable contained in the given stack frame
@@ -57,10 +59,8 @@ public class XDebugVariable extends XDebugElement implements IVariable {
                        fValue = new XDebugStringValue(frame, property);
                else if (typeName.equals("array") )
                        fValue = new XDebugArrayValue(frame, property);
-               else if (typeName.equals("hash") )
-                       fValue = new XDebugArrayValue(frame, property);
                else if (typeName.equals("object") )
-                       fValue = new XDebugArrayValue(frame, property);
+                       fValue = new XDebugObjectValue(frame, property);
                else if (typeName.equals("resource") )
                        fValue = new XDebugResourceValue(frame, property);
                else
@@ -70,18 +70,15 @@ public class XDebugVariable extends XDebugElement implements IVariable {
        /* (non-Javadoc)
         * @see org.eclipse.debug.core.model.IVariable#getValue()
         */
-       public IValue getValue() throws DebugException {
+       public IValue getValue() {
                return fValue;
        }
        
        /* (non-Javadoc)
         * @see org.eclipse.debug.core.model.IVariable#getName()
         */
-       public String getName() throws DebugException {
-               /*if (fFullName.endsWith("]"))
-                       return fFullName.substring(fFullName.lastIndexOf('['));
-               else*/
-                       return fName;
+       public String getName() {
+               return fName;
        }
        
        /* (non-Javadoc)
@@ -113,6 +110,17 @@ public class XDebugVariable extends XDebugElement implements IVariable {
        public void setValue(IValue value) throws DebugException {
        }
 
+       /**
+        *
+        * @param changed This method is called after a suspend when the list of
+        *                variables is updated, to mark that this variable has a changed
+        *                value. The variable view will show this variable in
+        *                a different color.
+        */
+       public void setValueChanged(boolean changed) {
+               fValue.setChanged(changed);
+       }
+
        /* (non-Javadoc)
         * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
         */
@@ -124,7 +132,7 @@ public class XDebugVariable extends XDebugElement implements IVariable {
         * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
         */
        public boolean verifyValue(String expression) throws DebugException {
-               return fValue.verifyValue(expression);
+               /*return true; */return fValue.verifyValue(expression);
        }
 
        /* (non-Javadoc)
@@ -134,15 +142,6 @@ public class XDebugVariable extends XDebugElement implements IVariable {
                return false;
        }
        
-       /**
-        * Returns the stack frame owning this variable.
-        * 
-        * @return the stack frame owning this variable
-        */
-       /*protected XDebugStackFrame getStackFrame() {
-               return fFrame;
-       }*/
-       
        public String getValueString() throws DebugException {
                return fValue.getValueString();
        }
@@ -150,4 +149,18 @@ public class XDebugVariable extends XDebugElement implements IVariable {
        public String getVisibility() {
                return fFacet;
        }
+       
+       /**
+        *
+        */
+       public XDebugVariable getParent() {
+               return fParent;
+       }
+
+       /**
+        *
+        */
+       public void setParent(XDebugVariable parent) {
+               this.fParent = parent;
+       }
 }
\ No newline at end of file