5656import org .eclipse .ui .internal .wizards .datatransfer .WizardProjectsImportPage .ProjectRecord ;
5757import org .eclipse .ui .tests .TestPlugin ;
5858import org .eclipse .ui .tests .datatransfer .ImportTestUtils .TestBuilder ;
59- import org .eclipse .ui .tests .harness .util .DialogCheck ;
6059import org .eclipse .ui .tests .harness .util .FileUtil ;
6160import org .eclipse .ui .tests .harness .util .UITestCase ;
6261import org .eclipse .ui .wizards .datatransfer .ExternalProjectImportWizard ;
@@ -86,14 +85,16 @@ public class ImportExistingProjectsWizardTest extends UITestCase {
8685
8786 private String zipLocation = null ;
8887
88+ private WizardDialog dialog ;
89+
8990 private boolean originalRefreshSetting ;
9091
9192 public ImportExistingProjectsWizardTest () {
9293 super (ImportExistingProjectsWizardTest .class .getName ());
9394 }
9495
9596 private Shell getShell () {
96- return DialogCheck .getShell ();
97+ return PlatformUI . getWorkbench (). getActiveWorkbenchWindow () .getShell ();
9798 }
9899
99100 @ Override
@@ -109,6 +110,11 @@ protected void doSetUp() throws Exception {
109110
110111 @ Override
111112 protected void doTearDown () throws Exception {
113+ if (dialog != null ) {
114+ dialog .close ();
115+ dialog = null ;
116+ }
117+
112118 IWorkspaceRoot wsRoot = ResourcesPlugin .getWorkspace ().getRoot ();
113119 IProject [] projects = wsRoot .getProjects ();
114120 for (int i = projects .length - 1 ; i >= 0 ; i --) {
@@ -799,8 +805,6 @@ public void test14InitialValue() throws IOException, CoreException {
799805 wpip = getExternalImportWizard (null );
800806 selectedProjects = wpip .getProjectRecords ();
801807 assertEquals (0 , selectedProjects .length );
802-
803-
804808 }
805809
806810 @ Test
@@ -900,7 +904,6 @@ private String copyZipLocation(String zipLocation) throws IOException {
900904 return ImportTestUtils .copyZipLocation (zipLocation , ARCHIVE_HELLOWORLD );
901905 }
902906
903-
904907 private WizardProjectsImportPage getNewWizard () {
905908 ImportExportWizard wizard = new ImportExportWizard (
906909 ImportExportWizard .IMPORT );
@@ -920,7 +923,10 @@ private WizardProjectsImportPage getNewWizard() {
920923
921924 Shell shell = getShell ();
922925
923- WizardDialog dialog = new WizardDialog (shell , wizard );
926+ if (dialog != null ) {
927+ dialog .close ();
928+ }
929+ dialog = new WizardDialog (shell , wizard );
924930 dialog .create ();
925931 dialog .getShell ().setSize (Math .max (100 , dialog .getShell ().getSize ().x ),
926932 100 );
@@ -1176,7 +1182,10 @@ private WizardProjectsImportPage getExternalImportWizard(String initialPath) {
11761182 ExternalProjectImportWizard wizard = new ExternalProjectImportWizard (
11771183 initialPath );
11781184 wizard .init (getWorkbench (), null );
1179- WizardDialog dialog = new WizardDialog (getShell (), wizard );
1185+ if (dialog != null ) {
1186+ dialog .close ();
1187+ }
1188+ dialog = new WizardDialog (getShell (), wizard );
11801189 dialog .create ();
11811190
11821191 dialog .getShell ().setSize (Math .max (100 , dialog .getShell ().getSize ().x ),
0 commit comments