From: axelcl Date: Mon, 27 Jun 2005 17:32:23 +0000 (+0000) Subject: 3 files from Martin Koeglers watches patches X-Git-Url: http://git.phpeclipse.com 3 files from Martin Koeglers watches patches --- diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPEvalException.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPEvalException.java new file mode 100644 index 0000000..cfe1108 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPEvalException.java @@ -0,0 +1,10 @@ +package net.sourceforge.phpdt.internal.debug.core.watch; + +public class PHPEvalException extends Exception { + + public PHPEvalException(String s) + { + super(s); + } + +} \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionDelegate.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionDelegate.java new file mode 100644 index 0000000..2c3964d --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionDelegate.java @@ -0,0 +1,38 @@ +package net.sourceforge.phpdt.internal.debug.core.watch; + +import net.sourceforge.phpdt.internal.debug.core.PHPDBGProxy; +import net.sourceforge.phpdt.internal.debug.core.model.PHPDebugTarget; +import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame; +import net.sourceforge.phpdt.internal.debug.core.model.PHPVariable; + +import org.eclipse.debug.core.model.IDebugElement; +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 diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionResult.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionResult.java new file mode 100644 index 0000000..14b6c19 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/watch/PHPWatchExpressionResult.java @@ -0,0 +1,40 @@ +package net.sourceforge.phpdt.internal.debug.core.watch; + +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.IValue; +import org.eclipse.debug.core.model.IWatchExpressionResult; + +public class PHPWatchExpressionResult implements IWatchExpressionResult { + + String text; + IValue result; + String[] err; + + public PHPWatchExpressionResult(String t,IValue v,String[] e) + { + text=t; + result=v; + err=e; + } + + public IValue getValue() { + return result; + } + + public boolean hasErrors() { + return err != null; + } + + public String[] getErrorMessages() { + return err; + } + + public String getExpressionText() { + return text; + } + + public DebugException getException() { + return null; + } + +}