X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugVariable.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugVariable.java index a6646da..21663d3 100644 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugVariable.java +++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugVariable.java @@ -6,7 +6,6 @@ */ package net.sourceforge.phpeclipse.xdebug.php.model; - import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils; import org.eclipse.debug.core.DebugEvent; @@ -17,39 +16,53 @@ import org.w3c.dom.Node; /** * @author Axel - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * + * TODO To change the template for this generated type comment go to Window - + * Preferences - Java - Code Style - Code Templates */ -public class XDebugVariable extends XDebugElement implements IVariable { - +public class XDebugVariable extends XDebugElement implements IVariable { + public static final int VARTYPE_UNKNOWN = -1; + public static final int VARTYPE_UNINITIALIZED = 0; + public static final int VARTYPE_STRING = 1; + public static final int VARTYPE_INT = 2; + public static final int VARTYPE_FLOAT = 3; + public static final int VARTYPE_ARRAY = 8; + public static final int VARTYPE_HASH = 9; + public static final int VARTYPE_OBJECT = 10; - // name & stack frmae private String fName; + private XDebugStackFrame fFrame; + private String fFullName; -// private String fTypeName; -// private int fType; + + // private String fTypeName; + // private int fType; private XDebugAbstractValue fValue; + private String fEncoding; + private int fNumChildren; -// private Node fVariableNode; - + + // private Node fVariableNode; + /** - * Constructs a variable contained in the given stack frame - * with the given name. + * Constructs a variable contained in the given stack frame with the given + * name. * - * @param frame owning stack frame - * @param name variable name + * @param frame + * owning stack frame + * @param name + * variable name */ public XDebugVariable(XDebugStackFrame frame, Node property) { super((XDebugTarget) frame.getDebugTarget()); @@ -57,62 +70,67 @@ public class XDebugVariable extends XDebugElement implements IVariable { init(property); } - - private void init(Node property) { - fFullName=PHPDebugUtils.getAttributeValue(property,"fullname"); - fName=PHPDebugUtils.getAttributeValue(property,"name"); - fEncoding=PHPDebugUtils.getAttributeValue(property,"encoding"); - if (PHPDebugUtils.getAttributeValue(property,"numchildren").equals("")) + + private void init(Node property) { + fFullName = PHPDebugUtils.getAttributeValue(property, "fullname"); + fName = PHPDebugUtils.getAttributeValue(property, "name"); + fEncoding = PHPDebugUtils.getAttributeValue(property, "encoding"); + if (PHPDebugUtils.getAttributeValue(property, "numchildren").equals("")) fNumChildren = 0; else - fNumChildren=Integer.parseInt(PHPDebugUtils.getAttributeValue(property,"numchildren")); - - String typeName=PHPDebugUtils.getAttributeValue(property,"type"); - -// if (typeName.equals("uninitialized") ) -// fValue= new XDebugValue(this,property,typeName); - if (typeName.equals("int") ) - fValue= new XDebugIntValue(this,property,typeName); - else if (typeName.equals("float") ) - fValue= new XDebugFloatValue(this,property,typeName); - else if (typeName.equals("bool") ) - fValue= new XDebugBooleanValue(this,property,typeName); - else if (typeName.equals("string") ) - fValue= new XDebugStringValue(this,property,typeName); - else if (typeName.equals("array") ) - fValue= new XDebugArrayValue(this,property,typeName); - else if (typeName.equals("hash") ) - fValue= new XDebugArrayValue(this,property,typeName); - else if (typeName.equals("object") ) - fValue= new XDebugArrayValue(this,property,typeName); + fNumChildren = Integer.parseInt(PHPDebugUtils.getAttributeValue( + property, "numchildren")); + + String typeName = PHPDebugUtils.getAttributeValue(property, "type"); + + // if (typeName.equals("uninitialized") ) + // fValue= new XDebugValue(this,property,typeName); + if (typeName.equals("int")) + fValue = new XDebugIntValue(this, property, typeName); + else if (typeName.equals("float")) + fValue = new XDebugFloatValue(this, property, typeName); + else if (typeName.equals("bool")) + fValue = new XDebugBooleanValue(this, property, typeName); + else if (typeName.equals("string")) + fValue = new XDebugStringValue(this, property, typeName); + else if (typeName.equals("array")) + fValue = new XDebugArrayValue(this, property, typeName); + else if (typeName.equals("hash")) + fValue = new XDebugArrayValue(this, property, typeName); + else if (typeName.equals("object")) + fValue = new XDebugArrayValue(this, property, typeName); else - fValue= new XDebugValue(this,property,typeName); - -// else if (typeName.equals("float") ) -// fTypeName= VARTYPE_FLOAT; -// else if (typeName.equals("string") ) -// fTypeName= VARTYPE_STRING; -// else if (typeName.equals("hash") ) -// fTypeName= VARTYPE_HASH; -// else if (typeName.equals("array") ) -// fTypeName= VARTYPE_ARRAY; -// else if (typeName.equals("object") ) -// fTypeName= VARTYPE_OBJECT; - - - -// fTypeName=type; -// -// fValue= new XDebugValue(this,property); - } - /* (non-Javadoc) + fValue = new XDebugValue(this, property, typeName); + + // else if (typeName.equals("float") ) + // fTypeName= VARTYPE_FLOAT; + // else if (typeName.equals("string") ) + // fTypeName= VARTYPE_STRING; + // else if (typeName.equals("hash") ) + // fTypeName= VARTYPE_HASH; + // else if (typeName.equals("array") ) + // fTypeName= VARTYPE_ARRAY; + // else if (typeName.equals("object") ) + // fTypeName= VARTYPE_OBJECT; + + // fTypeName=type; + // + // fValue= new XDebugValue(this,property); + } + + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IVariable#getValue() */ public IValue getValue() throws DebugException { return fValue; -// return ((XDebugTarget)getDebugTarget()).getVariableValue(this); + // return ((XDebugTarget)getDebugTarget()).getVariableValue(this); } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IVariable#getName() */ public String getName() throws DebugException { @@ -121,50 +139,72 @@ public class XDebugVariable extends XDebugElement implements IVariable { else return fName; } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName() */ public String getReferenceTypeName() throws DebugException { return fValue.getReferenceTypeName(); } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IVariable#hasValueChanged() */ public boolean hasValueChanged() throws DebugException { // TODO Auto-generated method stub return false; } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String) */ public void setValue(String expression) throws DebugException { - if(fValue.setValue(expression)) - fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT)); + if (fValue.setValue(expression)) + fireEvent(new DebugEvent(this, DebugEvent.CHANGE, + DebugEvent.CONTENT)); } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue) */ public void setValue(IValue value) throws DebugException { } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification() */ public boolean supportsValueModification() { return fValue.supportsValueModification(); } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String) */ public boolean verifyValue(String expression) throws DebugException { return fValue.verifyValue(expression); } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue) */ public boolean verifyValue(IValue value) throws DebugException { return false; } - + /** * Returns the stack frame owning this variable. * @@ -174,16 +214,16 @@ public class XDebugVariable extends XDebugElement implements IVariable { return fFrame; } -// public int getType() { -// return fType; -// } + // public int getType() { + // return fType; + // } public String getValueString() throws DebugException { return fValue.getValueString(); } - + public boolean hasChildren() { - return (fNumChildren>0); + return (fNumChildren > 0); } public boolean isArray() { @@ -197,7 +237,7 @@ public class XDebugVariable extends XDebugElement implements IVariable { public void setEncoding(String encoding) { fEncoding = encoding; } - + public String toString() { return fValue.toString(); }