Fix variable view value modification and refactored XDebugAbstractValue and derived...
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / php / model / XDebugFloatValue.java
index 8d9dcd6..fd2e709 100644 (file)
@@ -1,35 +1,37 @@
 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 XDebugFloatValue extends XDebugAbstractValue {
+       public XDebugFloatValue(XDebugStackFrame stackFrame, Node value) throws DebugException {
+               super(stackFrame, value);
 
-       public XDebugFloatValue(XDebugVariable variable, Node varNode,String TypeName) {
-               super(variable, varNode,TypeName);
-               
+               if (isValid(rowValue)) {
+                       setValueString(rowValue);
+               }
        }
        
-       public XDebugFloatValue(XDebugVariable variable,String TypeName) {
-               super(variable,TypeName);
-               
-       }
-
-
        public boolean supportsValueModification() {
                return true;
        }
 
-       
-       public void setType(String typeName) {
-               fType=XDebugAbstractValue.VALUETYPE_FLOAT;
-               fTypeName=typeName;
+       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 void renderValueString(String data) {
-               fValueString=data;
+       public boolean verifyValue(String expression) {
+               return isValid(expression);
        }
 
-       public boolean verifyValue(String expression) {
+       private boolean isValid(String expression) {
                try {
                        Float.parseFloat(expression);
                } catch (NumberFormatException e) {
@@ -37,8 +39,4 @@ public class XDebugFloatValue extends XDebugAbstractValue {
                }
                return true;
        }
-
-       /*public String toString() {
-               return null;
-       }*/
-}
+}
\ No newline at end of file