コード例 #1
0
  @Deprecated
  public void promptToAddQuery(TaskRepository taskRepository) {
    IPreferenceStore preferenceStore = TasksUiPlugin.getDefault().getPreferenceStore();
    if (!preferenceStore.getBoolean(PREF_ADD_QUERY)) {
      Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
      MessageDialogWithToggle messageDialog =
          MessageDialogWithToggle.openYesNoQuestion(
              shell,
              Messages.AddRepositoryAction_Add_new_query,
              Messages.AddRepositoryAction_Add_a_query_to_the_Task_List,
              Messages.AddRepositoryAction_Do_not_show_again,
              false,
              preferenceStore,
              PREF_ADD_QUERY);
      preferenceStore.setValue(PREF_ADD_QUERY, messageDialog.getToggleState());
      if (messageDialog.getReturnCode() == IDialogConstants.YES_ID) {
        AbstractRepositoryConnectorUi connectorUi =
            TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
        IWizard queryWizard = connectorUi.getQueryWizard(taskRepository, null);
        if (queryWizard instanceof Wizard) {
          ((Wizard) queryWizard).setForcePreviousAndNextButtons(true);
        }

        WizardDialog queryDialog = new WizardDialog(shell, queryWizard);
        queryDialog.create();
        queryDialog.setBlockOnOpen(true);
        queryDialog.open();
      }
    }
  }
コード例 #2
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;
  }