Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.URIish


  public RepositorySelectionPage(final boolean sourceSelection,
      final List<RemoteConfig> configuredRemotes, String presetUri) {

    super(RepositorySelectionPage.class.getName());

    this.uri = new URIish();
    this.sourceSelection = sourceSelection;

    String preset = presetUri;
    if (presetUri == null) {
      Clipboard clippy = new Clipboard(Display.getCurrent());
      String text = (String) clippy.getContents(TextTransfer
          .getInstance());
      try {
        if (text != null) {
          text = text.trim();
          int index = text.indexOf(' ');
          if (index > 0)
            text = text.substring(0, index);
          URIish u = new URIish(text);
          if (canHandleProtocol(u))
            if (Protocol.GIT.handles(u) || Protocol.SSH.handles(u)
                || text.endsWith(Constants.DOT_GIT_EXT))
              preset = text;
        }
View Full Code Here


            File testFile = new File(uriText.getText());
            if (testFile.exists())
              dialog.setFilterPath(testFile.getPath());
            else {
              // this could still be a file URIish
              URIish testUri = new URIish(uriText.getText());
              if (testUri.getScheme().equals(
                  Protocol.FILE.defaultScheme)) {
                testFile = new File(uri.getPath());
                if (testFile.exists())
                  dialog.setFilterPath(testFile.getPath());
              }
View Full Code Here

        selectionIncomplete(UIText.RepositorySelectionPage_UriMustNotHaveTrailingSpacesMessage);
        return;
      }

      try {
        final URIish finalURI = new URIish(uriText.getText().trim());
        String proto = finalURI.getScheme();
        if (proto == null && scheme.getSelectionIndex() >= 0)
          proto = scheme.getItem(scheme.getSelectionIndex());

        if (uri.getPath() == null) {
          selectionIncomplete(NLS.bind(
              UIText.RepositorySelectionPage_fieldRequired,
              unamp(UIText.RepositorySelectionPage_promptPath),
              proto));
          return;
        }

        if (Protocol.FILE.handles(finalURI)) {
          String badField = null;
          if (uri.getHost() != null)
            badField = UIText.RepositorySelectionPage_promptHost;
          else if (uri.getUser() != null)
            badField = UIText.RepositorySelectionPage_promptUser;
          else if (uri.getPass() != null)
            badField = UIText.RepositorySelectionPage_promptPassword;
          if (badField != null) {
            selectionIncomplete(NLS
                .bind(
                    UIText.RepositorySelectionPage_fieldNotSupported,
                    unamp(badField), proto));
            return;
          }

          final File d = FS.DETECTED.resolve(
              new File("."), uri.getPath()); //$NON-NLS-1$
          if (!d.exists()) {
            selectionIncomplete(NLS.bind(
                UIText.RepositorySelectionPage_fileNotFound,
                    d.getAbsolutePath()));
            return;
          }

          selectionComplete(finalURI, null);
          return;
        }

        if (uri.getHost() == null) {
          selectionIncomplete(NLS.bind(
              UIText.RepositorySelectionPage_fieldRequired,
              unamp(UIText.RepositorySelectionPage_promptHost),
              proto));
          return;
        }

        if (Protocol.GIT.handles(finalURI)) {
          String badField = null;
          if (uri.getUser() != null)
            badField = UIText.RepositorySelectionPage_promptUser;
          else if (uri.getPass() != null)
            badField = UIText.RepositorySelectionPage_promptPassword;
          if (badField != null) {
            selectionIncomplete(NLS
                .bind(
                    UIText.RepositorySelectionPage_fieldNotSupported,
                    unamp(badField), proto));
            return;
          }
        }

        if (Protocol.HTTP.handles(finalURI)
            || Protocol.HTTPS.handles(finalURI)) {
          UserPasswordCredentials credentials = SecureStoreUtils
              .getCredentials(finalURI);
          if (credentials != null) {
            String u = credentials.getUser();
            String p = credentials.getPassword();
            String uriUser = finalURI.getUser();
            if (uriUser == null) {
              if (setSafeUser(u) && setSafePassword(p))
                setStoreInSecureStore(true);
            } else if (uriUser.length() != 0 && uriUser.equals(u)) {
              if (setSafePassword(p))
View Full Code Here

    try {
      eventDepth++;
      if (eventDepth != 1)
        return;

      final URIish u = new URIish(text);
      safeSet(hostText, u.getHost());
      safeSet(pathText, u.getPath());
      safeSet(userText, u.getUser());
      safeSet(passText, u.getPass());

      if (u.getPort() > 0)
        portText.setText(Integer.toString(u.getPort()));
      else
        portText.setText(EMPTY_STRING);

      if (u.getScheme() != null) {
        scheme.select(scheme.indexOf(u.getScheme()));
        scheme.notifyListeners(SWT.Selection, new Event());
      }

      updateGroups();
      uri = u;
    } catch (URISyntaxException err) {
      // leave uriText as it is, but clean up underlying uri and
      // decomposed fields
      uri = new URIish();
      hostText.setText(EMPTY_STRING);
      pathText.setText(EMPTY_STRING);
      userText.setText(EMPTY_STRING);
      passText.setText(EMPTY_STRING);
      portText.setText(EMPTY_STRING);
View Full Code Here

  protected Control createDialogArea(Composite parent) {
    Composite main = new Composite(parent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(main);
    main.setLayout(new GridLayout(2, false));

    URIish uriToCheck;
    if (pushMode) {
      if (config.getPushURIs().isEmpty())
        uriToCheck = config.getURIs().get(0);
      else
        uriToCheck = config.getPushURIs().get(0);
View Full Code Here

        String errorMessage = e.getCause() != null ? e.getCause()
            .getMessage() : e.getMessage();
        String userMessage = NLS.bind(
            CoreText.PushOperation_InternalExceptionOccurredMessage,
            errorMessage);
        URIish uri = getPushURIForErrorHandling();
        handleException(uri, e, userMessage);
      } catch (Exception e) {
        URIish uri = getPushURIForErrorHandling();
        handleException(uri, e, e.getMessage());
      }
    }
    monitor.done();
  }
View Full Code Here

   * @param gitRepositoryInfo
   * @return if clone was successful
   * @throws URISyntaxException
   */
  protected boolean performClone(GitRepositoryInfo gitRepositoryInfo) throws URISyntaxException {
    URIish uri = new URIish(gitRepositoryInfo.getCloneUri());
    UserPasswordCredentials credentials = gitRepositoryInfo.getCredentials();
    setWindowTitle(NLS.bind(UIText.GitCloneWizard_jobName, uri.toString()));
    final boolean allSelected;
    final Collection<Ref> selectedBranches;
    if (validSource.isSourceRepoEmpty()) {
      // fetch all branches of empty repo
      allSelected = true;
View Full Code Here

  /**
   * @return the repository selected by the user
   */
  protected RepositorySelection getRepositorySelection() {
    try {
      return (new RepositorySelection(new URIish(currentSearchResult.getGitRepositoryInfo().getCloneUri()), null));
    } catch (URISyntaxException e) {
      Activator.error(UIText.GitImportWizard_errorParsingURI, e);
      return null;
    } catch (NoRepositoryInfoException e) {
      Activator.error(UIText.GitImportWizard_noRepositoryInfo, e);
View Full Code Here

  private void configurePush(CloneOperation op,
      GitRepositoryInfo gitRepositoryInfo, String remoteName) {
    for (PushInfo pushInfo : gitRepositoryInfo.getPushInfos())
      try {
        URIish uri = pushInfo.getPushUri() != null ? new URIish(
            pushInfo.getPushUri()) : null;
        ConfigurePushAfterCloneTask task = new ConfigurePushAfterCloneTask(
            remoteName, pushInfo.getPushRefSpec(), uri);
        op.addPostCloneTask(task);
      } catch (URISyntaxException e) {
View Full Code Here

    op.run(monitor);
    util.addConfiguredRepository(op.getGitDir());
    try {
      if (repositoryInfo.shouldSaveCredentialsInSecureStore())
        SecureStoreUtils.storeCredentials(repositoryInfo.getCredentials(),
            new URIish(repositoryInfo.getCloneUri()));
    } catch (Exception e) {
      Activator.error(e.getMessage(), e);
    }
    return Status.OK_STATUS;
  }
View Full Code Here

TOP

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

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.