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 64dbc32..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.Base64; -import net.sourceforge.phpeclipse.xdebug.core.xdebug.XDebugConnection; -import net.sourceforge.phpeclipse.xdebug.core.xdebug.ResponseListener.DebugResponse; 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,37 +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; + IWatchExpressionResult x = new XDebugWatchExpressionResult(expression, null, null); - x = new XDebugWatchExpressionResult(expression, null, null); - - s = (XDebugTarget) context.getDebugTarget(); - connection = (XDebugConnection) s.getDebugConnection(); + /* 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() ) { - String encoded = Base64.encodeBytes(expression.getBytes()); - DebugResponse evalCommand = connection.sendRequestA( "eval", "-- "+encoded ); - - Node evalNode = evalCommand.getParentNode(); - XDebugVariable var= connection.getVariableFromNodeA( null, evalNode.getFirstChild()); - XDebugVariable result[] = {var}; - - 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(); } }