01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.ui.tests;
11:
12: import junit.framework.TestCase;
13:
14: import org.eclipse.core.resources.IProject;
15: import org.eclipse.core.resources.IWorkspaceRoot;
16: import org.eclipse.core.resources.ResourcesPlugin;
17: import org.eclipse.core.runtime.CoreException;
18: import org.eclipse.core.runtime.NullProgressMonitor;
19: import org.eclipse.swt.widgets.Shell;
20: import org.eclipse.ui.PlatformUI;
21:
22: public abstract class PDETestCase extends TestCase {
23:
24: protected Shell getShell() {
25: return PlatformUI.getWorkbench().getDisplay().getActiveShell();
26: }
27:
28: protected void tearDown() {
29: IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace()
30: .getRoot();
31: IProject[] projects = workspaceRoot.getProjects();
32: try {
33: for (int i = 0; i < projects.length; i++) {
34: projects[i].delete(true, new NullProgressMonitor());
35: }
36: } catch (CoreException e) {
37: }
38: }
39: }
|