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 a14bc08..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 @@ -1,11 +1,9 @@ package net.sourceforge.phpeclipse.xdebug.php.model; -import net.sourceforge.phpeclipse.xdebug.core.xdebug.XDebugConnection; -import net.sourceforge.phpeclipse.xdebug.core.xdebug.ResponseListener.XDebugResponse; 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; @@ -14,40 +12,27 @@ import org.w3c.dom.Node; public class XDebugWatchExpressionDelegate implements IWatchExpressionDelegate { public void evaluateExpression(String expression, IDebugElement context, IWatchExpressionListener listener) { - IWatchExpressionResult x; - XDebugConnection connection; - XDebugTarget s; - - x = new XDebugWatchExpressionResult(expression, null, null); - - s = (XDebugTarget) context.getDebugTarget(); - connection = (XDebugConnection) s.getDebugConnection(); + IWatchExpressionResult x = new XDebugWatchExpressionResult(expression, null, null); + + /* Active debug session */ + if (context instanceof XDebugStackFrame) { + XDebugStackFrame frame = (XDebugStackFrame)context; + Node evalProperty = null; + + try { + evalProperty = frame.eval(expression); + } catch (Exception e) { + // + e.printStackTrace(); + } - if( connection != null ) { + XDebugVariable variable = null; try { - if( ! connection.isClosed() ) { - /*XDebugResponse*/ int evalCommand = connection.eval(expression); - - XDebugResponse response = s.getResponse(evalCommand); - - - Node evalResponse = response.getParentNode(); - Node evalProperty = evalResponse.getFirstChild(); - XDebugVariable variable = new XDebugVariable(null, evalProperty); - XDebugVariable result[] = {variable}; - - if (result.length == 0) { - x = new XDebugWatchExpressionResult(expression, null, null); - } else { - x = new XDebugWatchExpressionResult(expression, result[0].getValue(), null); - } - } - } catch (Exception e) { - String[] s1; - - s1 = new String[1]; - s1[0] = e.toString(); - x = new XDebugWatchExpressionResult(expression, null, s1); + variable = new XDebugVariable(frame, evalProperty, null); + x = new XDebugWatchExpressionResult(expression, variable.getValue(), null); + } catch (DebugException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } }