eb91e5bfa48f45f6d1f9b7e5c9f3064ba70be279
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / php / model / XDebugAbstractValue.java
1  /* Created on 23.11.2004
2  *
3  * TODO To change the template for this generated file go to
4  * Window - Preferences - Java - Code Style - Code Templates
5  */
6 package net.sourceforge.phpeclipse.xdebug.php.model;
7
8 import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils;
9
10 import org.eclipse.debug.core.DebugException;
11 import org.eclipse.debug.core.model.IValue;
12 import org.eclipse.debug.core.model.IVariable;
13 import org.w3c.dom.Node;
14
15 /**
16  * @author Axel
17  *
18  * TODO To change the template for this generated type comment go to
19  * Window - Preferences - Java - Code Style - Code Templates
20  */
21
22 public /*abstract*/ class XDebugAbstractValue  extends XDebugElement implements IValue {
23         private IVariable[] fVariables;
24         private String fValueString;
25         private String fTypeName;
26         private boolean fhasChanged;
27         protected String rowValue;
28         
29         public XDebugAbstractValue(XDebugStackFrame frame, Node value) throws DebugException  {
30                 super(frame == null ? null : (XDebugTarget)frame.getDebugTarget());
31
32                 fTypeName = PHPDebugUtils.getAttributeValue(value, "type");
33                 
34                 fVariables = new IVariable[0];
35
36                 rowValue = "";
37                 try {
38                         rowValue = value.getFirstChild().getNodeValue();
39                 } catch (NullPointerException e) {
40                         rowValue = "";
41                 }
42         }
43         
44         public boolean hasChanged() {
45                 return fhasChanged;
46         }
47         
48         /* (non-Javadoc)
49          * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
50          */
51         public String getReferenceTypeName() throws DebugException {
52                 return fTypeName;
53         }
54         
55         /* (non-Javadoc)
56          * @see org.eclipse.debug.core.model.IValue#getValueString()
57          */
58         public String getValueString() throws DebugException {
59                 return fValueString;
60         }
61         
62         /* (non-Javadoc)
63          * @see org.eclipse.debug.core.model.IValue#isAllocated()
64          */
65         public boolean isAllocated() throws DebugException {
66                 return true;
67         }
68         
69         /* (non-Javadoc)
70          * @see org.eclipse.debug.core.model.IValue#getVariables()
71          */
72         public IVariable[] getVariables() throws DebugException {
73                 return fVariables;
74         }
75         
76         /* (non-Javadoc)
77          * @see org.eclipse.debug.core.model.IValue#hasVariables()
78          */
79         public boolean hasVariables() throws DebugException {
80                 return (fVariables.length > 0);
81         }
82         
83         public boolean setValue(String expression) throws DebugException {
84                 return true;
85         };
86         
87         protected boolean verifyValue(String expression) {
88                 return true;
89         }
90         
91         protected boolean supportsValueModification() {
92                 return false;
93         }
94         
95         protected void setValueString(String valueString) {
96                 fValueString = valueString;
97         }
98
99         protected void setChildren(IVariable[] newChildren) {
100                 fVariables = newChildren;
101         }
102 }