}
}
+ public Node eval(String expression) {
+ int id = fDebugConnection.eval(expression);
+ XDebugResponse response = getResponse(id);
+
+ Node evalResponse = response.getParentNode();
+ Node evalProperty = evalResponse.getFirstChild();
+
+ return evalProperty;
+ }
+
public void handleDebugEvents(DebugEvent[] events) {
for (int i = 0; i < events.length; i++) {
DebugEvent event = events[i];
return response.getParentNode();
}
+ public void stop() {
+ fDebugConnection.stop();
+ }
+
protected IBreakpoint breakpointHit(Node node) {
Node child = node.getFirstChild();
if (child.getNodeName().equals("stack")) {
int lineNumber = Integer.parseInt(PHPDebugUtils.getAttributeValue(child, "lineno"));
- String filename=PHPDebugUtils.getAttributeValue(child, "filename");
+ String filename = PHPDebugUtils.getAttributeValue(child, "filename");
IBreakpoint[] breakpoints = XDebugCorePlugin.getBreakpoints();
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
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;
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();
-
- if( connection != 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);
- }
+ try {
+ Node evalProperty = ((XDebugTarget) context.getDebugTarget()).eval(expression);
+ 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);
- }
+ } catch (Exception e) {
+ String[] s1;
+
+ s1 = new String[1];
+ s1[0] = e.toString();
+ x = new XDebugWatchExpressionResult(expression, null, s1);
}
listener.watchEvaluationFinished(x);