From b29d66d2b88c38f57d613d5266a21bd463d9294c Mon Sep 17 00:00:00 2001 From: robekras Date: Sun, 30 Dec 2012 15:25:17 +0100 Subject: [PATCH] 1) Setting a new value did not work because the short name was send to XDebug instead of the full (long) name. 2) When updating the variable list, we have to set the new XDebugAbstractValue to the old variable, else we would also not be able to set a new value to the variable. Signed-off-by: robekras --- .../xdebug/php/model/XDebugStackFrame.java | 30 ++++++++++---------- .../xdebug/php/model/XDebugVariable.java | 1 + 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStackFrame.java b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStackFrame.java index 4f56af6..7521c61 100644 --- a/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStackFrame.java +++ b/net.sourceforge.phpeclipse.xdebug.core/src/net/sourceforge/phpeclipse/xdebug/php/model/XDebugStackFrame.java @@ -198,21 +198,20 @@ public class XDebugStackFrame extends XDebugElement implements IStackFrame, Com valNew = (XDebugAbstractValue) varNew.getValue(); // Get the value from DBG try { - if (valOld.hasVariables() || // If the 'static' value has child variables - valNew.hasVariables()) { // or if the DBG value has child variables - if (!hasRecursion(varOld) && - !hasRecursion(varNew)) { // Both branches should not have a recursion - updateVariableList( - valOld.getChildVariables(), // Update the variable list for the child variables + if (valOld.hasVariables() || // If the 'static' value has child variables + valNew.hasVariables()) { // or if the DBG value has child variables + if (!hasRecursion (varOld) && + !hasRecursion (varNew)) { // Both branches should not have a recursion + updateVariableList ( + valOld.getChildVariables(), // Update the variable list for the child variables valNew.getChildVariables()); } } if (!valOld.getValueString().equals( valNew.getValueString())) { // Has the value changed? - valOld.setValueString(valNew.getValueString()); // Yes, set the 'static' value (variable) to the new value - valOld.setReferenceTypeName (valNew.getReferenceTypeName ()); - varOld.setValueChanged(true); // and set the 'has changed' flag, so that the variable view + varOld.setValue (varNew.getValue ()); // Set the new value + varOld.setValueChanged (true); // and set the 'has changed' flag, so that the variable view // could show the user the changed status with a different // color } @@ -259,11 +258,6 @@ public class XDebugStackFrame extends XDebugElement implements IStackFrame, Com */ public synchronized IVariable[] getVariables() throws DebugException { - /* always read variables, poor performance - * but this fix bug #680. - * need to investigate on. - */ - if (!fUpToDate) { Node dfl = ((XDebugTarget) getDebugTarget()).getLocalVariables(fLevel); Node dfg = ((XDebugTarget) getDebugTarget()).getGlobalVariables(fLevel); @@ -279,6 +273,12 @@ public class XDebugStackFrame extends XDebugElement implements IStackFrame, Com return (IVariable[]) varList.toArray (new IVariable[varList.size()]); } + /** + * + * @param localVariables + * @param globalVariables + * @throws DebugException + */ private void parseVariable(Node localVariables, Node globalVariables) throws DebugException { NodeList property = localVariables.getChildNodes(); NodeList propertyGlobal = globalVariables.getChildNodes(); @@ -582,7 +582,7 @@ public class XDebugStackFrame extends XDebugElement implements IStackFrame, Com } public boolean setVariableValue(XDebugVariable variable, String expression) throws DebugException { - return ((XDebugTarget) getDebugTarget()).setVarValue(variable.getName(), expression); + return ((XDebugTarget) getDebugTarget()).setVarValue(variable.getNameFull(), expression); } public Node eval(String expression) throws DebugException { 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 8a1b7f8..58bb38f 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 @@ -167,6 +167,7 @@ public class XDebugVariable extends XDebugElement implements IVariable { * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue) */ public void setValue(IValue value) throws DebugException { + fValue = (XDebugAbstractValue) value; } /** -- 1.7.1