Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.RemoteConfig


   *            the remote 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 SimpleConfigurePushDialog(shell, repository, configToUse,
View Full Code Here


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

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

    if (configuredConfig != null)
      return configuredConfig;

    if (defaultConfig != null)
      if (!defaultConfig.getPushRefSpecs().isEmpty())
        return defaultConfig;

    return null;
  }
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

    }
  }

  void setSelectedRemote(String remoteName, URIish urIish) {
    try {
      RemoteConfig config = new RemoteConfig(repository.getConfig(),
          remoteName);
      config.addURI(urIish);
      remoteSelectionCombo.setItems(Arrays.asList(config));
      this.remoteConfig = config;
      remoteSelectionCombo.setEnabled(false);
      setRefAssist(this.remoteConfig);
      checkPage();
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.getURIs().isEmpty()
            && !config.getFetchRefSpecs().isEmpty();
      }
    }
    return super.canFinish();
  }
View Full Code Here

    return NLS.bind(UIText.FetchWizard_windowTitleWithSource,
        getSourceString());
  }

  private void saveConfig() {
    final RemoteConfig rc = repoPage.getSelection().getConfig();
    rc.setFetchRefSpecs(refSpecPage.getRefSpecs());
    rc.setTagOpt(refSpecPage.getTagOpt());
    final StoredConfig config = localDb.getConfig();
    rc.update(config);
    try {
      config.save();
    } catch (final IOException e) {
      ErrorDialog.openError(getShell(), UIText.FetchWizard_cantSaveTitle,
          UIText.FetchWizard_cantSaveMessage, new Status(
View Full Code Here

   * @throws CoreException
   */
  public void execute(Repository repository, IProgressMonitor monitor)
      throws CoreException {
    try {
      RemoteConfig configToUse = new RemoteConfig(
          repository.getConfig(), remoteName);
      if (fetchRefSpec != null)
        configToUse.addFetchRefSpec(new RefSpec(fetchRefSpec));
      configToUse.update(repository.getConfig());
      repository.getConfig().save();
      Git git = new Git(repository);
      try {
        git.fetch().setRemote(remoteName).call();
      } catch (Exception e) {
View Full Code Here

        uriString, userMessage);
    Activator.logError(userMessageForUri, e);
  }

  private URIish getPushURIForErrorHandling() {
    RemoteConfig rc = null;
    try {
      rc = new RemoteConfig(localDb.getConfig(), remoteName);
      return rc.getPushURIs().isEmpty() ? rc.getURIs().get(0) : rc
          .getPushURIs().get(0);
    } catch (URISyntaxException e) {
      // should not happen
      Activator.logError("Reading RemoteConfig failed", e); //$NON-NLS-1$
      return null;
View Full Code Here

    }
    if (property.equals("fetchExists")) { //$NON-NLS-1$
      if (node instanceof RemoteNode) {
        String configName = ((RemoteNode) node).getObject();

        RemoteConfig rconfig;
        try {
          rconfig = new RemoteConfig(
              node.getRepository().getConfig(), configName);
        } catch (URISyntaxException e2) {
          return false;
        }
        // we need to have a fetch ref spec and a fetch URI
        return !rconfig.getFetchRefSpecs().isEmpty()
            && !rconfig.getURIs().isEmpty();
      }
    }
    if (property.equals("pushExists")) { //$NON-NLS-1$
      if (node instanceof RemoteNode) {
        String configName = ((RemoteNode) node).getObject();

        RemoteConfig rconfig;
        try {
          rconfig = new RemoteConfig(
              node.getRepository().getConfig(), configName);
        } catch (URISyntaxException e2) {
          return false;
        }
        // we need to have at least a push ref spec and any URI
        return !rconfig.getPushRefSpecs().isEmpty()
            && (!rconfig.getPushURIs().isEmpty() || !rconfig
                .getURIs().isEmpty());
      }
    }
    if (property.equals("canStash")) { //$NON-NLS-1$
      Repository rep = node.getRepository();
View Full Code Here

        continue;

      monitor.subTask(NLS.bind(UIText.SynchronizeFetchJob_SubTaskName,
          remoteName));

      RemoteConfig config;
      try {
        config = new RemoteConfig(repoConfig, remoteName);
      } catch (URISyntaxException e) {
        Activator.logError(e.getMessage(), e);
        continue;
      }
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.