public boolean performFinish() {
    IWizardPage[] allPages = getPages();
    for (int i = 0; i < allPages.length; i++) {
      if (allPages[i] instanceof WizardPageWithNotification) {
        ((WizardPageWithNotification) allPages[i]).pageExited(WizardWithNotification.FINISH);
      }
    }

    final boolean create = (this.existingPackage == null);
    final IArchive pkg = firstPage.getArchive();

    boolean performed = performFinish(pkg);

    if (performed) {
      try {
        getContainer()
            .run(
                true,
                false,
                new IRunnableWithProgress() {
                  public void run(IProgressMonitor monitor)
                      throws InvocationTargetException, InterruptedException {
                    IArchiveNode parent;
                    IArchiveNode destNode = firstPage.getDestinationNode();
                    if (destNode != null) {
                      // if we're modifying an existing package, remove old parentage
                      if (!create && !destNode.equals(pkg.getParent())) {
                        if (pkg.getParent() != null) {
                          pkg.getParent().removeChild(pkg);
                        }
                      }
                      parent = (IArchiveNode) destNode;
                    } else {
                      // parent is a String / path, so this is a top level node
                      parent = ArchivesModel.instance().getRoot(project.getLocation());
                      if (parent == null)
                        parent =
                            ArchivesModel.instance().registerProject(project.getLocation(), null);
                    }

                    try {
                      if (create) parent.addChild(pkg);
                      ArchivesModel.instance().getRoot(project.getLocation()).save(monitor);
                    } catch (ArchivesModelException ame) {
                      IStatus status =
                          new Status(
                              IStatus.ERROR,
                              PackagesUIPlugin.PLUGIN_ID,
                              ArchivesUIMessages.ErrorCompletingWizard,
                              ame);
                      PackagesUIPlugin.getDefault().getLog().log(status);
                    }
                  }
                });
      } catch (InvocationTargetException e) {
      } catch (InterruptedException e) {
      }
    }
    return performed;
  }
 public boolean canFinish() {
   if (firstPage.isPageComplete()) {
     for (int i = 0; i < pages.length; i++) {
       if (!pages[i].isPageComplete()) return false;
     }
     return true;
   }
   return false;
 }
 /**
  * Returns the package created by this wizard. Note: This should only be called after the first
  * page has been completed
  *
  * @return The package
  */
 public IArchive getArchive() {
   return firstPage.getArchive();
 }