    public void done(IJobChangeEvent event) {
      IStatus result = event.getResult();
      if(result.getSeverity() == IStatus.CANCEL) {
        return;
      } else if(!result.isOK()) {
        return;
      }
      if(projects.isEmpty()) {
        log.info("No Maven projects to import");
        if(collectedLocations.size()==1) {
          final String location = collectedLocations.get(0);
          DirectoryScanner projectScanner = new DirectoryScanner();
          projectScanner.setBasedir(location);
          projectScanner.setIncludes(new String[] {"**/.project"}); 
          projectScanner.scan();
          String[] projectFiles = projectScanner.getIncludedFiles();
          if(projectFiles!=null && projectFiles.length>0) {
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
              public void run() {
                boolean res = MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay().getActiveShell(), 
                    Messages.MavenProjectCheckoutJob_confirm_title, 
                    Messages.MavenProjectCheckoutJob_confirm_message);
                if(res) {
                  IWizard wizard = new ExternalProjectImportWizard(collectedLocations.get(0));
                  WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                      wizard);
                  dialog.open();
                } else {
                  cleanup(collectedLocations);
                }
              }
            });
            return;
          }
          PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
            public void run() {
              boolean res = MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay().getActiveShell(), 
                  Messages.MavenProjectCheckoutJob_confirm2_title, 
                  Messages.MavenProjectCheckoutJob_confirm2_message);
              if(res) {
                Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
                clipboard.setContents(new Object[] { location }, new Transfer[] { TextTransfer.getInstance() });
                NewProjectAction newProjectAction = new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
                newProjectAction.run();
              } else {
                cleanup(collectedLocations);
              }
            }
          });
          return;
        }
        cleanup(collectedLocations);
      }
      if(checkoutAllProjects) {
        if(M2EUIPluginActivator.getDefault().getMavenDiscovery() != null) {
          final LifecycleMappingConfiguration mappingConfiguration = LifecycleMappingConfiguration.calculate(projects,
              configuration, new NullProgressMonitor());
          if(!mappingConfiguration.isMappingComplete()) {
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
              public void run() {
                MavenImportWizard wizard = new MavenImportWizard(configuration, collectedLocations,
                    mappingConfiguration);
                WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard);
                int res = dialog.open();
                if(res == Window.CANCEL) {
                  cleanup(collectedLocations);
                }
              }
            });
            return;
          }
        }
        WorkspaceJob job = new AbstactCreateMavenProjectJob(Messages.MavenProjectCheckoutJob_job, workingSets) {
          @Override
          protected List<IProject> doCreateMavenProjects(IProgressMonitor monitor) throws CoreException {
            Set<MavenProjectInfo> projectSet = MavenPlugin.getProjectConfigurationManager().collectProjects(projects);
            List<IMavenProjectImportResult> results = MavenPlugin.getProjectConfigurationManager().importProjects(
                projectSet, configuration, monitor);
            return toProjects(results);
          }
        };
        ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRuleFactory()
            .modifyRule(ResourcesPlugin.getWorkspace().getRoot());
        job.setRule(rule);
        job.schedule();
      } else {
        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
          public void run() {
            MavenImportWizard wizard = new MavenImportWizard(configuration, collectedLocations);
            WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard);
            int res = dialog.open();
            if(res == Window.CANCEL) {
              cleanup(collectedLocations);
            }
          }
        });
      }
    }

    public void done(IJobChangeEvent event) {
      IStatus result = event.getResult();
      if(result.getSeverity() == IStatus.CANCEL) {
        return;
      } else if(!result.isOK()) {
        return;
      }
      if(projects.isEmpty()) {
        log.info("No Maven projects to import");
        if(collectedLocations.size()==1) {
          final String location = collectedLocations.get(0);
          DirectoryScanner projectScanner = new DirectoryScanner();
          projectScanner.setBasedir(location);
          projectScanner.setIncludes(new String[] {"**/.project"}); 
          projectScanner.scan();
          String[] projectFiles = projectScanner.getIncludedFiles();
          if(projectFiles!=null && projectFiles.length>0) {
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
              public void run() {
                boolean res = MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay().getActiveShell(), 
                    Messages.MavenProjectCheckoutJob_confirm_title, 
                    Messages.MavenProjectCheckoutJob_confirm_message);
                if(res) {
                  IWizard wizard = new ExternalProjectImportWizard(collectedLocations.get(0));
                  WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                      wizard);
                  dialog.open();
                } else {
                  cleanup(collectedLocations);
                }
              }
            });
            return;
          }
          PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
            public void run() {
              boolean res = MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay().getActiveShell(), 
                  Messages.MavenProjectCheckoutJob_confirm2_title, 
                  Messages.MavenProjectCheckoutJob_confirm2_message);
              if(res) {
                Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
                clipboard.setContents(new Object[] { location }, new Transfer[] { TextTransfer.getInstance() });
                NewProjectAction newProjectAction = new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
                newProjectAction.run();
              } else {
                cleanup(collectedLocations);
              }
            }
          });
          return;
        }
        cleanup(collectedLocations);
      }
      if(checkoutAllProjects) {
        if(M2EUIPluginActivator.getDefault().getMavenDiscovery() != null) {
          final LifecycleMappingConfiguration mappingConfiguration = LifecycleMappingConfiguration.calculate(projects,
              configuration, new NullProgressMonitor());
          if(!mappingConfiguration.isMappingComplete(true)) {
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
              public void run() {
                MavenImportWizard wizard = new MavenImportWizard(configuration, collectedLocations,
                    mappingConfiguration);
                WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard);
                int res = dialog.open();
                if(res == Window.CANCEL) {
                  cleanup(collectedLocations);
                }
              }
            });
            return;
          }
        }
        WorkspaceJob job = new AbstactCreateMavenProjectJob(Messages.MavenProjectCheckoutJob_job, workingSets) {
          @Override
          protected List<IProject> doCreateMavenProjects(IProgressMonitor monitor) throws CoreException {
            Set<MavenProjectInfo> projectSet = MavenPlugin.getProjectConfigurationManager().collectProjects(projects);
            List<IMavenProjectImportResult> results = MavenPlugin.getProjectConfigurationManager().importProjects(
                projectSet, configuration, monitor);
            return toProjects(results);
          }
        };
        ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRuleFactory()
            .modifyRule(ResourcesPlugin.getWorkspace().getRoot());
        job.setRule(rule);
        job.schedule();
      } else {
        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
          public void run() {
            MavenImportWizard wizard = new MavenImportWizard(configuration, collectedLocations);
            WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard);
            int res = dialog.open();
            if(res == Window.CANCEL) {
              cleanup(collectedLocations);
            }
          }
        });
      }
    }
