/*
   * (non-Javadoc)
   *
   * @see org.eclipse.pde.internal.ui.wizards.NewWizard#performFinish()
   */
  public boolean performFinish() {
    try {
      fProjectPage.updateData();
      fContentPage.updateData();
      IDialogSettings settings = getDialogSettings();
      if (settings != null) {
        fProjectPage.saveSettings(settings);
        fContentPage.saveSettings(settings);
      }
      BasicNewProjectResourceWizard.updatePerspective(fConfig);
      getContainer()
          .run(
              false,
              true,
              new NewProjectCreationOperation(fPluginData, fProjectProvider, fTemplateWizard));

      IWorkingSet[] workingSets = fProjectPage.getSelectedWorkingSets();
      if (workingSets.length > 0)
        getWorkbench()
            .getWorkingSetManager()
            .addToWorkingSets(fProjectProvider.getProject(), workingSets);

      return true;
    } catch (InvocationTargetException e) {
      PDEPlugin.logException(e);
    } catch (InterruptedException e) {
    }
    return false;
  }
  /* (non-Javadoc)
   * @see org.eclipse.jface.wizard.Wizard#addPages()
   */
  public void addPages() {
    WizardElement templateWizardElement = getTemplateWizard();
    if (templateWizardElement == null) {
      MessageDialog.openError(
          getShell(),
          PDEUIMessages.NewPluginProjectFromTemplateWizard_1,
          NLS.bind(PDEUIMessages.NewPluginProjectFromTemplateWizard_0, getTemplateID()));
      return;
    }

    fProjectPage =
        new NewProjectCreationFromTemplatePage(
            "main", fPluginData, getSelection(), templateWizardElement); // $NON-NLS-1$
    fProjectPage.setTitle(PDEUIMessages.NewProjectWizard_MainPage_title);
    fProjectPage.setDescription(PDEUIMessages.NewProjectWizard_MainPage_desc);

    String projectName = getDefaultValue(DEF_PROJECT_NAME);
    if (projectName != null) fProjectPage.setInitialProjectName(projectName);
    addPage(fProjectPage);

    fProjectProvider =
        new IProjectProvider() {
          public String getProjectName() {
            return fProjectPage.getProjectName();
          }

          public IProject getProject() {
            return fProjectPage.getProjectHandle();
          }

          public IPath getLocationPath() {
            return fProjectPage.getLocationPath();
          }
        };

    fContentPage =
        new PluginContentPage("page2", fProjectProvider, fProjectPage, fPluginData); // $NON-NLS-1$
    addPage(fContentPage);

    try {
      fTemplateWizard = (IPluginContentWizard) templateWizardElement.createExecutableExtension();
      fTemplateWizard.init(fPluginData);
      fTemplateWizard.addPages();
      IWizardPage[] pages = fTemplateWizard.getPages();
      for (int i = 0; i < pages.length; i++) {
        addPage(pages[i]);
      }
    } catch (CoreException e) {
      MessageDialog.openError(
          getShell(),
          PDEUIMessages.NewPluginProjectFromTemplateWizard_1,
          NLS.bind(PDEUIMessages.NewPluginProjectFromTemplateWizard_0, getTemplateID()));
    }
  }