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 org.eclipse.core.resources.IProject;
13: import org.eclipse.core.resources.IWorkspaceRoot;
14: import org.eclipse.core.resources.ResourcesPlugin;
15: import org.eclipse.core.runtime.CoreException;
16:
17: public abstract class NewProjectTestCase extends PDETestCase {
18:
19: protected void verifyProjectExistence() {
20: assertTrue("Project does not exist", getProject().exists()); //$NON-NLS-1$
21: }
22:
23: protected IProject getProject() {
24: IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
25: return root.getProject(getProjectName());
26: }
27:
28: protected boolean hasNature(String nature) {
29: boolean hasNature = false;
30: try {
31: hasNature = getProject().hasNature(nature);
32: } catch (CoreException e) {
33: }
34: return hasNature;
35: }
36:
37: protected abstract String getProjectName();
38:
39: }
|