Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.RemoteConfig


      }
    });
  }

  private void pushUpstream(final RevCommit commit) {
    RemoteConfig config = SimpleConfigurePushDialog
        .getConfiguredRemote(repository);
    if (config == null) {
      final Display display = Display.getDefault();
      display.asyncExec(new Runnable() {

        public void run() {
          try {
            PushBranchWizard pushWizard = null;
            String fullBranch = repository.getFullBranch();
            if (fullBranch != null
                && fullBranch.startsWith(Constants.R_HEADS)) {
              Ref ref = repository.getRef(fullBranch);
              pushWizard = new PushBranchWizard(repository, ref);
            } else {
              pushWizard = new PushBranchWizard(repository,
                  commit.getId());
            }
            WizardDialog wizardDialog = new WizardDialog(display
                .getActiveShell(), pushWizard);
            wizardDialog.setHelpAvailable(true);
            wizardDialog.open();
          } catch (IOException e) {
            Activator.handleError(
                NLS.bind(UIText.CommitUI_pushFailedMessage, e),
                e, true);
          }
        }
      });
    } else {
      PushOperationUI op = new PushOperationUI(repository,
          config.getName(), false);
      op.start();
    }

  }
View Full Code Here


   * @param shell
   * @param repository
   * @return the dialog to open, or null
   */
  public static Dialog getDialog(Shell shell, Repository repository) {
    RemoteConfig configToUse = getConfiguredRemote(repository);
    return new SimpleConfigureFetchDialog(shell, repository, configToUse,
        true);
  }
View Full Code Here

   *            the remote name to use
   * @return the dialog to open, or null
   */
  public static Dialog getDialog(Shell shell, Repository repository,
      String remoteName) {
    RemoteConfig configToUse;
    try {
      configToUse = new RemoteConfig(repository.getConfig(), remoteName);
    } catch (URISyntaxException e) {
      Activator.handleError(e.getMessage(), e, true);
      return null;
    }
    return new SimpleConfigureFetchDialog(shell, repository, configToUse,
View Full Code Here

          .getConfig());
    } catch (URISyntaxException e) {
      allRemotes = new ArrayList<RemoteConfig>();
    }

    RemoteConfig defaultConfig = null;
    RemoteConfig configuredConfig = null;
    for (RemoteConfig config : allRemotes) {
      if (config.getName().equals(Constants.DEFAULT_REMOTE_NAME))
        defaultConfig = config;
      if (remoteName != null && config.getName().equals(remoteName))
        configuredConfig = config;
    }

    RemoteConfig configToUse = configuredConfig != null ? configuredConfig
        : defaultConfig;
    return configToUse;
  }
View Full Code Here

      }
      return;
    }
    if (buttonId == REVERT) {
      try {
        config = new RemoteConfig(repository.getConfig(), config
            .getName());
        updateControls();
      } catch (URISyntaxException e) {
        Activator.handleError(e.getMessage(), e, true);
      }
View Full Code Here

  @Override
  public boolean canFinish() {
    if (getContainer().getCurrentPage() == repoPage) {
      RepositorySelection sel = repoPage.getSelection();
      if (sel.isConfigSelected()) {
        RemoteConfig config = sel.getConfig();
        return !config.getPushURIs().isEmpty()
            || !config.getURIs().isEmpty();
      }
    }
    return super.canFinish();
  }
View Full Code Here

    return NLS.bind(UIText.PushWizard_windowTitleWithDestination,
        destination);
  }

  private void saveRefSpecs() {
    final RemoteConfig rc = repoPage.getSelection().getConfig();
    rc.setPushRefSpecs(refSpecPage.getRefSpecs());
    final StoredConfig config = localDb.getConfig();
    rc.update(config);
    try {
      config.save();
    } catch (final IOException e) {
      ErrorDialog.openError(getShell(), UIText.PushWizard_cantSaveTitle,
          UIText.PushWizard_cantSaveMessage, new Status(
View Full Code Here

  }

  private PushOperation createPushOperation(boolean calledFromRepoPage) {
    try {
      final PushOperationSpecification spec;
      final RemoteConfig config = repoPage.getSelection().getConfig();
      if (calledFromRepoPage) {
        // obtain the push ref specs from the configuration
        // use our own list here, as the config returns a non-modifiable
        // list
        final Collection<RefSpec> pushSpecs = new ArrayList<RefSpec>();
        pushSpecs.addAll(config.getPushRefSpecs());
        final Collection<RemoteRefUpdate> updates = Transport
            .findRemoteRefUpdatesFor(localDb, pushSpecs,
                config.getFetchRefSpecs());
        spec = new PushOperationSpecification();
        for (final URIish uri : repoPage.getSelection().getPushURIs())
          spec.addURIRefUpdates(uri, ConfirmationPage
              .copyUpdates(updates));
      } else if (confirmPage.isConfirmed()) {
        final PushOperationResult confirmedResult = confirmPage
            .getConfirmedResult();
        spec = confirmedResult.deriveSpecification(confirmPage
            .isRequireUnchangedSelected());
      } else {
        final Collection<RefSpec> fetchSpecs;
        if (config != null)
          fetchSpecs = config.getFetchRefSpecs();
        else
          fetchSpecs = null;

        final Collection<RemoteRefUpdate> updates = Transport
            .findRemoteRefUpdatesFor(localDb, refSpecPage
View Full Code Here

public class SimplePushActionHandler extends RepositoryActionHandler {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    final Repository repository = getRepository(true, event);
    if (repository == null)
      return null;
    RemoteConfig config = SimpleConfigurePushDialog
        .getConfiguredRemote(repository);
    if (config == null) {
      MessageDialog.openInformation(getShell(event),
          UIText.SimplePushActionHandler_NothingToPushDialogTitle,
          UIText.SimplePushActionHandler_NothingToPushDialogMessage);
      return null;
    }

    PushOperationUI op = new PushOperationUI(repository, config.getName(), false);
    op.start();
    return null;
  }
View Full Code Here

   * @param shell
   * @param repository
   * @return the dialog to open, or null
   */
  public static Dialog getDialog(Shell shell, Repository repository) {
    RemoteConfig configToUse = getConfiguredRemote(repository);
    return new SimpleConfigurePushDialog(shell, repository, configToUse,
        true);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.transport.RemoteConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.