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.PHPDebugUtils;
11 import org.eclipse.debug.core.DebugException;
12 import org.eclipse.debug.core.model.IValue;
13 import org.eclipse.debug.core.model.IVariable;
14 import org.w3c.dom.Node;
19 * TODO To change the template for this generated type comment go to
20 * Window - Preferences - Java - Code Style - Code Templates
22 public class XDebugVariable extends XDebugElement implements IVariable {
24 private String fFullName;
25 private XDebugStackFrame fFrame;
26 private XDebugAbstractValue fValue;
27 private String fFacet;
30 * Constructs a variable contained in the given stack frame
31 * with the given name.
33 * @param frame owning stack frame
34 * @param name variable name
36 public XDebugVariable(XDebugStackFrame frame, Node property) {
38 //super((XDebugTarget) frame.getDebugTarget());
42 String address = PHPDebugUtils.getAttributeValue(property,"address");
44 fName = PHPDebugUtils.getAttributeValue(property,"name");
45 if ("".equals(fName)) {
49 fFullName = PHPDebugUtils.getAttributeValue(property,"fullname");
51 String typeName = PHPDebugUtils.getAttributeValue(property, "type");
53 fFacet = PHPDebugUtils.getAttributeValue(property, "facet");
55 if (typeName.equals("int") )
56 fValue = new XDebugIntValue(frame, property);
57 else if (typeName.equals("float") )
58 fValue = new XDebugFloatValue(frame, property);
59 else if (typeName.equals("bool") )
60 fValue = new XDebugBooleanValue(frame, property);
61 else if (typeName.equals("string") )
62 fValue = new XDebugStringValue(frame, property);
63 else if (typeName.equals("array") )
64 fValue = new XDebugArrayValue(frame, property);
65 else if (typeName.equals("hash") )
66 fValue = new XDebugArrayValue(frame, property);
67 else if (typeName.equals("object") )
68 fValue = new XDebugArrayValue(frame, property);
69 else if (typeName.equals("resource") )
70 fValue = new XDebugResourceValue(frame, property);
72 fValue = new XDebugValue(frame, property);
76 * @see org.eclipse.debug.core.model.IVariable#getValue()
78 public IValue getValue() throws DebugException {
83 * @see org.eclipse.debug.core.model.IVariable#getName()
85 public String getName() throws DebugException {
86 if (fFullName.endsWith("]"))
87 return fFullName.substring(fFullName.lastIndexOf('['));
93 * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
95 public String getReferenceTypeName() throws DebugException {
96 return fValue.getReferenceTypeName();
100 * @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
102 public boolean hasValueChanged() throws DebugException {
103 return fValue.hasChanged();
107 * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
109 public void setValue(String expression) throws DebugException {
110 if(fValue.setValue(expression)) {
113 //fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT));
114 //fValue.setValueA(expression);
118 * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
120 public void setValue(IValue value) throws DebugException {
121 //fValue.setValueB(value);
125 * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
127 public boolean supportsValueModification() {
128 return fValue.supportsValueModification();
132 * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
134 public boolean verifyValue(String expression) throws DebugException {
135 return fValue.verifyValue(expression);
139 * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue)
141 public boolean verifyValue(IValue value) throws DebugException {
146 * Returns the stack frame owning this variable.
148 * @return the stack frame owning this variable
150 protected XDebugStackFrame getStackFrame() {
154 public String getValueString() throws DebugException {
155 return fValue.getValueString();
158 public String getVisibility() {
162 public String toString() {
166 public String getFullName() {