"reference", // 8
"soft reference" }; // 9
- final static int PEVT_UNKNOWN = 0;
- final static int PEVT_LONG = 1;
- final static int PEVT_DOUBLE = 2;
- final static int PEVT_STRING = 3;
- final static int PEVT_ARRAY = 4;
- final static int PEVT_OBJECT = 5;
- final static int PEVT_BOOLEAN = 6;
- final static int PEVT_RESOURCE = 7;
- final static int PEVT_REF = 8;
- final static int PEVT_SOFTREF = 9;
+ public final static int PEVT_UNKNOWN = 0;
+ public final static int PEVT_LONG = 1;
+ public final static int PEVT_DOUBLE = 2;
+ public final static int PEVT_STRING = 3;
+ public final static int PEVT_ARRAY = 4;
+ public final static int PEVT_OBJECT = 5;
+ public final static int PEVT_BOOLEAN = 6;
+ public final static int PEVT_RESOURCE = 7;
+ public final static int PEVT_REF = 8;
+ public final static int PEVT_SOFTREF = 9;
private int fValueType; // The type of this value (see the PEVT_... values)
//private boolean hasChildren; // This value (variable) has children (more variables)
package net.sourceforge.phpdt.internal.debug.core.watch;
+import java.util.Vector;
+
import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy;
import net.sourceforge.phpdt.internal.debug.core.model.PHPDebugTarget;
import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame;
+import net.sourceforge.phpdt.internal.debug.core.model.PHPValue;
import net.sourceforge.phpdt.internal.debug.core.model.PHPVariable;
import org.eclipse.debug.core.model.IDebugElement;
PHPDBGProxy dbg;
PHPStackFrame s;
- dbg = ((PHPDebugTarget) context.getDebugTarget()).getPHPDBGProxy();
- s = null;
-
- if (context instanceof PHPStackFrame) {
- s = (PHPStackFrame) context;
+ if (!(context instanceof PHPStackFrame)) {
+ x = new PHPWatchExpressionResult(expression, null, null);
+ listener.watchEvaluationFinished(x);
+ return;
}
+ dbg = ((PHPDebugTarget) context.getDebugTarget()).getPHPDBGProxy();
+ s = (PHPStackFrame) context;
+
try {
PHPVariable result[] = dbg.eval(s, expression);
if (result.length == 0) {
x = new PHPWatchExpressionResult(expression, null, null);
} else {
+ switch (result[0].getReferenceType()) {
+ case PHPValue.PEVT_ARRAY:
+ case PHPValue.PEVT_OBJECT:
+ result[0].setName(expression);
+ reset(result[0]);
+ break;
+ }
x = new PHPWatchExpressionResult(expression, result[0]
.getValue(), null);
}
listener.watchEvaluationFinished(x);
}
+
+ private void reset(PHPVariable variable) {
+ PHPValue value;
+ Vector variables;
+
+ switch (variable.getReferenceType()) {
+ case PHPValue.PEVT_ARRAY:
+ value = (PHPValue) variable.getValue();
+ variables = value.getChildVariables();
+ for (int i = 0; i < variables.size(); i++) {
+ PHPVariable var = (PHPVariable) variables.get(i);
+ String name = var.getName();
+ if (var.getLongName().equals(name)) {
+ var.setName(name);
+ } else {
+ var.setParent(variable);
+ }
+ reset(var);
+ }
+ break;
+ case PHPValue.PEVT_OBJECT:
+ value = (PHPValue) variable.getValue();
+ variables = value.getChildVariables();
+ for (int i = 0; i < variables.size(); i++) {
+ PHPVariable var = (PHPVariable) variables.get(i);
+ var.setParent(variable);
+ reset(var);
+ }
+ break;
+ }
+ }
+
}