@Override
  public IWizardPage getPreviousPage(IWizardPage page) {
    IWizardPage previousPage = null;

    if (currentAdditionalPages == null) {
      if (page.equals(scriptPage)) {
        previousPage = toolPage;
      } else {
        previousPage = super.getPreviousPage(page);
      }
    } else {
      if (page.equals(scriptPage)) {
        previousPage = currentAdditionalPages.get(currentAdditionalPages.size() - 1);
      } else if (currentAdditionalPages.contains(page)
          && currentAdditionalPages.indexOf(page) > 0) {
        previousPage = currentAdditionalPages.get(currentAdditionalPages.indexOf(page) - 1);
      } else if (currentAdditionalPages.contains(page)
          && currentAdditionalPages.indexOf(page) == 0) {
        previousPage = scriptPage;
      } else if (page.equals(editConfigurationPage)) {
        return null;
      } else {
        previousPage = super.getPreviousPage(page);
      }
    }

    if (previousPage != null) {
      ((ToolIntegrationWizardPage) previousPage).updatePage();
    }
    return previousPage;
  }
  public IWizardPage getNextPage(final IWizardPage page) {
    IWizardPage nextPage = null;
    if (page.equals(selectionPage)) {
      if (isProductValid) {
        nextPage = exportPage;
      } else {
        nextPage = validationPage;
      }
    } else if (page.equals(validationPage)) {
      nextPage = exportPage;
    }

    return nextPage;
  }
 public boolean canFinish() {
   boolean result = false;
   IWizardPage currentPage = getContainer().getCurrentPage();
   if (currentPage != null
       && currentPage.equals(exportPage)
       && exportPage.isPageComplete()
       && product != null) {
     result = true;
   }
   return result;
 }
  @Override
  public IWizardPage getNextPage(IWizardPage page) {
    IWizardPage nextPage = null;
    if (currentAdditionalPages == null) {
      if (page.equals(toolPage)) {
        nextPage = scriptPage;
      } else if (page.equals(scriptPage)) {
        for (String key : additionalPages.keySet()) {
          for (ToolIntegrationWizardPage addPage : additionalPages.get(key)) {
            addPage.setPageComplete(true);
          }
        }
        return null;
      } else {
        nextPage = super.getNextPage(page);
      }
    } else {
      if (page.equals(toolPage)) {
        nextPage = currentAdditionalPages.get(0);
      } else if (currentAdditionalPages.contains(page)
          && currentAdditionalPages.indexOf(page) < currentAdditionalPages.size() - 1) {
        nextPage = currentAdditionalPages.get(currentAdditionalPages.indexOf(page) + 1);
      } else if (currentAdditionalPages.contains(page)
          && currentAdditionalPages.indexOf(page) == currentAdditionalPages.size() - 1) {
        nextPage = scriptPage;
      } else if (page.equals(scriptPage)) {
        return null;
      } else {
        nextPage = super.getNextPage(page);
      }
    }

    if (nextPage != null) {
      ((ToolIntegrationWizardPage) nextPage).updatePage();
    }
    return nextPage;
  }
  /** @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage) */
  @Override
  public IWizardPage getNextPage(final IWizardPage thePage) {
    /*----------------------------------------
     Pages:
        A. importTypeSelectionPage
        B. importPage
    ------------------------------------------*/

    IWizardPage result = null;

    // only need to define logic for those pages where the next page is dynamic.
    // the call to super will handle everything else.

    if (thePage == this.importTextMainPage) {
      String importType = this.importTextMainPage.getImportType();
      for (int i = 0; i < importers.length; i++) {
        if (importers[i].getType().equals(importType)) {
          result = (IWizardPage) importers[i];
          break;
        }
      }
      this.importTextMainPage.saveWidgetValues();
    } else {
      boolean isContributed = false;
      // be sure thePage is contributed
      // for( int i=0; i<importers.length; i++ ) {
      for (int i = 0; i < importers.length; i++) {
        if (thePage.equals(importers[i])) {
          isContributed = true;
          break;
        }
      }
      if (!isContributed)
        CoreArgCheck.isTrue(false, "Unexpected TextImport Wizard Page:" + thePage); // $NON-NLS-1$
    }

    return result;
  }
 private boolean isFirstPage() {
   IWizardPage[] pages = fWizard.getPages();
   return (fCurrentPage.equals(pages[0]));
 }