private void makeVisible(IWizardPage page) {
   if (fVisiblePage == page) return;
   if (fVisiblePage != null) fVisiblePage.setVisible(false);
   fVisiblePage = page;
   fPageContainer.showPage(page.getControl());
   fVisiblePage.setVisible(true);
 }
  protected void okPressed() {
    // CODINGSPECTATOR: This method gets invoked when the user presses OK. So, record the time of
    // the occurrence of this event.
    fWizard.addNavigationHistoryItem(
        new NavigationHistoryItem(fCurrentPage.getName(), IDialogConstants.OK_LABEL));

    IWizardPage current = fCurrentPage;
    saveInitialSize();
    if (fWizard.performFinish()) {
      saveSize();
      super.okPressed();
      return;
    }
    if (fCurrentPage == current) return;
    Assert.isTrue(IErrorWizardPage.PAGE_NAME.equals(fCurrentPage.getName()));
    if (fHasAdditionalPages) {
      // Show error page as a normal page
      showCurrentPage();
    } else if (showErrorDialog((ErrorWizardPage) fCurrentPage)) {
      // Show error page as a dialog
      if (fWizard.performFinish()) {
        super.okPressed();
        return;
      }
    }
  }
 public void setMessage(IWizardPage page) {
   String msg = page.getErrorMessage();
   int type = IMessageProvider.ERROR;
   if (msg == null || msg.length() == 0) {
     msg = page.getMessage();
     type = IMessageProvider.NONE;
     if (msg != null && page instanceof IMessageProvider)
       type = ((IMessageProvider) page).getMessageType();
   }
   Image image = null;
   switch (type) {
     case IMessageProvider.INFORMATION:
       image = RefactoringPluginImages.get(RefactoringPluginImages.IMG_OBJS_REFACTORING_INFO);
       break;
     case IMessageProvider.WARNING:
       image = RefactoringPluginImages.get(RefactoringPluginImages.IMG_OBJS_REFACTORING_WARNING);
       break;
     case IMessageProvider.ERROR:
       image = RefactoringPluginImages.get(RefactoringPluginImages.IMG_OBJS_REFACTORING_ERROR);
       break;
   }
   if (msg == null) msg = ""; // $NON-NLS-1$
   fText.setText(escapeAmpersands(msg));
   if (image == null && msg.length() > 0)
     image = RefactoringPluginImages.get(RefactoringPluginImages.IMG_OBJS_REFACTORING_INFO);
   fImage.setImage(image);
 }
  @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;
  }
  @Override
  public boolean canFinish() {
    IWizardPage page = getFirstPage();
    IWizardPage lastPage = null;
    while (page != null) {
      if (!page.isPageComplete()) return false;
      lastPage = page;
      page = page.getNextPage();
      if (lastPage == page)
        throw new IllegalStateException(
            "Page \""
                + page.getName()
                + "\" returned itself as next page!"); //$NON-NLS-1$ //$NON-NLS-2$
    }
    if (!(lastPage instanceof IDynamicPathWizardPage)) return true;
    if (lastPage == null
        || (lastPage instanceof IDynamicPathWizardPage
            && ((IDynamicPathWizardPage) lastPage).canBeLastPage())) return true;
    else return false;

    //		if (!getWizardEntryPage().isPageComplete())
    //		return false;

    //		if (dynamicWizardPages.size() > 0) {
    //		for (int i = 0; i < dynamicWizardPages.size(); i++) {
    //		if (!((IWizardPage) dynamicWizardPages.get(i)).isPageComplete())
    //		return false;
    //		}
    //		return true; // no page is incomplete
    //		}
    //		else {
    //		return true; // only wizardEntryPage matters
    //		}
  }
 /**
  * Capture page changed event and if current page is WATabPage, then by default select JDK tab.
  */
 @Override
 public void pageChanged(PageChangedEvent event) {
   IWizardPage page = (IWizardPage) event.getSelectedPage();
   if (page.getName().equals(Messages.tbPg)) {
     WATabPage.getFolder().setSelection(WATabPage.getJdkTab());
   }
 }
  protected void assertCanRemoveDynamicWizardPage(IWizardPage page) {
    if (dynamicWizardDialog == null) return;

    IWizardPage currentPage = dynamicWizardDialog.getCurrentPage();
    if (currentPage == null) return;

    if (getPageCount() == 0 && getDynamicWizardPageCount() == 0) {
      throw new IllegalStateException(
          "Cannot remove wizard page! Nothing to remove!"); //$NON-NLS-1$
    }

    IWizardPage pageToCheck = getFirstPage();
    while (pageToCheck != null && pageToCheck != currentPage) {
      if (pageToCheck == page)
        throw new IllegalStateException(
            "Cannot remove page \""
                + page.getName()
                + "\", because it is part of the path BEFORE the current page! Can only remove pages that are following the current page!"); //$NON-NLS-1$ //$NON-NLS-2$
      pageToCheck = pageToCheck.getNextPage();
    }

    if (!dynamicWizardPages.contains(page))
      throw new IllegalStateException(
          "Cannot remove page \""
              + page.getName()
              + "\", because it is not registered as dynamic page! If it is static, you cannot remove it and if it is part of a WizardHop, you must remove it there!"); //$NON-NLS-1$ //$NON-NLS-2$
  }
  /**
   * Test whether a page can be added at the given index.
   *
   * @param index The index to test
   * @throws IllegalStateException if the value of index is illegal
   */
  protected void assertCanInsertDynamicWizardPage(int index) {
    int lastReadOnlyIndex = -1;
    IWizardPage currentPage = dynamicWizardDialog.getCurrentPage();
    if (currentPage == null) return;

    if (getPageCount() == 0 && getDynamicWizardPageCount() == 0) {
      if (index == 0) return;
      else
        throw new IllegalStateException(
            "Cannot add a wizard page at index "
                + index
                + ", it is the first page for this wizard!"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    IWizardPage page = getFirstPage();
    while (page != null && page != currentPage) {
      if (page instanceof IDynamicPathWizardPage) {
        int i = getDynamicWizardPageIndex(page);
        if (i > lastReadOnlyIndex) lastReadOnlyIndex = i;
      }
      page = page.getNextPage();
    }

    if (index <= lastReadOnlyIndex)
      throw new IllegalStateException(
          "Cannot add a wizard page at index "
              + index
              + ", because the current page forces all indices <="
              + lastReadOnlyIndex
              + " to be unchangeable!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  }
 private VoSelectionWizardPage getVoSelectionPage() {
   IWizardPage page = getPreviousPage();
   while ((page != null) && !(page instanceof VoSelectionWizardPage)) {
     page = page.getPreviousPage();
   }
   return (VoSelectionWizardPage) page;
 }
Exemple #10
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.jface.wizard.IWizard#createPageControls(org.eclipse.swt.widgets
  * .Composite)
  */
 public void createPageControls(Composite pageContainer) {
   this.pageContainerHook = pageContainer;
   // the default behavior is to create all the pages controls
   for (int i = 0; i < pages.size(); i++) {
     IWizardPage page = (IWizardPage) pages.get(i);
     page.createControl(pageContainer);
   }
 }
Exemple #11
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.wizard.IWizard#getPage(java.lang.String)
  */
 public IWizardPage getPage(String name) {
   for (int i = 0; i < pages.size(); i++) {
     IWizardPage page = (IWizardPage) pages.get(i);
     String pageName = page.getName();
     if (pageName.equals(name)) return page;
   }
   return null;
 }
 @Override
 public boolean canFinish() {
   IWizardPage currentPage = getContainer().getCurrentPage();
   if (currentPage.getName().equals(PreviewPatchPage2.PREVIEWPATCHPAGE_NAME)) {
     return currentPage.isPageComplete();
   }
   return super.canFinish();
 }
 public void removeAdditionalPage(IWizardPage page, boolean disposePage) {
   if (additionalPages.contains(page)) {
     if (disposePage && page.getControl() != null && !page.getControl().isDisposed()) {
       page.getControl().dispose();
     }
     additionalPages.remove(page);
   }
 }
Exemple #14
0
 public IWizardPage getNextPage() {
   System.out.println("bnext " + bnext);
   if (bnext && cmd.isDeviceConnected()) {
     IWizardPage page = super.getNextPage();
     System.out.println("### " + page.getName());
     return page;
   }
   return null;
 }
  private void backPressed() {
    IWizardPage current = fCurrentPage;
    fCurrentPage = fCurrentPage.getPreviousPage();
    if (current == fCurrentPage) return;

    // CODINGSPECTATOR: Record the time of pressing the back button on the current page.
    fWizard.addNavigationHistoryItem(
        new NavigationHistoryItem(fCurrentPage.getName(), IDialogConstants.BACK_LABEL));

    showCurrentPage();
  }
 public boolean canFinish() {
   boolean result = false;
   IWizardPage currentPage = getContainer().getCurrentPage();
   if (currentPage != null
       && currentPage.equals(exportPage)
       && exportPage.isPageComplete()
       && product != null) {
     result = true;
   }
   return result;
 }
 /*
  * (non-Javadoc) Method declared on IWizard.
  */
 @Override
 public IWizardPage getPage(String name) {
   List<IWizardPage> pages = getAllPageList();
   for (int i = 0; i < pages.size(); i++) {
     IWizardPage page = pages.get(i);
     String pageName = page.getName();
     if (pageName.equals(name)) {
       return page;
     }
   }
   return null;
 }
Exemple #18
0
 public void notifyChange() {
   IWizardPage[] pages = getPages();
   if (pages != null) {
     for (int i = 0; i < pages.length; i++) {
       IWizardPage iWizardPage = pages[i];
       iWizardPage.getWizard().getContainer().updateButtons();
       if (iWizardPage instanceof Listener) {
         ((Listener) iWizardPage).handleEvent(new Event());
       }
     }
   }
 }
 @Override
 public boolean canFinish() {
   boolean canFinish = super.canFinish();
   boolean additionPageAreCompleted = true;
   for (IWizardPage page : additionalPages) {
     additionPageAreCompleted = page.isPageComplete();
     if (!additionPageAreCompleted) {
       break;
     }
   }
   return canFinish && additionPageAreCompleted;
 }
  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;
  }
 private void assertPageDoesNotYetExist(IWizardPage page) {
   for (IWizardPage existingPage : dynamicWizardPages) {
     if (existingPage.getName().equals(page.getName())) {
       if (existingPage == page)
         throw new IllegalStateException(
             "Trying to add the same page instance (named \""
                 + page.getName()
                 + "\") multiple times!"); //$NON-NLS-1$ //$NON-NLS-2$
       else
         throw new IllegalStateException(
             "Another page with the same name (\""
                 + page.getName()
                 + "\") already exists!"); //$NON-NLS-1$ //$NON-NLS-2$
     }
   }
 }
Exemple #22
0
 public IWizardPage getNextPage(IWizardPage page) {
   if (NavigationPage.PAGE_NAME.equals(page.getName())) {
     if (nextPageName != null) {
       WizardPage oldPage = (WizardPage) getPage(nextPageName);
       if (oldPage != null) {
         oldPage.setPageComplete(true);
       }
     }
     nextPageName = navigationPage.getNextPageName();
     WizardPage newPage = (WizardPage) getPage(nextPageName);
     if (newPage != null) {
       newPage.setPageComplete(false);
       return newPage;
     }
     if (LoopupCodePage.PAGE_NAME.equals(nextPageName)) {
       newPage = new LoopupCodePage();
     } else if (ManualDataSetPage.PAGE_NAME.equals(nextPageName)) {
       newPage = new ManualDataSetPage(currentNode);
     } else if (BMSelectionPage.PAGE_NAME.equals(nextPageName)) {
       newPage = new BMSelectionPage();
     }
     newPage.setPageComplete(false);
     addPage(newPage);
     return newPage;
   }
   return null;
 }
  @Override
  public boolean canFinish() {
    Set<DMDLImporterExporterGenerator> set = namePage.getClassName().keySet();

    IWizardPage[] pages = getPages();
    for (IWizardPage page : pages) {
      if (page instanceof SetImporterExporterMethodPage) {
        if (!set.contains(((SetImporterExporterMethodPage) page).getGenerator())) {
          continue;
        }
      }
      if (!page.isPageComplete()) {
        return false;
      }
    }
    return true;
  }
  protected void cancelPressed() {
    // CODINGSPECTATOR: Record the time of pressing the cancel button on the current page.
    fWizard.addNavigationHistoryItem(
        new NavigationHistoryItem(fCurrentPage.getName(), IDialogConstants.CANCEL_LABEL));

    if (fActiveRunningOperations == 0) {
      if (fWizard.performCancel()) super.cancelPressed();
    }
  }
  /*
   * (non-Javadoc)
   * @see org.eclipse.jface.wizard.Wizard
   * #addPage(org.eclipse.jface.wizard.IWizardPage)
   */
  @Override
  public void addPage(IWizardPage page) {
    super.addPage(page);
    page.setWizard(this);

    String title =
        this.petalsMode == PetalsMode.provides
            ? "Petals Service Provider"
            : "Petals Service Consumer";
    title += " (" + getComponentVersionDescription().getComponentAlias() + ")";
    page.setTitle(title);

    if (page.getDescription() == null) {
      if (this.petalsMode == PetalsMode.consumes)
        page.setDescription(getComponentVersionDescription().getConsumeDescription());
      else if (this.petalsMode == PetalsMode.provides)
        page.setDescription(getComponentVersionDescription().getProvideDescription());
    }
  }
  protected void handleShellCloseEvent() {
    // CODINGSPECTATOR: Record the time of quitting the refactoring by clicking on the close button
    // or pressing ESC.
    fWizard.addNavigationHistoryItem(
        new NavigationHistoryItem(fCurrentPage.getName(), NavigationHistoryItem.QUIT_DIALOG_EVENT));

    if (fActiveRunningOperations == 0) {
      if (fWizard.performCancel()) super.handleShellCloseEvent();
    }
  }
 /**
  * @see org.eclipse.jface.wizard.Wizard#canFinish()
  * @since 4.0
  */
 @Override
 public boolean canFinish() {
   boolean canFinish = false;
   IWizardPage[] pages = this.getPages();
   // Can finish if all pages are complete
   IWizardPage page1 = pages[0];
   if (page1.isPageComplete()) {
     IWizardPage page2 = null;
     String importType = this.importTextMainPage.getImportType();
     for (int i = 0; i < importers.length; i++) {
       if (importers[i].getType().equals(importType)) {
         page2 = (IWizardPage) importers[i];
         break;
       }
     }
     if (page2 != null && page2.isPageComplete()) {
       canFinish = true;
     }
   }
   return canFinish;
 }
  // CODINGSPECTATOR: Added button as a parameter to the method so that it can tell which one was
  // pressed "next" or "preview".
  private void nextOrPreviewPressed(Button button) {
    // CODINGSPECTATOR: Record the event of pressing the button on the current page.
    fWizard.addNavigationHistoryItem(
        new NavigationHistoryItem(fCurrentPage.getName(), button.getText()));

    IWizardPage current = fCurrentPage;
    saveInitialSize();

    fCurrentPage = fCurrentPage.getNextPage();
    if (current == fCurrentPage) return;
    if (!fHasAdditionalPages && IErrorWizardPage.PAGE_NAME.equals(fCurrentPage.getName())) {
      if (showErrorDialog((ErrorWizardPage) fCurrentPage)) {
        fCurrentPage = fCurrentPage.getNextPage();
      } else {
        return;
      }
    }
    fCurrentPage.setPreviousPage(current);

    showCurrentPage();
  }
  @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;
  }
Exemple #30
0
  public boolean canFinish() {
    if (!validStatus()) return false;

    try {
      if (m_designSession != null) return m_designSession.getNewWizard().canFinish();
      else {
        if (this.nextPage != null) {
          return nextPage.isPageComplete();
        }
        return isPageComplete();
      }
    } catch (OdaException e) {
      return false;
    }
  }