Bug 515926 - [tests] Prepare infrastructure for debug view test

- added extra debug perspective to show debug view in full size on the
left side from the editor. This allows debug view to materialize all
visible stack elements.
- added extra AbstractDebugUiTests as a base class for UI related debug
tests.
- extended TestUtil.waitForJobs() to allow ignoring some job families.

Change-Id: If51726f0544da553fefc32fb53cea9bf0314ba17
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/org.eclipse.jdt.debug.tests/plugin.properties b/org.eclipse.jdt.debug.tests/plugin.properties
index 96faec0..576ac5c 100644
--- a/org.eclipse.jdt.debug.tests/plugin.properties
+++ b/org.eclipse.jdt.debug.tests/plugin.properties
@@ -53,4 +53,6 @@
 contextLabel.label = Run FOOX file
 contextLabel.label.0 = Debug FOOX file
 contextLabel.label.1 = Profile FOOX file
-launchConfigurationTabGroup.description = Test Tab Group
\ No newline at end of file
+launchConfigurationTabGroup.description = Test Tab Group
+DebugViewPerspective=DebugView
+DebugViewPerspectiveDescription=DebugView perspective description
\ No newline at end of file
diff --git a/org.eclipse.jdt.debug.tests/plugin.xml b/org.eclipse.jdt.debug.tests/plugin.xml
index bb85d96..bc649d7 100644
--- a/org.eclipse.jdt.debug.tests/plugin.xml
+++ b/org.eclipse.jdt.debug.tests/plugin.xml
@@ -476,5 +476,15 @@
            modelIdentifier="org.eclipse.jdt.debug">
      </stepFilter>
   </extension>
-
+   <extension
+         point="org.eclipse.ui.perspectives">
+      <perspective
+            name="%DebugViewPerspective"
+            class="org.eclipse.jdt.debug.tests.ui.DebugViewPerspectiveFactory"
+            id="org.eclipse.jdt.debug.tests.ui.DebugViewPerspectiveFactory">
+         <description>
+            %DebugViewPerspectiveDescription
+         </description>
+      </perspective>
+   </extension>
 </plugin>
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/TestUtil.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/TestUtil.java
index f677669..c9417c4 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/TestUtil.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/TestUtil.java
@@ -83,6 +83,25 @@
 	 * @return true if the method timed out, false if all the jobs terminated before the timeout
 	 */
 	public static boolean waitForJobs(String owner, long minTimeMs, long maxTimeMs) {
+		return waitForJobs(owner, minTimeMs, maxTimeMs, (Object[]) null);
+	}
+
+	/**
+	 * Utility for waiting until the execution of jobs of any family has finished or timeout is reached. If no jobs are running, the method waits
+	 * given minimum wait time. While this method is waiting for jobs, UI events are processed.
+	 *
+	 * @param owner
+	 *            name of the caller which will be logged as prefix if the wait times out
+	 * @param minTimeMs
+	 *            minimum wait time in milliseconds
+	 * @param maxTimeMs
+	 *            maximum wait time in milliseconds
+	 * @param excludedFamilies
+	 *            optional list of job families to NOT wait for
+	 *
+	 * @return true if the method timed out, false if all the jobs terminated before the timeout
+	 */
+	public static boolean waitForJobs(String owner, long minTimeMs, long maxTimeMs, Object... excludedFamilies) {
 		if (maxTimeMs < minTimeMs) {
 			throw new IllegalArgumentException("Max time is smaller as min time!");
 		}
@@ -96,7 +115,11 @@
 			}
 		}
 		while (!Job.getJobManager().isIdle()) {
-			List<Job> jobs = getRunningOrWaitingJobs((Object) null);
+			List<Job> jobs = getRunningOrWaitingJobs(null, excludedFamilies);
+			if (jobs.isEmpty()) {
+				// only uninteresting jobs running
+				break;
+			}
 
 			if (!Collections.disjoint(runningJobs, jobs)) {
 				// There is a job which runs already quite some time, don't wait for it to avoid test timeouts
@@ -143,11 +166,11 @@
 		return sb.toString();
 	}
 
-	private static List<Job> getRunningOrWaitingJobs(Object jobFamily) {
+	private static List<Job> getRunningOrWaitingJobs(Object jobFamily, Object... excludedFamilies) {
 		List<Job> running = new ArrayList<>();
 		Job[] jobs = Job.getJobManager().find(jobFamily);
 		for (Job job : jobs) {
-			if (isRunningOrWaitingJob(job)) {
+			if (isRunningOrWaitingJob(job) && !belongsToFamilies(job, excludedFamilies)) {
 				running.add(job);
 			}
 		}
@@ -159,4 +182,16 @@
 		return (state == Job.RUNNING || state == Job.WAITING);
 	}
 
+	private static boolean belongsToFamilies(Job job, Object... excludedFamilies) {
+		if (excludedFamilies == null || excludedFamilies.length == 0) {
+			return false;
+		}
+		for (Object family : excludedFamilies) {
+			if (job.belongsTo(family)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
 }
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/AbstractDebugUiTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/AbstractDebugUiTests.java
new file mode 100644
index 0000000..c501b7e
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/AbstractDebugUiTests.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ *  Copyright (c) 2017 Andrey Loskutov and others.
+ *  All rights reserved. This program and the accompanying materials
+ *  are made available under the terms of the Eclipse Public License v1.0
+ *  which accompanies this distribution, and is available at
+ *  http://www.eclipse.org/legal/epl-v10.html
+ *
+ *  Contributors:
+ *     Andrey Loskutov <loskutov@gmx.de> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.debug.tests.ui;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jdt.debug.tests.AbstractDebugTest;
+import org.eclipse.jdt.debug.tests.TestUtil;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * Base class for UI related debug tests.
+ */
+public abstract class AbstractDebugUiTests extends AbstractDebugTest {
+
+	// prefs to restore
+	private String switch_on_launch;
+	private String switch_on_suspend;
+	private String debug_perspectives;
+	private String user_view_bindings;
+	private boolean activate_debug_view;
+
+	public AbstractDebugUiTests(String name) {
+		super(name);
+	}
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		IPreferenceStore preferenceStore = DebugUITools.getPreferenceStore();
+		switch_on_launch = preferenceStore.getString(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE);
+		switch_on_suspend = preferenceStore.getString(IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND);
+		debug_perspectives = preferenceStore.getString(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES);
+		user_view_bindings = preferenceStore.getString(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS);
+		activate_debug_view = preferenceStore.getBoolean(IInternalDebugUIConstants.PREF_ACTIVATE_DEBUG_VIEW);
+
+		preferenceStore.setValue(IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND, MessageDialogWithToggle.NEVER);
+		preferenceStore.setValue(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE, MessageDialogWithToggle.NEVER);
+		preferenceStore.setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.ID_DEBUG_PERSPECTIVE + "," +
+				JavaUI.ID_PERSPECTIVE + ",");
+		preferenceStore.setValue(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS, IInternalDebugCoreConstants.EMPTY_STRING);
+		preferenceStore.setValue(IInternalDebugUIConstants.PREF_ACTIVATE_DEBUG_VIEW, true);
+		sync(() -> TestUtil.waitForJobs(getName(), 10, 1000));
+	}
+
+	@Override
+	protected void tearDown() throws Exception {
+		IPreferenceStore preferenceStore = DebugUITools.getPreferenceStore();
+		preferenceStore.setValue(IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND, switch_on_suspend);
+		preferenceStore.setValue(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE, switch_on_launch);
+		preferenceStore.setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, debug_perspectives);
+		preferenceStore.setValue(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS, user_view_bindings);
+		preferenceStore.setValue(IInternalDebugUIConstants.PREF_ACTIVATE_DEBUG_VIEW, activate_debug_view);
+		sync(() -> TestUtil.waitForJobs(getName(), 10, 1000));
+		super.tearDown();
+	}
+
+	/**
+	 * Switches to the specified perspective in the given window, and resets the perspective.
+	 *
+	 * @param window
+	 * @param perspectiveId
+	 */
+	protected void switchPerspective(IWorkbenchWindow window, String perspectiveId) {
+		IPerspectiveDescriptor descriptor = PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(perspectiveId);
+		assertNotNull("missing perspective " + perspectiveId, descriptor);
+		IWorkbenchPage page = window.getActivePage();
+		page.setPerspective(descriptor);
+		page.resetPerspective();
+		TestUtil.runEventLoop();
+	}
+
+	/**
+	 * Switches to and resets the specified perspective in the active workbench window.
+	 *
+	 * @return the window in which the perspective is ready
+	 */
+	protected IWorkbenchWindow resetPerspective(final String id) throws Exception {
+		final IWorkbenchWindow[] windows = new IWorkbenchWindow[1];
+		sync(() -> {
+			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+			switchPerspective(window, id);
+			windows[0] = window;
+		});
+		return windows[0];
+	}
+
+	/**
+	 * Siwtches to and resets the debug perspective in the active workbench window.
+	 *
+	 * @return the window in which the perspective is ready
+	 */
+	protected IWorkbenchWindow resetDebugPerspective() throws Exception {
+		return resetPerspective(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
+	}
+
+	/**
+	 * Swtches to and resets the java perspective in the active workbench window.
+	 *
+	 * @return the window in which the perspective is ready
+	 */
+	protected IWorkbenchWindow resetJavaPerspective() throws Exception {
+		return resetPerspective(JavaUI.ID_PERSPECTIVE);
+	}
+
+	/**
+	 * Sync exec the given runnable, re-throwing exceptions in the current thread
+	 *
+	 * @param r
+	 * @throws Exception
+	 */
+	protected void sync(Runnable r) throws Exception {
+		AtomicReference<Exception> error = new AtomicReference<>();
+		DebugUIPlugin.getStandardDisplay().syncExec(() -> {
+			try {
+				r.run();
+			}
+			catch (Exception t) {
+				error.set(t);
+			}
+		});
+		if (error.get() != null) {
+			throw error.get();
+		}
+	}
+
+	/**
+	 * Sync exec the given runnable, re-throwing exceptions in the current thread
+	 *
+	 * @param c
+	 * @throws Exception
+	 */
+	protected <V> V sync(Callable<V> c) throws Exception {
+		AtomicReference<Throwable> error = new AtomicReference<>();
+		AtomicReference<V> result = new AtomicReference<>();
+		DebugUIPlugin.getStandardDisplay().syncExec(() -> {
+			try {
+				result.set(c.call());
+			}
+			catch (Throwable t) {
+				error.set(t);
+			}
+		});
+		if (error.get() != null) {
+			throwException(error.get());
+		}
+		return result.get();
+	}
+
+	/**
+	 * This and the another {@link #throwException1(Throwable)} method below are here to allow to catch AssertionFailedError's and other
+	 * non-Exceptions happened in the UI thread
+	 *
+	 * @param exception
+	 */
+	private static void throwException(Throwable exception) {
+		AbstractDebugUiTests.<RuntimeException> throwException1(exception);
+	}
+
+	/**
+	 * @param dummy to make compiler happy
+	 */
+	@SuppressWarnings("unchecked")
+	private static <T extends Throwable> void throwException1(Throwable exception) throws T {
+		throw (T) exception;
+	}
+
+	protected void processUiEvents(long millis) throws Exception {
+		Thread.sleep(millis);
+		if (Display.getCurrent() == null) {
+			sync(() -> TestUtil.runEventLoop());
+		} else {
+			TestUtil.runEventLoop();
+		}
+	}
+
+	protected IWorkbenchPage getActivePage() {
+		IWorkbench workbench = PlatformUI.getWorkbench();
+		IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+		if (window == null) {
+			window = workbench.getWorkbenchWindows()[0];
+			Shell shell = window.getShell();
+			shell.moveAbove(null);
+			shell.setActive();
+			shell.forceActive();
+		}
+		return window.getActivePage();
+	}
+
+	protected IEditorPart openEditor(String type) throws Exception {
+		IFile resource = (IFile) getResource(type);
+		IEditorPart editor = IDE.openEditor(getActivePage(), resource);
+		assertNotNull(editor);
+		processUiEvents(100);
+		return editor;
+	}
+}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DebugViewPerspectiveFactory.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DebugViewPerspectiveFactory.java
new file mode 100644
index 0000000..fe6cf11
--- /dev/null
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DebugViewPerspectiveFactory.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ *  Copyright (c) 2017 Andrey Loskutov and others.
+ *  All rights reserved. This program and the accompanying materials
+ *  are made available under the terms of the Eclipse Public License v1.0
+ *  which accompanies this distribution, and is available at
+ *  http://www.eclipse.org/legal/epl-v10.html
+ *
+ *  Contributors:
+ *     Andrey Loskutov <loskutov@gmx.de> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.debug.tests.ui;
+
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.console.IConsoleConstants;
+
+/**
+ * The debug perspective factory for debug view tests
+ */
+public class DebugViewPerspectiveFactory implements IPerspectiveFactory {
+
+	public static final String ID = DebugViewPerspectiveFactory.class.getName();
+
+	@Override
+	public void createInitialLayout(IPageLayout layout) {
+		IFolderLayout rightFolder = layout.createFolder(IInternalDebugUIConstants.ID_TOOLS_FOLDER_VIEW, IPageLayout.LEFT, (float) 0.50, layout.getEditorArea());
+		rightFolder.addView(IDebugUIConstants.ID_DEBUG_VIEW);
+
+		IFolderLayout consoleFolder = layout.createFolder(IInternalDebugUIConstants.ID_CONSOLE_FOLDER_VIEW, IPageLayout.BOTTOM, (float) 0.65, layout.getEditorArea());
+		consoleFolder.addView(IPageLayout.ID_PROJECT_EXPLORER);
+		consoleFolder.addView(IConsoleConstants.ID_CONSOLE_VIEW);
+
+	}
+}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/ViewManagementTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/ViewManagementTests.java
index 0c8d4fb..bd5d010 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/ViewManagementTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/ViewManagementTests.java
@@ -13,16 +13,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.ui.DebugUITools;
 import org.eclipse.debug.ui.IDebugUIConstants;
 import org.eclipse.jdt.debug.core.IJavaThread;
-import org.eclipse.jdt.debug.tests.AbstractDebugTest;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.test.OrderedTestSuite;
 import org.eclipse.ui.IPerspectiveDescriptor;
 import org.eclipse.ui.IPerspectiveListener3;
@@ -30,14 +22,13 @@
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchPartReference;
 import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
 
 import junit.framework.Test;
 
 /**
  * Tests view management.
  */
-public class ViewManagementTests extends AbstractDebugTest implements IPerspectiveListener3 {
+public class ViewManagementTests extends AbstractDebugUiTests implements IPerspectiveListener3 {
 
 	public static Test suite() {
 		return new OrderedTestSuite(ViewManagementTests.class);
@@ -61,19 +52,12 @@
 	/**
 	 * List of view ids expecting to open.
 	 */
-	private List<String> fExpectingOpenEvents = new ArrayList<String>();
+	private List<String> fExpectingOpenEvents = new ArrayList<>();
 
 	/**
 	 * List of view ids expecting to close.
 	 */
-	private List<String> fExpectingCloseEvents = new ArrayList<String>();
-
-	// prefs to restore
-	private String switch_on_launch;
-	private String switch_on_suspend;
-	private String debug_perspectives;
-	private String user_view_bindings;
-	private boolean activate_debug_view;
+	private List<String> fExpectingCloseEvents = new ArrayList<>();
 
 	/**
 	 * Constructor
@@ -84,117 +68,32 @@
 	}
 
 	/**
-	 * Switches to the specified perspective in the given window, and resets the perspective.
-	 *
-	 * @param window
-	 * @param perspectiveId
-	 */
-	protected void switchPerspective(IWorkbenchWindow window, String perspectiveId) {
-		IPerspectiveDescriptor descriptor = PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(perspectiveId);
-		assertNotNull("missing perspective " + perspectiveId, descriptor);
-		IWorkbenchPage page = window.getActivePage();
-		page.setPerspective(descriptor);
-		page.resetPerspective();
-	}
-
-	/**
-	 * Switches to and resets the specified perspective in the active workbench window.
-	 *
-	 * @return the window in which the perspective is ready
-	 */
-	private IWorkbenchWindow resetPerspective(final String id) {
-		final IWorkbenchWindow[] windows = new IWorkbenchWindow[1];
-		Runnable r = new Runnable() {
-			@Override
-			public void run() {
-				IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-				switchPerspective(window, id);
-				windows[0] = window;
-			}
-		};
-		sync(r);
-		return windows[0];
-	}
-
-	/**
-	 * Siwtches to and resets the debug perspective in the active workbench window.
-	 *
-	 * @return the window in which the perspective is ready
-	 */
-	protected IWorkbenchWindow resetDebugPerspective() {
-		return resetPerspective(IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
-	}
-
-	/**
-	 * Siwtches to and resets the java perspective in the active workbench window.
-	 *
-	 * @return the window in which the perspective is ready
-	 */
-	protected IWorkbenchWindow resetJavaPerspective() {
-		return resetPerspective(JavaUI.ID_PERSPECTIVE);
-	}
-
-	/**
-	 * Sync exec the given runnable
-	 *
-	 * @param r
-	 */
-	protected void sync(Runnable r) {
-		DebugUIPlugin.getStandardDisplay().syncExec(r);
-	}
-
-	/**
 	 * Returns whether the specified view is open
 	 *
 	 * @param window
 	 * @param id
 	 * @return
 	 */
-	protected boolean isViewOpen(final IWorkbenchWindow window, final String id) {
+	protected boolean isViewOpen(final IWorkbenchWindow window, final String id) throws Exception {
 		final IViewReference[] refs = new IViewReference[1];
-		Runnable r = new Runnable() {
+		sync(new Runnable() {
 			@Override
 			public void run() {
 				refs[0] = window.getActivePage().findViewReference(id);
 			}
-		};
-		sync(r);
+		});
 		return refs[0] != null;
 	}
 
-	/* (non-Javadoc)
-	 * @see junit.framework.TestCase#setUp()
-	 */
 	@Override
 	protected void setUp() throws Exception {
 		super.setUp();
-		IPreferenceStore preferenceStore = DebugUITools.getPreferenceStore();
-		switch_on_launch = preferenceStore.getString(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE);
-		switch_on_suspend = preferenceStore.getString(IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND);
-		debug_perspectives = preferenceStore.getString(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES);
-		user_view_bindings = preferenceStore.getString(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS);
-		activate_debug_view = preferenceStore.getBoolean(IInternalDebugUIConstants.PREF_ACTIVATE_DEBUG_VIEW);
-		preferenceStore.setValue(IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND, MessageDialogWithToggle.NEVER);
-		preferenceStore.setValue(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE, MessageDialogWithToggle.NEVER);
-		preferenceStore.setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.ID_DEBUG_PERSPECTIVE + "," +
-				JavaUI.ID_PERSPECTIVE + ",");
-		preferenceStore.setValue(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS, IInternalDebugCoreConstants.EMPTY_STRING);
-		preferenceStore.setValue(IInternalDebugUIConstants.PREF_ACTIVATE_DEBUG_VIEW, true);
 		fExpectingOpenEvents.clear();
 		fExpectingCloseEvents.clear();
 	}
 
-	/* (non-Javadoc)
-	 * @see junit.framework.TestCase#tearDown()
-	 */
 	@Override
 	protected void tearDown() throws Exception {
-		IPreferenceStore preferenceStore = DebugUITools.getPreferenceStore();
-		preferenceStore.setValue(IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND, switch_on_suspend);
-		preferenceStore.setValue(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE, switch_on_launch);
-		preferenceStore.setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, debug_perspectives);
-		preferenceStore.setValue(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS, user_view_bindings);
-		preferenceStore.setValue(IInternalDebugUIConstants.PREF_ACTIVATE_DEBUG_VIEW, activate_debug_view);
 		super.tearDown();
 	}