Fix variable view value modification and refactored XDebugAbstractValue and derived...
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / php / model / XDebugVariable.java
index f02a5ec..240ec9c 100644 (file)
@@ -21,7 +21,6 @@ import org.w3c.dom.Node;
  */
 public class XDebugVariable extends XDebugElement implements IVariable {
        private String fName;
-       private String fFullName;
        private XDebugStackFrame fFrame;
        private XDebugAbstractValue fValue;
        private String fFacet;
@@ -33,25 +32,21 @@ public class XDebugVariable extends XDebugElement implements IVariable {
         * @param frame owning stack frame
         * @param name variable name
         */
-       public XDebugVariable(XDebugStackFrame frame, Node property) {
+       public XDebugVariable(XDebugStackFrame frame, Node property) throws DebugException {
+               super((XDebugTarget) frame.getDebugTarget());
                if (frame != null ) {
-                       //super((XDebugTarget) frame.getDebugTarget());
                        fFrame = frame;
                }
 
-               String address = PHPDebugUtils.getAttributeValue(property,"address");
-
                fName = PHPDebugUtils.getAttributeValue(property,"name");
                if ("".equals(fName)) {
-                       fName = address;
+                       fName = PHPDebugUtils.getAttributeValue(property,"address");
                }
                
-               fFullName = PHPDebugUtils.getAttributeValue(property,"fullname");
+               fFacet = PHPDebugUtils.getAttributeValue(property, "facet");
 
                String typeName = PHPDebugUtils.getAttributeValue(property, "type");
 
-               fFacet = PHPDebugUtils.getAttributeValue(property, "facet");
-
                if (typeName.equals("int") ) 
                        fValue = new XDebugIntValue(frame, property);
                else if (typeName.equals("float") ) 
@@ -62,10 +57,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
@@ -83,10 +76,7 @@ public class XDebugVariable extends XDebugElement implements IVariable {
         * @see org.eclipse.debug.core.model.IVariable#getName()
         */
        public String getName() throws DebugException {
-               if (fFullName.endsWith("]"))
-                       return fFullName.substring(fFullName.lastIndexOf('['));
-               else
-                       return fName;
+               return fName;
        }
        
        /* (non-Javadoc)
@@ -107,18 +97,15 @@ public class XDebugVariable extends XDebugElement implements IVariable {
         * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
         */
        public void setValue(String expression) throws DebugException {
-               if(fValue.setValue(expression)) {
-                       
+               if (fFrame.setVariableValue(this, expression)) {
+                       fValue.setValue(expression);
                }
-                       //fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT));
-               //fValue.setValueA(expression);
        }
        
        /* (non-Javadoc)
         * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
         */
        public void setValue(IValue value) throws DebugException {
-               //fValue.setValueB(value);
        }
 
        /* (non-Javadoc)
@@ -132,7 +119,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)
@@ -142,15 +129,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();
        }
@@ -158,12 +136,4 @@ public class XDebugVariable extends XDebugElement implements IVariable {
        public String getVisibility() {
                return fFacet;
        }
-
-       public String toString() {
-               return null;
-       }
-
-       public String getFullName() {
-               return fFullName;
-       }
 }
\ No newline at end of file