@Override
  public boolean importProject(
      final ProjectExample projectDescription,
      File file,
      Map<String, Object> propertiesMap,
      final IProgressMonitor monitor)
      throws Exception {
    List<ProjectExample> projects = new ArrayList<ProjectExample>();
    projects.add(projectDescription);
    List<String> includedProjects = projectDescription.getIncludedProjects();
    if (includedProjects == null) {
      includedProjects = new ArrayList<String>();
      projectDescription.setIncludedProjects(includedProjects);
    }
    projectDescription.getIncludedProjects().clear();
    // JBIDE-12711 : reset welcomeURL for maven archetypes.
    projectDescription.setWelcomeURL(null);
    projectDescription.setWelcome(false);

    String projectName = (String) propertiesMap.get(ProjectExamplesActivator.PROPERTY_PROJECT_NAME);
    includedProjects.add(projectName);
    String artifactId = (String) propertiesMap.get(ProjectExamplesActivator.PROPERTY_ARTIFACT_ID);
    IPath location = (IPath) propertiesMap.get(ProjectExamplesActivator.PROPERTY_LOCATION_PATH);
    String projectFolder = location.append(artifactId).toFile().getAbsolutePath();
    MavenModelManager mavenModelManager = MavenPlugin.getMavenModelManager();

    LocalProjectScanner scanner =
        new LocalProjectScanner(location.toFile(), projectFolder, true, mavenModelManager);
    try {
      scanner.run(monitor);
    } catch (InterruptedException e1) {
      return false;
    }

    Set<MavenProjectInfo> projectSet = collectProjects(scanner.getProjects());
    ProjectImportConfiguration importConfiguration = new ProjectImportConfiguration();

    for (MavenProjectInfo info : projectSet) {
      try {
        projectName = MavenProjectExamplesActivator.getProjectName(info, importConfiguration);
        if (!includedProjects.contains(projectName)) {
          includedProjects.add(projectName);
        }
      } catch (CoreException e) {
        MavenProjectExamplesActivator.log(e);
        return false;
      }
    }
    MavenProjectExamplesActivator.updateMavenConfiguration(projectName, includedProjects, monitor);
    return true;
  }
  @Override
  public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
    projects.clear();
    for (ProjectExample selectedProject : selectedProjects) {
      boolean success = ProjectExamplesActivator.downloadProject(selectedProject, monitor);
      if (success) {
        projects.add(selectedProject);
      } else {
        final String message =
            "Unable to download the '"
                + selectedProject.getName()
                + "' quickstart.\r\nPlease check your Internet connection and/or Proxy Settings";
        Display.getDefault()
            .syncExec(
                new Runnable() {

                  @Override
                  public void run() {
                    MessageDialog.openError(getShell(), "Error", message);
                  }
                });
        return Status.CANCEL_STATUS;
      }
    }
    try {
      setName(Messages.NewProjectExamplesWizard_Importing);
      for (final ProjectExample project : projects) {
        IImportProjectExample importProjectExample =
            ProjectExamplesActivator.getDefault().getImportProjectExample(project.getImportType());
        if (importProjectExample == null) {
          Display.getDefault()
              .syncExec(
                  new Runnable() {

                    public void run() {
                      MessageDialogWithToggle.openError(
                          getShell(),
                          Messages.NewProjectExamplesWizard_Error,
                          "Cannot import a project of the '" + project.getImportType() + "' type.");
                    }
                  });
          return Status.CANCEL_STATUS;
        }
        if (importProjectExample.importProject(
            project, project.getFile(), propertiesMap, monitor)) {
          importProjectExample.fix(project, monitor);
          ProjectExamplesActivator.fixWelcome(project);
        } else {
          return Status.CANCEL_STATUS;
        }
        if (workingSets == null || workingSets.length == 0) {
          if (propertiesMap != null) {
            Object object = propertiesMap.get(WORKING_SETS);
            if (object instanceof List<?>) {
              List<IWorkingSet> list = (List<IWorkingSet>) object;
              workingSets = list.toArray(new IWorkingSet[0]);
            }
          }
        }
        if (workingSets != null
            && workingSets.length > 0
            && project.getIncludedProjects() != null) {
          for (String projectName : project.getIncludedProjects()) {
            IProject eclipseProject =
                ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
            if (eclipseProject != null && eclipseProject.exists()) {
              PlatformUI.getWorkbench()
                  .getWorkingSetManager()
                  .addToWorkingSets(eclipseProject, workingSets);
            }
          }
        }
      }
    } catch (final Exception e) {
      Display.getDefault()
          .syncExec(
              new Runnable() {

                public void run() {
                  MessageDialogWithToggle.openError(
                      getShell(),
                      Messages.NewProjectExamplesWizard_Error,
                      e.getMessage(),
                      Messages.NewProjectExamplesWizard_Detail,
                      false,
                      ProjectExamplesActivator.getDefault().getPreferenceStore(),
                      "errorDialog"); //$NON-NLS-1$
                }
              });
      ProjectExamplesActivator.log(e);
    }
    return Status.OK_STATUS;
  }