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 XDebugStackFrame        fFrame;
 
  25         private XDebugAbstractValue fValue;
 
  26         private String                          fFacet;
 
  27         private XDebugVariable          fParent;                // The parent variable (a back link)
 
  31          * Constructs a variable contained in the given stack frame
 
  32          * with the given name.
 
  34          * @param frame owning stack frame
 
  35          * @param name variable name
 
  37         public XDebugVariable(XDebugStackFrame frame, Node property) throws DebugException {
 
  38                 super((XDebugTarget) frame.getDebugTarget());
 
  43                 fName = PHPDebugUtils.getAttributeValue(property,"name");
 
  44                 if ("".equals(fName)) {
 
  45                         fName = PHPDebugUtils.getAttributeValue(property,"address");
 
  48                 fFacet = PHPDebugUtils.getAttributeValue(property, "facet");
 
  50                 String typeName = PHPDebugUtils.getAttributeValue(property, "type");
 
  52                 if (typeName.equals("int") ) 
 
  53                         fValue = new XDebugIntValue(frame, property);
 
  54                 else if (typeName.equals("float") ) 
 
  55                         fValue = new XDebugFloatValue(frame, property);
 
  56                 else if (typeName.equals("bool") ) 
 
  57                         fValue = new XDebugBooleanValue(frame, property);
 
  58                 else if (typeName.equals("string") )
 
  59                         fValue = new XDebugStringValue(frame, property);
 
  60                 else if (typeName.equals("array") )
 
  61                         fValue = new XDebugArrayValue(frame, property);
 
  62                 else if (typeName.equals("object") )
 
  63                         fValue = new XDebugObjectValue(frame, property);
 
  64                 else if (typeName.equals("resource") )
 
  65                         fValue = new XDebugResourceValue(frame, property);
 
  67                         fValue = new XDebugValue(frame, property);
 
  71          * @see org.eclipse.debug.core.model.IVariable#getValue()
 
  73         public IValue getValue() {
 
  78          * @see org.eclipse.debug.core.model.IVariable#getName()
 
  80         public String getName() {
 
  85          * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
 
  87         public String getReferenceTypeName() throws DebugException {
 
  88                 return fValue.getReferenceTypeName();
 
  92          * @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
 
  94         public boolean hasValueChanged() throws DebugException {
 
  95                 return fValue.hasChanged();
 
  99          * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
 
 101         public void setValue(String expression) throws DebugException {
 
 102                 if (fFrame.setVariableValue(this, expression)) {
 
 103                         fValue.setValue(expression);
 
 108          * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
 
 110         public void setValue(IValue value) throws DebugException {
 
 115          * @param changed This method is called after a suspend when the list of
 
 116          *                variables is updated, to mark that this variable has a changed
 
 117          *                value. The variable view will show this variable in
 
 120         public void setValueChanged(boolean changed) {
 
 121                 fValue.setChanged(changed);
 
 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 true; */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 {
 
 145         public String getValueString() throws DebugException {
 
 146                 return fValue.getValueString();
 
 149         public String getVisibility() {
 
 156         public XDebugVariable getParent() {
 
 163         public void setParent(XDebugVariable parent) {
 
 164                 this.fParent = parent;