Package org.eclipse.egit.core.op

Examples of org.eclipse.egit.core.op.ListRemoteOperation


    List<Ref> result = new ArrayList<Ref>();
    try {
      boolean local = pushMode == source;
      if (!local) {
        final ListRemoteOperation lop = new ListRemoteOperation(repo,
            uri,
            Activator.getDefault().getPreferenceStore().getInt(
                UIPreferences.REMOTE_CONNECTION_TIMEOUT));

        new ProgressMonitorDialog(shell).run(false, true,
            new IRunnableWithProgress() {

              public void run(IProgressMonitor monitor)
                  throws InvocationTargetException,
                  InterruptedException {
                monitor
                    .beginTask(
                        UIText.RefSpecDialog_GettingRemoteRefsMonitorMessage,
                        IProgressMonitor.UNKNOWN);
                lop.run(monitor);
                monitor.done();
              }
            });
        for (Ref ref : lop.getRemoteRefs())
          if (ref.getName().startsWith(Constants.R_HEADS)
              || (!pushMode && ref.getName().startsWith(
                  Constants.R_TAGS)))
            result.add(ref);
View Full Code Here


      getWizard().getContainer().run(true, true,
          new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor)
                throws InvocationTargetException,
                InterruptedException {
              ListRemoteOperation listOp;
              try {
                listOp = new ListRemoteOperation(
                    repository,
                    new URIish(uriText),
                    Activator
                        .getDefault()
                        .getPreferenceStore()
                        .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT));
              } catch (URISyntaxException e) {
                throw new InvocationTargetException(e);
              }

              listOp.run(monitor);
              changeRefs = new ArrayList<Change>();
              for (Ref ref : listOp.getRemoteRefs()) {
                Change change = Change.fromRef(ref.getName());
                if (change != null)
                  changeRefs.add(change);
              }
              Collections.sort(changeRefs,
View Full Code Here

      }
    });
  }

  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());
      Activator
          .handleError(
              UIText.RefSpecPage_errorTransportDialogMessage,
              cause, true);
      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,
View Full Code Here

  private List<Ref> getRemoteRefs() {
    if (remoteRefs == null) {
      URIish uriToCheck;
      List<Ref> proposals = new ArrayList<Ref>();
      uriToCheck = config.getURIs().get(0);
      final ListRemoteOperation lop = new ListRemoteOperation(repository,
          uriToCheck, Activator.getDefault().getPreferenceStore()
              .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT));
      try {
        new ProgressMonitorDialog(getShell()).run(false, true,
            new IRunnableWithProgress() {
              public void run(IProgressMonitor monitor)
                  throws InvocationTargetException,
                  InterruptedException {
                monitor
                    .beginTask(
                        UIText.FetchSourcePage_GettingRemoteRefsTaskname,
                        IProgressMonitor.UNKNOWN);
                lop.run(monitor);
                monitor.done();
              }
            });
        for (Ref ref : lop.getRemoteRefs()) {
          if (ref.getName().startsWith(Constants.R_HEADS)
              || ref.getName().startsWith(Constants.R_TAGS))
            proposals.add(ref);
        }
        Collections.sort(proposals, new Comparator<Ref>() {
View Full Code Here

  }

  protected static Collection<Ref> getRemoteRefs(URIish uri) throws Exception {
    final Repository db = FileRepositoryBuilder.create(new File("/tmp")); //$NON-NLS-1$
    int timeout = 20;
    ListRemoteOperation listRemoteOp = new ListRemoteOperation(db, uri,
        timeout);
    listRemoteOp.run(null);
    return listRemoteOp.getRemoteRefs();
  }
View Full Code Here

  private void revalidateImpl(final RepositorySelection newRepoSelection) {
    if (label.isDisposed() || !isCurrentPage())
      return;

    final ListRemoteOperation listRemoteOp;
    final URIish uri = newRepoSelection.getURI();
    try {
      final Repository db = FileRepositoryBuilder
          .create(new File("/tmp")); //$NON-NLS-1$
      int timeout = Activator.getDefault().getPreferenceStore().getInt(
          UIPreferences.REMOTE_CONNECTION_TIMEOUT);
      listRemoteOp = new ListRemoteOperation(db, uri, timeout);
      if (credentials != null)
        listRemoteOp
            .setCredentialsProvider(new EGitCredentialsProvider(
                credentials.getUser(), credentials
                    .getPassword()));
      getContainer().run(true, true, new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor)
            throws InvocationTargetException, InterruptedException {
          listRemoteOp.run(monitor);
        }
      });
    } catch (InvocationTargetException e) {
      Throwable why = e.getCause();
      transportError(why);
      if (showDetailedFailureDialog())
        SourceBranchFailureDialog.show(getShell(), uri);
      return;
    } catch (IOException e) {
      transportError(UIText.SourceBranchPage_cannotCreateTemp);
      return;
    } catch (InterruptedException e) {
      transportError(UIText.SourceBranchPage_remoteListingCancelled);
      return;
    }

    final Ref idHEAD = listRemoteOp.getRemoteRef(Constants.HEAD);
    head = null;
    boolean headIsMaster = false;
    final String masterBranchRef = Constants.R_HEADS + Constants.MASTER;
    for (final Ref r : listRemoteOp.getRemoteRefs()) {
      final String n = r.getName();
      if (!n.startsWith(Constants.R_HEADS))
        continue;
      availableRefs.add(r);
      if (idHEAD == null || headIsMaster)
View Full Code Here

  @Test
  public void testListRemote() throws Exception {

    URIish uri = new URIish("file:///"
        + repository2.getRepository().getDirectory().getPath());
    ListRemoteOperation lrop = new ListRemoteOperation(repository1
        .getRepository(), uri, 0);
    lrop.run(null);
    assertEquals(4, lrop.getRemoteRefs().size());
    assertNotNull(lrop.getRemoteRef("refs/heads/test"));

    uri = new URIish("file:///"
        + repository1.getRepository().getDirectory().getPath());
    lrop = new ListRemoteOperation(repository2.getRepository(), uri, 0);
    lrop.run(new NullProgressMonitor());
    assertEquals(2, lrop.getRemoteRefs().size());
    assertNotNull(lrop.getRemoteRef("refs/heads/master"));
  }
View Full Code Here

  @Test
  public void testIllegalStateException() throws Exception {

    URIish uri = new URIish("file:///"
        + repository2.getRepository().getDirectory().getPath());
    ListRemoteOperation lrop = new ListRemoteOperation(repository1
        .getRepository(), uri, 0);
    try {
      lrop.getRemoteRefs();
      fail("Expected Exception not thrown");
    } catch (IllegalStateException e) {
      // expected
    }
  }
View Full Code Here

   */
  @Test
  public void testIllegalURI() throws Exception {

    URIish uri = new URIish("file:///" + "no/path");
    ListRemoteOperation lrop = new ListRemoteOperation(repository1
        .getRepository(), uri, 0);
    try {
      lrop.run(new NullProgressMonitor());
      fail("Expected Exception not thrown");
    } catch (InvocationTargetException e) {
      // expected
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.egit.core.op.ListRemoteOperation

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.