1) Added parameter 'parent' to XDebugVariable, so we can determine whether a variable...
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / php / model / XDebugWatchExpressionDelegate.java
1 package net.sourceforge.phpeclipse.xdebug.php.model;
2
3
4 import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable;
5
6 import org.eclipse.debug.core.DebugException;
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;
12
13 public class XDebugWatchExpressionDelegate implements IWatchExpressionDelegate {
14         public void evaluateExpression(String expression, IDebugElement context, IWatchExpressionListener listener) {
15                 IWatchExpressionResult x = new XDebugWatchExpressionResult(expression, null, null);
16
17                 /* Active debug session */
18                 if (context instanceof XDebugStackFrame) {
19                         XDebugStackFrame frame = (XDebugStackFrame)context;
20                         Node evalProperty = null;
21                                 
22                         try {   
23                                 evalProperty = frame.eval(expression);
24                         } catch (Exception e) {
25                                 // 
26                                 e.printStackTrace();
27                         }
28
29                         XDebugVariable variable = null;
30                         try {
31                                 variable = new XDebugVariable(frame, evalProperty, null);
32                                 x = new XDebugWatchExpressionResult(expression, variable.getValue(), null);
33                         } catch (DebugException e) {
34                                 // TODO Auto-generated catch block
35                                 e.printStackTrace();
36                         }
37                 }
38
39                 listener.watchEvaluationFinished(x);
40         }
41 }