Fix variable view value modification and refactored XDebugAbstractValue and derived...
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / php / model / XDebugIntValue.java
index 9002c3e..010c2a9 100644 (file)
@@ -1,28 +1,33 @@
 package net.sourceforge.phpeclipse.xdebug.php.model;
 
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
 import org.w3c.dom.Node;
 
 public class XDebugIntValue extends XDebugAbstractValue {
+       public XDebugIntValue(XDebugStackFrame stackFrame, Node value) throws DebugException {
+               super(stackFrame, value);
 
-       public XDebugIntValue(XDebugVariable variable, Node varNode, String TypeName) {
-               super(variable, varNode, TypeName);
-
-       }
-
-       public void setType(String typeName) {
-               fType = XDebugAbstractValue.VALUETYPE_INT;
-               fTypeName = typeName;
+               if (isValid(rowValue)) {
+                       setValueString(rowValue);
+               }
        }
-
+       
        public boolean supportsValueModification() {
                return true;
        }
-
-       public void renderValueString(String dataString) {
-               fValueString = dataString;
+               
+       public boolean setValue(String expression) throws DebugException {
+               if (isValid(expression)) {
+                       setValueString(expression);
+                       fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT));
+                       return true;
+               }
+               
+               return false;
        }
 
-       public boolean verifyValue(String expression) {
+       private boolean isValid(String expression) {
                try {
                        Integer.parseInt(expression);
                } catch (NumberFormatException e) {
@@ -31,8 +36,7 @@ public class XDebugIntValue extends XDebugAbstractValue {
                return true;
        }
 
-       public String toString() {
-               return fValueString;
+       public boolean verifyValue(String expression) {
+               return isValid(expression);
        }
-
-}
+}
\ No newline at end of file