/**
  * Get the import job that will be processed by this wizard. Can be null (if provided directory is
  * invalid).
  *
  * @return the import job
  */
 public SmartImportJob getImportJob() {
   final File root = this.projectRootPage.getSelectedRoot();
   if (root == null) {
     return null;
   }
   if (root.isDirectory()) {
     this.directoryToImport = root;
   } else if (SmartImportWizard.isValidArchive(root)) {
     this.directoryToImport = getExpandDirectory(root);
     if (!directoryToImport.isDirectory()) {
       throw new IllegalArgumentException("Archive wasn't expanded first"); // $NON-NLS-1$
     }
   } else {
     return null;
   }
   if (this.easymportJob == null || !matchesPage(this.easymportJob, this.projectRootPage)) {
     this.easymportJob =
         new SmartImportJob(
             this.directoryToImport,
             projectRootPage.getSelectedWorkingSets(),
             projectRootPage.isConfigureProjects(),
             projectRootPage.isDetectNestedProject());
   }
   return this.easymportJob;
 }
 private static boolean matchesPage(SmartImportJob job, SmartImportRootWizardPage page) {
   File jobRoot = job.getRoot().getAbsoluteFile();
   File pageRoot = page.getSelectedRoot().getAbsoluteFile();
   boolean sameSource =
       jobRoot.equals(pageRoot)
           || (isValidArchive(pageRoot)
               && getExpandDirectory(pageRoot).getAbsoluteFile().equals(jobRoot));
   return sameSource
       && job.isDetectNestedProjects() == page.isDetectNestedProject()
       && job.isConfigureProjects() == page.isConfigureProjects();
 }
 @Override
 public boolean performFinish() {
   String[] previousProposals =
       getDialogSettings().getArray(SmartImportRootWizardPage.IMPORTED_SOURCES);
   if (previousProposals == null) {
     previousProposals = new String[0];
   }
   if (!Arrays.asList(previousProposals)
       .contains(this.projectRootPage.getSelectedRoot().getAbsolutePath())) {
     String[] newProposals = new String[previousProposals.length + 1];
     newProposals[0] = this.projectRootPage.getSelectedRoot().getAbsolutePath();
     System.arraycopy(previousProposals, 0, newProposals, 1, previousProposals.length);
     getDialogSettings().put(SmartImportRootWizardPage.IMPORTED_SOURCES, newProposals);
   }
   SmartImportJob job = getImportJob();
   if (projectRootPage.isDetectNestedProject() || projectRootPage.isConfigureProjects()) {
     SmartImportJobReportDialog dialog = new SmartImportJobReportDialog(null);
     dialog.setBlockOnOpen(false);
     getContainer().getShell().setEnabled(false);
     dialog.show(job, getShell());
   }
   job.schedule();
   return true;
 }