summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2013-06-05 04:56:28 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-06-19 13:25:53 (EDT)
commitba5d8f080a5cb7485f21cac2ad7a70c08068156a (patch)
treeb20c218e5b591d268678ad55eb17b2c2ec3529a9
parent1580ce12abcb0ee64f9e055bf1c0fcb1adb29acd (diff)
downloadorg.eclipse.mylyn.reviews-ba5d8f080a5cb7485f21cac2ad7a70c08068156a.zip
org.eclipse.mylyn.reviews-ba5d8f080a5cb7485f21cac2ad7a70c08068156a.tar.gz
org.eclipse.mylyn.reviews-ba5d8f080a5cb7485f21cac2ad7a70c08068156a.tar.bz2
use API from EGit 1.1 to set credentials provider on FetchOperationUIrefs/changes/76/13576/2
-rw-r--r--org.eclipse.mylyn.gerrit.ui/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/egit/EGitUiUtil.java28
2 files changed, 5 insertions, 27 deletions
diff --git a/org.eclipse.mylyn.gerrit.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.gerrit.ui/META-INF/MANIFEST.MF
index 956b494..af20646 100644
--- a/org.eclipse.mylyn.gerrit.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.gerrit.ui/META-INF/MANIFEST.MF
@@ -24,8 +24,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui.workbench.texteditor,
org.eclipse.emf.ecore,
org.eclipse.jgit,
- org.eclipse.egit.core,
- org.eclipse.egit.ui,
+ org.eclipse.egit.core;bundle-version="1.1.0",
+ org.eclipse.egit.ui;bundle-version="1.1.0",
org.eclipse.mylyn.commons.net;bundle-version="3.8.0",
org.eclipse.mylyn.tasks.ui;bundle-version="3.8.0",
org.eclipse.ui.navigator,
diff --git a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/egit/EGitUiUtil.java b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/egit/EGitUiUtil.java
index 7cf4474..8d60769 100644
--- a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/egit/EGitUiUtil.java
+++ b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/egit/EGitUiUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Tasktop Technologies and others.
+ * Copyright (c) 2011, 2013 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,19 +13,17 @@
package org.eclipse.mylyn.internal.gerrit.ui.egit;
import java.io.IOException;
-import java.lang.reflect.Method;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.internal.clone.AbstractGitCloneWizard;
import org.eclipse.egit.ui.internal.clone.GitCloneWizard;
+import org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider;
import org.eclipse.egit.ui.internal.fetch.FetchOperationUI;
import org.eclipse.egit.ui.internal.provisional.wizards.GitRepositoryInfo;
import org.eclipse.egit.ui.internal.provisional.wizards.IRepositorySearchResult;
@@ -41,11 +39,9 @@ import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
-import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.gerrit.core.GerritCorePlugin;
import org.eclipse.mylyn.internal.gerrit.core.GerritUtil;
import org.eclipse.mylyn.internal.gerrit.core.client.GerritConfiguration;
-import org.eclipse.mylyn.internal.gerrit.ui.GerritUiPlugin;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.swt.widgets.Shell;
@@ -62,24 +58,6 @@ public class EGitUiUtil {
private static boolean credentialsProviderWarningLogged;
- public static void setCredentialsProvider(FetchOperationUI op) {
- // TODO EGit1.1 replace with op.setCredentialsProvider(new EGitCredentialsProvider())
- try {
- Class clazz = Class.forName("org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider");
- Method method = FetchOperationUI.class.getDeclaredMethod("setCredentialsProvider", clazz);
- method.invoke(op, clazz.newInstance());
- } catch (Exception e) {
- if (!credentialsProviderWarningLogged) {
- credentialsProviderWarningLogged = true;
- StatusHandler.log(new Status(
- IStatus.WARNING,
- GerritUiPlugin.PLUGIN_ID,
- "Fetch operation may fail: EGit credentials provider not available. EGit 1.1 or later is required.",
- e));
- }
- }
- }
-
public static RevCommit getRevCommit(Repository repository, PatchSet target) throws AmbiguousObjectException,
IOException, MissingObjectException, IncorrectObjectTypeException {
ObjectId ref = repository.resolve(target.getRevision().get());
@@ -94,7 +72,7 @@ public class EGitUiUtil {
List<RefSpec> refSpecs = Collections.singletonList(refSpec);
FetchOperationUI op = new FetchOperationUI(repository, remote.getURIs().get(0), refSpecs,
Activator.getDefault().getPreferenceStore().getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT), false);
- EGitUiUtil.setCredentialsProvider(op);
+ op.setCredentialsProvider(new EGitCredentialsProvider());
FetchResult result = op.execute(monitor);
ObjectId resultRef = result.getAdvertisedRef(refSpec.getSource()).getObjectId();
return new RevWalk(repository).parseCommit(resultRef);