@Override
  public void addPages() {

    super.addPages();

    fMainPage = new NewQVTProjectCreationPage("main", fProjectData); // $NON-NLS-1$
    fMainPage.setTitle(Messages.NewTransformationProject_Title);
    fMainPage.setDescription(Messages.NewTransformationProject_Description);
    addPage(fMainPage);

    fContentPage = new NewQVTProjectContentPage("page2", fMainPage, fProjectData); // $NON-NLS-1$
    fWizardSelectionPage = new QVTWizardListSelectionPage(getDestinationProvider());
    addPage(fContentPage);
    addPage(fWizardSelectionPage);
  }
  @Override
  public boolean performFinish() {
    if (fIsFinishPerformed) {
      return true;
    }

    try {
      fMainPage.updateData();
      fContentPage.updateData();

      if (fConfig != null) {
        BasicNewProjectResourceWizard.updatePerspective(fConfig);
      }

      if (!fProjectData.isCreateJava()) {
        // ensure no Activator class is requested to generate, in case
        // it has been previously selected in the new content page
        fProjectData.setDoGenerateClass(false);
      }

      final WorkspaceModifyOperation operation;
      if (fMainPage.isCreatePlugin()) {
        operation = createNewPluginProjectOperation();
      } else {
        operation = createNewSimpleProjectOperation();
      }

      getContainer().run(false, true, operation);
    } catch (InterruptedException e) {
      // operation canceled
    } catch (Exception e) {
      QVTUIPlugin.log(e);
      String title = Messages.NewQVTProjectWizard_Error;
      String message = Messages.NewQVTProjectWizard_ErrorSeeLog;
      Throwable exc =
          (e instanceof InvocationTargetException)
              ? ((InvocationTargetException) e).getTargetException()
              : e;
      Status status = new Status(IStatus.ERROR, QVTUIPlugin.PLUGIN_ID, IStatus.ERROR, message, exc);
      ErrorDialog.openError(getShell(), title, e.getMessage(), status);
      return false;
    }

    fIsFinishPerformed = true;
    return true;
  }
 private WorkspaceModifyOperation createNewPluginProjectOperation() {
   return new NewProjectCreationOperation(fMainPage.getProjectHandle(), fProjectData) {
     @Override
     protected void createContents(IProgressMonitor monitor, IProject project)
         throws CoreException, InterruptedException {
       doPostCreateProjectAction(project, monitor);
     }
   };
 }
 @Override
 public IWizardPage getPreviousPage(IWizardPage page) {
   IWizardPage prevPage = super.getPreviousPage(page);
   if (prevPage == fContentPage) {
     if (!fMainPage.isCreatePlugin()) {
       prevPage = fMainPage;
     }
   }
   return prevPage;
 }
 @Override
 public IWizardPage getNextPage(IWizardPage page) {
   IWizardPage nextPage = super.getNextPage(page);
   if (nextPage == fContentPage) {
     if (!fMainPage.isCreatePlugin()) {
       nextPage = fWizardSelectionPage;
     }
   }
   return nextPage;
 }
  /*
   * Copied from BasicNewProjectResourceWizard (modified)
   */
  private WorkspaceModifyOperation createNewSimpleProjectOperation() {
    final IProject newProjectHandle = fMainPage.getProjectHandle();
    URI location = null;
    if (!fMainPage.useDefaults()) {
      location = fMainPage.getLocationURI();
    }

    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    final IProjectDescription description =
        workspace.newProjectDescription(newProjectHandle.getName());
    description.setLocationURI(location);

    WorkspaceModifyOperation op =
        new WorkspaceModifyOperation() {
          @Override
          protected void execute(IProgressMonitor monitor) throws CoreException {
            createProject(description, newProjectHandle, monitor);
            doPostCreateProjectAction(newProjectHandle, monitor);
          }
        };
    return op;
  }
  private void doPostCreateProjectAction(IProject createdProject, IProgressMonitor monitor)
      throws CoreException {
    // Create QVT source container
    IContainer srcContainer = fMainPage.getQVTSourceContainerHandle();
    if (srcContainer instanceof IFolder) {
      SourceContainerUpdater.ensureDestinationExists((IFolder) srcContainer, monitor);
    }

    QVTOBuilderConfig qvtConfig = QVTOBuilderConfig.getConfig(createdProject);
    qvtConfig.setSourceContainer(srcContainer);
    qvtConfig.addTransformationNature();

    monitor.worked(1);
  }