Modified: 1764120 - Variables View doesn't show global vars in class context
[phpeclipse.git] / net.sourceforge.phpeclipse.debug.core / src / net / sourceforge / phpdt / internal / debug / core / watch / PHPWatchExpressionDelegate.java
index 2c3964d..1f38d53 100644 (file)
@@ -10,29 +10,41 @@ import org.eclipse.debug.core.model.IWatchExpressionDelegate;
 import org.eclipse.debug.core.model.IWatchExpressionListener;
 import org.eclipse.debug.core.model.IWatchExpressionResult;
 
+/**
+ * 
+ */
 public class PHPWatchExpressionDelegate implements IWatchExpressionDelegate {
 
-       public void evaluateExpression(String expression, IDebugElement context,
-                       IWatchExpressionListener listener) {
-               IWatchExpressionResult x;
-               PHPDBGProxy dbg=((PHPDebugTarget)context.getDebugTarget()).getPHPDBGProxy();
-               PHPStackFrame s=null;
-               if(context instanceof PHPStackFrame)
-                       s=(PHPStackFrame)context;
-               try{
-               PHPVariable result[]=dbg.eval(s,expression);
-               if(result.length==0)
-                       x=new PHPWatchExpressionResult(expression,null,null);
-               else
-                       x=new PHPWatchExpressionResult(expression,result[0].getValue(),null);
-               }
-               catch(Exception e)
-               {
-                       String[] s1=new String[1];
-                       s1[0]=e.toString();
-               x=new PHPWatchExpressionResult(expression,null,s1);
-               }
-               listener.watchEvaluationFinished(x);
-       }
-
-}
\ No newline at end of file
+       public void evaluateExpression(String expression, IDebugElement context,
+                       IWatchExpressionListener listener) {
+               IWatchExpressionResult x;
+               PHPDBGProxy dbg;
+               PHPStackFrame s;
+
+               dbg = ((PHPDebugTarget) context.getDebugTarget()).getPHPDBGProxy();
+               s = null;
+
+               if (context instanceof PHPStackFrame) {
+                       s = (PHPStackFrame) context;
+               }
+
+               try {
+                       PHPVariable result[] = dbg.eval(s, expression);
+
+                       if (result.length == 0) {
+                               x = new PHPWatchExpressionResult(expression, null, null);
+                       } else {
+                               x = new PHPWatchExpressionResult(expression, result[0]
+                                               .getValue(), null);
+                       }
+               } catch (Exception e) {
+                       String[] s1;
+
+                       s1 = new String[1];
+                       s1[0] = e.toString();
+                       x = new PHPWatchExpressionResult(expression, null, s1);
+               }
+
+               listener.watchEvaluationFinished(x);
+       }
+}