Esempio n. 1
0
  /**
   * Show the new token wizard. If the specified description is not null the wizard will be started
   * with the wizard page belonging to the specified description. Otherwise it will be started with
   * the token type page as starting page where the user can choose the type of the he wants to
   * create.
   *
   * @param tokenWizardId The ID of the token type that should be created or null.
   * @param forceWizardId
   * @param description Token description passed to the token specific wizard pages in order to
   *     allow initialisation for a predefined token type.
   * @return True if the token dialog was closed with status {@link Window#OK}.
   */
  public boolean showNewTokenWizard(
      final String tokenWizardId,
      final boolean forceWizardId,
      final IAuthenticationTokenDescription description) {
    URL imgUrl =
        Activator.getDefault().getBundle().getEntry("icons/wizban/newtoken_wiz.gif"); // $NON-NLS-1$

    Wizard wizard =
        new Wizard() {
          @Override
          public boolean performFinish() {
            return false;
          }

          @Override
          public void addPages() {
            List<String> filterList = null;
            if (tokenWizardId != null) {
              filterList = new LinkedList<String>();
              filterList.add(tokenWizardId);
            }
            ExtPointWizardSelectionListPage page =
                new ExtPointWizardSelectionListPage(
                    WIZARD_PAGE_NAME,
                    Extensions.AUTH_TOKEN_UI_POINT,
                    filterList,
                    forceWizardId,
                    Messages.getString(
                        "UIAuthTokenProvider.wizard_first_page_title"), //$NON-NLS-1$
                    Messages.getString(
                        "UIAuthTokenProvider.wizard_first_page_description"), //$NON-NLS-1$
                    Messages.getString("UIAuthTokenProvider.noTokenCreator")); // $NON-NLS-1$
            //        page.setPreselectedId( tokenWizardId, true );
            page.setInitData(description);
            page.setCheatSheetManager(cheatSheetManager);
            addPage(page);
          }
        };

    wizard.setNeedsProgressMonitor(true);
    wizard.setForcePreviousAndNextButtons(true);
    wizard.setWindowTitle(Messages.getString("UIAuthTokenProvider.wizard_title")); // $NON-NLS-1$
    wizard.setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(imgUrl));
    WizardDialog dialog = new WizardDialog(this.shell, wizard);
    return dialog.open() == Window.OK;
  }
Esempio n. 2
0
    private IConversionContext setupwizard(IConversionContext context) {
      final SetUpProcessWizardPage convertPage = new SetUpProcessWizardPage(context);

      Wizard wiz =
          new Wizard() {
            // set
            @Override
            public boolean performFinish() {
              convertPage.populateContext();
              return true;
            }
          };

      wiz.setNeedsProgressMonitor(true);
      wiz.addPage(convertPage);
      final WizardDialog wd = new WizardDialog(getSite().getShell(), wiz);
      wd.setPageSize(new Point(900, 500));
      wd.create();
      context.setConversionScheme(ConversionScheme.PROCESS);

      if (wd.open() == WizardDialog.OK) return context;

      return null;
    }