1 11 package org.eclipse.jdt.internal.junit.wizards; 12 13 import org.eclipse.core.resources.IResource; 14 15 import org.eclipse.jdt.core.IType; 16 17 import org.eclipse.jdt.junit.wizards.NewTestCaseWizardPageOne; 18 import org.eclipse.jdt.junit.wizards.NewTestCaseWizardPageTwo; 19 20 import org.eclipse.jdt.internal.junit.ui.JUnitPlugin; 21 22 25 public class NewTestCaseCreationWizard extends JUnitWizard { 26 27 private NewTestCaseWizardPageOne fPage1; 28 private NewTestCaseWizardPageTwo fPage2; 29 30 public NewTestCaseCreationWizard() { 31 super(); 32 setWindowTitle(WizardMessages.Wizard_title_new_testcase); 33 initDialogSettings(); 34 } 35 36 protected void initializeDefaultPageImageDescriptor() { 37 setDefaultPageImageDescriptor(JUnitPlugin.getImageDescriptor("wizban/newtest_wiz.png")); } 39 40 43 public void addPages() { 44 super.addPages(); 45 fPage2= new NewTestCaseWizardPageTwo(); 46 fPage1= new NewTestCaseWizardPageOne(fPage2); 47 addPage(fPage1); 48 fPage1.init(getSelection()); 49 addPage(fPage2); 50 } 51 52 55 public boolean performFinish() { 56 if (finishPage(fPage1.getRunnable())) { 57 IType newClass= fPage1.getCreatedType(); 58 59 IResource resource= newClass.getCompilationUnit().getResource(); 60 if (resource != null) { 61 selectAndReveal(resource); 62 openResource(resource); 63 } 64 return true; 65 } 66 return false; 67 } 68 } 69 | Popular Tags |