Bug 551029 - don't try to access WorkbenchWindow.showHeapStatus from non
UI thread

AbstractDebugTest.setPreferences() tried to access
WorkbenchWindow.showHeapStatus() to hide the status monitor (WHY???),
which is of course a very bad idea if Window needs access to SWT and we
are running in non UI thread.

This worked before as long as the heap status widget was not yet created
(because there was no widget to hide), but now we see that dong this was
not a good idea.

I don't think this monitor widget hiding is really needed for debug
tests, so simply remove the code doing this in the wrong thread.

Change-Id: Ib55e135d4e82615ed44613d4c98d714f7eb06747
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
index a5444e1..9a3e826 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
@@ -154,7 +154,6 @@
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
@@ -162,9 +161,7 @@
 import org.eclipse.ui.console.IHyperlink;
 import org.eclipse.ui.console.TextConsole;
 import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.internal.WorkbenchWindow;
 import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
-import org.eclipse.ui.internal.util.PrefUtil;
 import org.eclipse.ui.intro.IIntroManager;
 import org.eclipse.ui.intro.IIntroPart;
 import org.eclipse.ui.progress.UIJob;
@@ -312,16 +309,6 @@
 	        // turn off monitor information
 	        jdiUIPreferences.setValue(IJavaDebugUIConstants.PREF_SHOW_MONITOR_THREAD_INFO, false);
 
-	        // turn off workbench heap monitor
-	        PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR, false);
-	        IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
-	        for (int i = 0; i < windows.length; i++) {
-	            IWorkbenchWindow window = windows[i];
-	            if(window instanceof WorkbenchWindow){
-	                ((WorkbenchWindow) window).showHeapStatus(false);
-	            }
-	        }
-
 	        //make sure we are auto-refreshing external workspace changes
 	        IEclipsePreferences node = InstanceScope.INSTANCE.getNode(ResourcesPlugin.PI_RESOURCES);
 	        if(node != null) {