Beispiel #1
0
 /** @param selection */
 public void setSelection(RepositorySelection selection) {
   if (!selection.equals(validatedRepoSelection)) {
     currentRepoSelection = selection;
     setPageComplete(false);
   } else checkPage();
   revalidate();
 }
Beispiel #2
0
  private void revalidate() {

    if (currentRepoSelection != null && currentRepoSelection.equals(validatedRepoSelection)) {
      // nothing changed on previous page
      checkPage();
      return;
    }

    if (currentRepoSelection == null) return;

    specsPanel.clearRefSpecs();
    specsPanel.setEnable(false);
    saveButton.setVisible(false);
    saveButton.setSelection(false);
    validatedRepoSelection = null;
    transportError = null;
    getControl()
        .getDisplay()
        .asyncExec(
            new Runnable() {
              public void run() {
                revalidateImpl(currentRepoSelection);
              }
            });
  }
Beispiel #3
0
  private void revalidateImpl(final RepositorySelection newRepoSelection) {
    final ListRemoteOperation listRemotesOp;
    try {
      final URIish uri;
      uri = newRepoSelection.getURI(pushPage);
      int timeout =
          Activator.getDefault()
              .getPreferenceStore()
              .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
      listRemotesOp = new ListRemoteOperation(local, uri, timeout);
      if (credentials != null)
        listRemotesOp.setCredentialsProvider(
            new UsernamePasswordCredentialsProvider(
                credentials.getUser(), credentials.getPassword()));
      getContainer()
          .run(
              true,
              true,
              new IRunnableWithProgress() {
                public void run(IProgressMonitor monitor)
                    throws InvocationTargetException, InterruptedException {
                  listRemotesOp.run(monitor);
                }
              });
    } catch (InvocationTargetException e) {
      final Throwable cause = e.getCause();
      transportError(cause.getMessage());
      ErrorDialog.openError(
          getShell(),
          UIText.RefSpecPage_errorTransportDialogTitle,
          UIText.RefSpecPage_errorTransportDialogMessage,
          new Status(IStatus.ERROR, Activator.getPluginId(), 0, cause.getMessage(), cause));
      return;
    } catch (InterruptedException e) {
      transportError(UIText.RefSpecPage_operationCancelled);
      return;
    }

    this.validatedRepoSelection = newRepoSelection;

    specsPanel.setAssistanceData(
        local, listRemotesOp.getRemoteRefs(), currentRepoSelection.getConfig());

    if (newRepoSelection.isConfigSelected()) {
      saveButton.setVisible(true);
      saveButton.setText(
          NLS.bind(UIText.RefSpecPage_saveSpecifications, currentRepoSelection.getConfigName()));
      saveButton.getParent().layout();

      if (!pushPage) {
        tagsAutoFollowButton.setSelection(false);
        tagsFetchTagsButton.setSelection(false);
        tagsNoTagsButton.setSelection(false);

        final TagOpt tagOpt = newRepoSelection.getConfig().getTagOpt();
        switch (tagOpt) {
          case AUTO_FOLLOW:
            tagsAutoFollowButton.setSelection(true);
            break;
          case FETCH_TAGS:
            tagsFetchTagsButton.setSelection(true);
            break;
          case NO_TAGS:
            tagsNoTagsButton.setSelection(true);
            break;
        }
      }
    } else if (!pushPage) tagsAutoFollowButton.setSelection(true);

    checkPage();
  }
  private void setExposedSelection(final URIish u, final RemoteConfig rc) {
    final RepositorySelection newSelection = new RepositorySelection(u, rc);
    if (newSelection.equals(selection)) return;

    selection = newSelection;
  }
 /**
  * Compare current repository selection set by user to provided one.
  *
  * @param s repository selection to compare.
  * @return true if provided selection is equal to current page selection, false otherwise.
  */
 public boolean selectionEquals(final RepositorySelection s) {
   return selection.equals(s);
 }