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 969c718..9c289a0 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 @@ -7,19 +7,21 @@ package net.sourceforge.phpeclipse.xdebug.php.model; import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils; + +//import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.core.model.IVariable; import org.w3c.dom.Node; - +//import org.eclipse.debug.core.model.IWatchExpressionDelegate; /** * @author Axel * * 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/*, IWatchExpressionFactoryAdapter*/ { public static final int VARTYPE_UNKNOWN = -1; public static final int VARTYPE_UNINITIALIZED = 0; public static final int VARTYPE_STRING = 1; @@ -30,13 +32,13 @@ public class XDebugVariable extends XDebugElement implements IVariable { public static final int VARTYPE_OBJECT = 10; public static final int VARTYPE_RESOURCE = 11; - // name & stack frmae + private int fNumChildren; private String fName; - private XDebugStackFrame fFrame; private String fFullName; - private XDebugAbstractValue fValue; private String fEncoding; - private int fNumChildren; + private XDebugStackFrame fFrame; + private XDebugAbstractValue fValue; + private String fFacet; /** * Constructs a variable contained in the given stack frame @@ -45,73 +47,33 @@ public class XDebugVariable extends XDebugElement implements IVariable { * @param frame owning stack frame * @param name variable name */ - public XDebugVariable( String typeName, String fullname ) { - fFullName = fullname; - fName = fullname; - if (typeName.equals("int") ) - fValue= new XDebugIntValue(this,typeName); - else if (typeName.equals("float") ) - fValue= new XDebugFloatValue(this,typeName); - else if (typeName.equals("bool") ) - fValue= new XDebugBooleanValue(this,typeName); - else if (typeName.equals("string") ) - fValue= new XDebugStringValue(this,typeName); - else if (typeName.equals("array") ) - fValue= new XDebugArrayValue(this,typeName); - else if (typeName.equals("hash") ) - fValue= new XDebugArrayValue(this,typeName); - else if (typeName.equals("object") ) - fValue= new XDebugArrayValue(this,typeName); - else if (typeName.equals("resource") ) - fValue= new XDebugResourceValue(this,typeName); - else - fValue= new XDebugValue(this,typeName); - } - public XDebugVariable(XDebugStackFrame frame, Node property) { - super((XDebugTarget) frame.getDebugTarget()); - fFrame = frame; - init(property); - } - - public XDebugVariable(XDebugStackFrame frame, String fullname, String name, String typeName) { - super((XDebugTarget) frame.getDebugTarget()); - fFrame = frame; - fFullName = fullname; - fName = name; - if (typeName.equals("int") ) - fValue= new XDebugIntValue(this,typeName); - else if (typeName.equals("float") ) - fValue= new XDebugFloatValue(this,typeName); - else if (typeName.equals("bool") ) - fValue= new XDebugBooleanValue(this,typeName); - else if (typeName.equals("string") ) - fValue= new XDebugStringValue(this,typeName); - else if (typeName.equals("array") ) - fValue= new XDebugArrayValue(this,typeName); - else if (typeName.equals("hash") ) - fValue= new XDebugArrayValue(this,typeName); - else if (typeName.equals("object") ) - fValue= new XDebugArrayValue(this,typeName); - else if (typeName.equals("resource") ) - fValue= new XDebugResourceValue(this,typeName); - else - fValue= new XDebugValue(this,typeName); - } - - 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("")) + if (frame != null ) { + //super((XDebugTarget) frame.getDebugTarget()); + fFrame = frame; + } + + String address = PHPDebugUtils.getAttributeValue(property,"address"); + + fName = PHPDebugUtils.getAttributeValue(property,"name"); + if ("".equals(fName)) { + fName = address; + } /*else { + varName = Name; + }*/ + + fFullName = PHPDebugUtils.getAttributeValue(property,"fullname"); + fEncoding = PHPDebugUtils.getAttributeValue(property,"encoding"); + if (PHPDebugUtils.getAttributeValue(property,"numchildren").equals("")) { fNumChildren = 0; - else - fNumChildren=Integer.parseInt(PHPDebugUtils.getAttributeValue(property,"numchildren")); + } else { + fNumChildren = Integer.parseInt(PHPDebugUtils.getAttributeValue(property, "numchildren")); + } + + String typeName = PHPDebugUtils.getAttributeValue(property, "type"); - String typeName=PHPDebugUtils.getAttributeValue(property,"type"); + fFacet = PHPDebugUtils.getAttributeValue(property, "facet"); -// 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") ) @@ -126,10 +88,12 @@ public class XDebugVariable extends XDebugElement implements IVariable { fValue= new XDebugArrayValue(this,property,typeName); else if (typeName.equals("object") ) fValue= new XDebugArrayValue(this,property,typeName); + else if (typeName.equals("resource") ) + fValue= new XDebugResourceValue(this, property, typeName); else fValue= new XDebugValue(this,property,typeName); } - + /* (non-Javadoc) * @see org.eclipse.debug.core.model.IVariable#getValue() */ @@ -209,8 +173,8 @@ public class XDebugVariable extends XDebugElement implements IVariable { } public void setStackFrame(XDebugStackFrame frame) { - fFrame=frame; - super.setDebugTarget((XDebugTarget)frame.getDebugTarget()); + fFrame = frame; + super.setDebugTarget((XDebugTarget) frame.getDebugTarget()); } // public int getType() { @@ -237,12 +201,16 @@ public class XDebugVariable extends XDebugElement implements IVariable { return fEncoding; } + public String getVisibility() { + return fFacet; + } + public void setEncoding(String encoding) { fEncoding = encoding; } public String toString() { - return fValue.toString(); + return null; } public String getFullName() { @@ -299,14 +267,25 @@ public class XDebugVariable extends XDebugElement implements IVariable { fValue.sethasChanged(false); } } else { - IVariable dummy = new XDebugVariable("UNKNOWN", ""); - dummy.setValue("uninitialized"); + //IVariable dummy = new XDebugVariable("UNKNOWN", ""); + /*dummy.setValue("uninitialized"); for(int i = 0; i < newVariable.length; i++) { ((XDebugVariable)newVariable[i]).setChange(dummy); } - fValue.sethasChanged(true); + fValue.sethasChanged(true);*/ } } } - + /** + * Creates and returns an expression for the specified variable + * which is used to created an {@link org.eclipse.debug.core.model.IWatchExpression}. + * + * @param variable variable a watch expression is required for + * @return text used to create a watch expression + * @exception org.eclipse.core.runtime.CoreException if unable to create a watch + * expression + */ + /*public String createWatchExpression(IVariable variable) throws CoreException { + + }*/ } \ No newline at end of file