1 package net.sourceforge.phpeclipse.xdebug.php.model;
4 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable;
5 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugTarget;
7 import org.eclipse.debug.core.model.IDebugElement;
8 import org.eclipse.debug.core.model.IWatchExpressionDelegate;
9 import org.eclipse.debug.core.model.IWatchExpressionListener;
10 import org.eclipse.debug.core.model.IWatchExpressionResult;
11 import org.w3c.dom.Node;
13 public class XDebugWatchExpressionDelegate implements IWatchExpressionDelegate {
14 public void evaluateExpression(String expression, IDebugElement context, IWatchExpressionListener listener) {
15 IWatchExpressionResult x;
18 Node evalProperty = ((XDebugTarget) context.getDebugTarget()).eval(expression);
19 XDebugVariable variable = new XDebugVariable(null, evalProperty);
20 XDebugVariable result[] = {variable};
22 if (result.length == 0) {
23 x = new XDebugWatchExpressionResult(expression, null, null);
25 x = new XDebugWatchExpressionResult(expression, result[0].getValue(), null);
27 } catch (Exception e) {
32 x = new XDebugWatchExpressionResult(expression, null, s1);
35 listener.watchEvaluationFinished(x);