X-Git-Url: http://git.phpeclipse.com 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 9fbfdc2..e90aedd 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 @@ -2,8 +2,8 @@ package net.sourceforge.phpeclipse.xdebug.php.model; import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable; -import net.sourceforge.phpeclipse.xdebug.php.model.XDebugTarget; +import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IWatchExpressionDelegate; import org.eclipse.debug.core.model.IWatchExpressionListener; @@ -12,24 +12,28 @@ import org.w3c.dom.Node; public class XDebugWatchExpressionDelegate implements IWatchExpressionDelegate { public void evaluateExpression(String expression, IDebugElement context, IWatchExpressionListener listener) { - IWatchExpressionResult x; + IWatchExpressionResult x = new XDebugWatchExpressionResult(expression, null, null); - try { - Node evalProperty = ((XDebugTarget) context.getDebugTarget()).eval(expression); - XDebugVariable variable = new XDebugVariable(null, evalProperty); - XDebugVariable result[] = {variable}; + /* Active debug session */ + if (context instanceof XDebugStackFrame) { + XDebugStackFrame frame = (XDebugStackFrame)context; + Node evalProperty = null; - if (result.length == 0) { - x = new XDebugWatchExpressionResult(expression, null, null); - } else { - x = new XDebugWatchExpressionResult(expression, result[0].getValue(), null); - } - } catch (Exception e) { - String[] s1; + try { + evalProperty = frame.eval(expression); + } catch (Exception e) { + // + e.printStackTrace(); + } - s1 = new String[1]; - s1[0] = e.toString(); - x = new XDebugWatchExpressionResult(expression, null, s1); + XDebugVariable variable = null; + try { + variable = new XDebugVariable(frame, evalProperty); + x = new XDebugWatchExpressionResult(expression, variable.getValue(), null); + } catch (DebugException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } listener.watchEvaluationFinished(x);