Change visibility of net.sourceforge.phpeclipse.xdebug.php.model.XDebugAbstractValue...
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / php / model / XDebugAbstractValue.java
index 9b0a57e..32ea3fa 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * Created on 23.11.2004
+ /* Created on 23.11.2004
  *
  * TODO To change the template for this generated file go to
  * Window - Preferences - Java - Code Style - Code Templates
@@ -9,6 +8,7 @@ package net.sourceforge.phpeclipse.xdebug.php.model;
 import net.sourceforge.phpeclipse.xdebug.core.Base64;
 import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils;
 
+import org.eclipse.debug.core.DebugEvent;
 import org.eclipse.debug.core.DebugException;
 import org.eclipse.debug.core.model.IValue;
 import org.eclipse.debug.core.model.IVariable;
@@ -21,14 +21,15 @@ import org.w3c.dom.NodeList;
  * TODO To change the template for this generated type comment go to
  * Window - Preferences - Java - Code Style - Code Templates
  */
+
 public abstract class XDebugAbstractValue  extends XDebugElement implements IValue {
        private IVariable[] fVariables;
-       protected String fValueString;
-       protected String fTypeName;
+       private String fValueString;
+       private String fTypeName;
        private boolean fhasChanged;
 
-       public XDebugAbstractValue(XDebugStackFrame frame, Node varNode)  {
-               super((XDebugTarget) frame.getDebugTarget());
+       public XDebugAbstractValue(XDebugStackFrame frame, Node varNode) throws DebugException  {
+               super(frame == null ? null : (XDebugTarget) frame.getDebugTarget());
 
                fTypeName = PHPDebugUtils.getAttributeValue(varNode,"type");
 
@@ -37,8 +38,8 @@ public abstract class XDebugAbstractValue  extends XDebugElement implements IVal
                        NumChildren = Integer.parseInt(PHPDebugUtils.getAttributeValue(varNode, "numchildren"));
                }               
 
-               NodeList property = varNode.getChildNodes();
                if (NumChildren > 0) {
+                       NodeList property = varNode.getChildNodes();
                        renderValueString(""+property.getLength());
                        fVariables = new IVariable[property.getLength()];
                        for (int i = 0; i<property.getLength(); i++) {
@@ -53,8 +54,7 @@ public abstract class XDebugAbstractValue  extends XDebugElement implements IVal
                        } catch (NullPointerException e) {
                                str="";
                        }
-                       
-                       
+
                        String Encoding = PHPDebugUtils.getAttributeValue(varNode,"encoding");
                        
                        if (Encoding.equals("base64")) {
@@ -109,25 +109,26 @@ public abstract class XDebugAbstractValue  extends XDebugElement implements IVal
                return (fVariables.length > 0);
        }
        
-       public abstract void renderValueString(String data);
+       public abstract void renderValueString(String data) throws DebugException;
 
        public abstract boolean verifyValue(String expression);
        
-       public boolean setValue(String expression) {
-               if (!verifyValue(expression))
+       public boolean setValue(String expression) throws DebugException {
+               if (!verifyValue(expression)) {
                        return false;
-        if( getDebugTarget() == null ) {
-            renderValueString(expression);
-           } else {
-                  /* if(((XDebugTarget) getDebugTarget()).setVarValue(fVariable.getFullName(),expression)) {
-                           renderValueString(expression);
-                           return true;
-                   }*/
-           }
-               return false;
+               }
+               
+               renderValueString(expression);
+               fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT));
+        
+               return true;
        }
        
        public boolean supportsValueModification() {
                return false;
        }
+       
+       public void setValueString(String valueString) {
+               fValueString = valueString;
+       }
 }
\ No newline at end of file