Bug 8322 - Detail evaluation timeout overwrites previous value
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/DisplayAction.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/DisplayAction.java
index 3ca9da3..8fa7832 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/DisplayAction.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/DisplayAction.java
@@ -20,7 +20,10 @@
 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;

 import org.eclipse.jdt.internal.debug.ui.display.IDataDisplay;

 import org.eclipse.jdt.internal.debug.ui.snippeteditor.JavaSnippetEditor;

+import org.eclipse.jface.dialogs.MessageDialog;

+import org.eclipse.swt.SWT;

 import org.eclipse.swt.widgets.Display;

+import org.eclipse.swt.widgets.MessageBox;

 import org.eclipse.ui.IWorkbenchPart;

 

 /**

@@ -29,6 +32,11 @@
 public class DisplayAction extends EvaluateAction implements IValueDetailListener {

 	

 	/**

+	 * Used in evaluationTimedOut

+	 */

+	private boolean fKeepWaiting;

+	

+	/**

 	 * The debug model presentation used for computing toString

 	 */

 	private IDebugModelPresentation fPresentation= DebugUITools.newDebugModelPresentation(JDIDebugModel.getPluginIdentifier());

@@ -72,6 +80,27 @@
 		}

 	}

 	

+	/**

+	 * @see IEvaluationListener#evaluationTimedOut(IJavaThread)

+	 */

+	public boolean evaluationTimedOut(final IJavaThread thread) {

+		JDIDebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {

+			public void run() {

+				boolean answer= MessageDialog.openQuestion(getShell(), "Evaluation timed out", "Do you want to suspend the evaluation? Answer no to keep waiting");

+				if (answer) {

+					try {

+						thread.suspend();

+					} catch (DebugException exception) {

+					}

+					fKeepWaiting= false;

+				} else {

+					fKeepWaiting= true; // Keep waiting

+				}

+			}

+		});

+		return fKeepWaiting;

+	}

+	

 	protected void insertResult(IJavaValue result, IJavaThread thread) {

 		

 		String resultString= " "; //$NON-NLS-1$

diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/InspectAction.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/InspectAction.java
index 8d2ba27..75f29f0 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/InspectAction.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/InspectAction.java
@@ -10,6 +10,7 @@
 import org.eclipse.debug.core.DebugException;

 import org.eclipse.debug.core.DebugPlugin;

 import org.eclipse.debug.ui.IDebugUIConstants;

+import org.eclipse.jdt.debug.core.IJavaThread;

 import org.eclipse.jdt.debug.core.IJavaValue;

 import org.eclipse.jdt.debug.core.IJavaVariable;

 import org.eclipse.jdt.debug.eval.IEvaluationResult;

@@ -17,7 +18,6 @@
 import org.eclipse.jdt.internal.debug.ui.display.IDataDisplay;

 import org.eclipse.jdt.internal.debug.ui.display.JavaInspectExpression;

 import org.eclipse.jdt.internal.debug.ui.snippeteditor.JavaSnippetEditor;

-import org.eclipse.jface.viewers.ISelection;

 import org.eclipse.jface.viewers.IStructuredSelection;

 import org.eclipse.swt.widgets.Display;

 import org.eclipse.ui.IViewPart;

@@ -57,6 +57,13 @@
 	}

 	

 	/**

+	 * @see IEvaluationListener#evaluationTimedOut(IJavaThread)

+	 */

+	public boolean evaluationTimedOut(IJavaThread thread) {

+		return true; // Keep waiting

+	}

+	

+	/**

 	 * Make the expression view visible or open one

 	 * if required.

 	 */

diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/snippeteditor/JavaSnippetEditor.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/snippeteditor/JavaSnippetEditor.java
index fddc85b..a17823d 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/snippeteditor/JavaSnippetEditor.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/snippeteditor/JavaSnippetEditor.java
@@ -407,7 +407,10 @@
 			evaluationEnds();

 		}

 	}

-

+	

+	/**

+	 * @see IEvaluationListener#evaluationComplete(IEvaluationResult)

+	 */

 	public void evaluationComplete(final IEvaluationResult result) {

 		Runnable r = new Runnable() {

 			public void run() {

@@ -466,6 +469,13 @@
 	}

 	

 	/**

+	 * @see IEvaluationListener#evaluationTimedOut(IJavaThread)

+	 */

+	public boolean evaluationTimedOut(IJavaThread thread) {

+		return true; // Keep waiting

+	}

+	

+	/**

 	 * Make the expression view visible or open one

 	 * if required.

 	 */