From c499a84c0c4216cffd12d8473ba8bb0cd5c2af16 Mon Sep 17 00:00:00 2001 From: robekras Date: Mon, 28 Mar 2011 16:05:30 +0000 Subject: [PATCH] 1) Added parameter 'parent' to XDebugVariable, so we can determine whether a variable is a root node or a child node. 2) Prepend a '$' to the php variable names, if it is a root node. This let us add the variable to watch expression window (and also no need for cutting of the '$' in PHPDebugHover. --- .../xdebug/php/model/XDebugArrayValue.java | 4 +- .../xdebug/php/model/XDebugObjectValue.java | 4 +- .../xdebug/php/model/XDebugStackFrame.java | 4 +- .../xdebug/php/model/XDebugVariable.java | 29 +++++++++++++++++--- .../php/model/XDebugWatchExpressionDelegate.java | 2 +- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugArrayValue.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugArrayValue.java index 6174c3e..7680a89 100644 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugArrayValue.java +++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugArrayValue.java @@ -10,7 +10,7 @@ import org.w3c.dom.NodeList; public class XDebugArrayValue extends XDebugAbstractValue { private int NumChildren; - public XDebugArrayValue(XDebugStackFrame variable, Node value) throws DebugException { + public XDebugArrayValue(XDebugStackFrame variable, Node value, XDebugVariable parent) throws DebugException { super(variable, value); NumChildren = 0; @@ -25,7 +25,7 @@ public class XDebugArrayValue extends XDebugAbstractValue { for (int i = 0; ichild->a_variable. The fullname would be suitable to take for + // the setting a watch expression + if ("".equals(fName)) { fName = PHPDebugUtils.getAttributeValue(property,"address"); } @@ -58,9 +72,9 @@ public class XDebugVariable extends XDebugElement implements IVariable { else if (typeName.equals("string") ) fValue = new XDebugStringValue(frame, property); else if (typeName.equals("array") ) - fValue = new XDebugArrayValue(frame, property); + fValue = new XDebugArrayValue(frame, property, this); else if (typeName.equals("object") ) - fValue = new XDebugObjectValue(frame, property); + fValue = new XDebugObjectValue(frame, property, this); else if (typeName.equals("resource") ) fValue = new XDebugResourceValue(frame, property); else @@ -81,6 +95,13 @@ public class XDebugVariable extends XDebugElement implements IVariable { return fName; } + /* + * @return The fully qualified name of the variable + */ + public String getNameFull () { + return fNameFull; + } + /* (non-Javadoc) * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName() */ diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugWatchExpressionDelegate.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugWatchExpressionDelegate.java index e90aedd..d434a53 100644 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugWatchExpressionDelegate.java +++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugWatchExpressionDelegate.java @@ -28,7 +28,7 @@ public class XDebugWatchExpressionDelegate implements IWatchExpressionDelegate { XDebugVariable variable = null; try { - variable = new XDebugVariable(frame, evalProperty); + variable = new XDebugVariable(frame, evalProperty, null); x = new XDebugWatchExpressionResult(expression, variable.getValue(), null); } catch (DebugException e) { // TODO Auto-generated catch block -- 1.7.1