blob: cda7a812d54707edf535d045a749ec4f533a1986 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2006 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.junit.wizards;
import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.junit.wizards.NewTestCaseWizardPageOne;
import org.eclipse.jdt.junit.wizards.NewTestCaseWizardPageTwo;
import org.eclipse.jdt.internal.junit.ui.JUnitPlugin;
/**
* A wizard for creating test cases.
*/
public class NewTestCaseCreationWizard extends JUnitWizard {
private NewTestCaseWizardPageOne fPage1;
private NewTestCaseWizardPageTwo fPage2;
public NewTestCaseCreationWizard() {
super();
setWindowTitle(WizardMessages.Wizard_title_new_testcase);
initDialogSettings();
}
protected void initializeDefaultPageImageDescriptor() {
setDefaultPageImageDescriptor(JUnitPlugin.getImageDescriptor("wizban/newtest_wiz.png")); //$NON-NLS-1$
}
/*
* @see Wizard#createPages
*/
public void addPages() {
super.addPages();
fPage2= new NewTestCaseWizardPageTwo();
fPage1= new NewTestCaseWizardPageOne(fPage2);
addPage(fPage1);
fPage1.init(getSelection());
addPage(fPage2);
}
/*
* @see Wizard#performFinish
*/
public boolean performFinish() {
if (finishPage(fPage1.getRunnable())) {
IType newClass= fPage1.getCreatedType();
IResource resource= newClass.getCompilationUnit().getResource();
if (resource != null) {
selectAndReveal(resource);
openResource(resource);
}
return true;
}
return false;
}
}