2 * Created on 23.11.2004
4 * TODO To change the template for this generated file go to
5 * Window - Preferences - Java - Code Style - Code Templates
7 package net.sourceforge.phpeclipse.xdebug.php.model;
9 import net.sourceforge.phpeclipse.xdebug.core.Base64;
10 import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils;
12 import org.eclipse.debug.core.DebugException;
13 import org.eclipse.debug.core.model.IValue;
14 import org.eclipse.debug.core.model.IVariable;
15 import org.w3c.dom.Node;
16 import org.w3c.dom.NodeList;
21 * TODO To change the template for this generated type comment go to
22 * Window - Preferences - Java - Code Style - Code Templates
24 public abstract class XDebugAbstractValue extends XDebugElement implements IValue {
25 private IVariable[] fVariables;
26 protected String fValueString;
27 protected String fTypeName;
28 private boolean fhasChanged;
30 public XDebugAbstractValue(XDebugStackFrame frame, Node varNode) {
31 super((XDebugTarget) frame.getDebugTarget());
33 fTypeName = PHPDebugUtils.getAttributeValue(varNode,"type");
36 if (!PHPDebugUtils.getAttributeValue(varNode,"numchildren").equals("")) {
37 NumChildren = Integer.parseInt(PHPDebugUtils.getAttributeValue(varNode, "numchildren"));
40 NodeList property = varNode.getChildNodes();
41 if (NumChildren > 0) {
42 renderValueString(""+property.getLength());
43 fVariables = new IVariable[property.getLength()];
44 for (int i = 0; i<property.getLength(); i++) {
45 Node propertyNode = property.item(i);
46 fVariables[i] = new XDebugVariable(frame, propertyNode);
49 fVariables = new IVariable[0];
52 str=varNode.getFirstChild().getNodeValue();
53 } catch (NullPointerException e) {
58 String Encoding = PHPDebugUtils.getAttributeValue(varNode,"encoding");
60 if (Encoding.equals("base64")) {
62 str=new String(Base64.decode(str));
66 renderValueString(str);
68 String className=PHPDebugUtils.getAttributeValue(varNode,"classname");
69 if(!"".equals(className))
70 renderValueString(className);
73 public boolean hasChanged() {
78 * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
80 public String getReferenceTypeName() throws DebugException {
85 * @see org.eclipse.debug.core.model.IValue#getValueString()
87 public String getValueString() throws DebugException {
92 * @see org.eclipse.debug.core.model.IValue#isAllocated()
94 public boolean isAllocated() throws DebugException {
99 * @see org.eclipse.debug.core.model.IValue#getVariables()
101 public IVariable[] getVariables() throws DebugException {
106 * @see org.eclipse.debug.core.model.IValue#hasVariables()
108 public boolean hasVariables() throws DebugException {
109 return (fVariables.length > 0);
112 public abstract void renderValueString(String data);
114 public abstract boolean verifyValue(String expression);
116 public boolean setValue(String expression) {
117 if (!verifyValue(expression))
119 if( getDebugTarget() == null ) {
120 renderValueString(expression);
122 /* if(((XDebugTarget) getDebugTarget()).setVarValue(fVariable.getFullName(),expression)) {
123 renderValueString(expression);
130 public boolean supportsValueModification() {