Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2016-03-23 00:13:46 +0000
committerMatthias Sohn2016-04-02 23:46:09 +0000
commitae26a5b3cf07a41ead52f27791d5c1f82325cfa5 (patch)
tree43b51799783c24b91d86c983ba8bd6580142fa77
parenta132f61decdd85981e98d9834cdcc9196ca1f489 (diff)
downloadegit-ae26a5b3cf07a41ead52f27791d5c1f82325cfa5.tar.gz
egit-ae26a5b3cf07a41ead52f27791d5c1f82325cfa5.tar.xz
egit-ae26a5b3cf07a41ead52f27791d5c1f82325cfa5.zip
Move EclipseSshSessionFactory to org.eclipse.egit.core
This allows using this factory in headless environment. Preparation to expose an extension point to allow custom ssh session configuration. Bug: 489870 Change-Id: I7d4c7aff49b4f4c2f72739c51b0a07d1fc9e3a4a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.core/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java15
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/EclipseSshSessionFactory.java (renamed from org.eclipse.egit.ui/src/org/eclipse/egit/ui/EclipseSshSessionFactory.java)11
-rw-r--r--org.eclipse.egit.ui/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java14
5 files changed, 25 insertions, 22 deletions
diff --git a/org.eclipse.egit.core/META-INF/MANIFEST.MF b/org.eclipse.egit.core/META-INF/MANIFEST.MF
index e166277107..f474546d68 100644
--- a/org.eclipse.egit.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.core/META-INF/MANIFEST.MF
@@ -41,7 +41,8 @@ Export-Package: org.eclipse.egit.core;version="4.3.0";
org.eclipse.egit.core.synchronize.dto;version="4.3.0";x-friends:="org.eclipse.egit.ui"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Import-Package: org.eclipse.jgit.annotations;version="[4.3.0,4.4.0)",
+Import-Package: com.jcraft.jsch;bundle-version="[0.1.37,0.2.0)",
+ org.eclipse.jgit.annotations;version="[4.3.0,4.4.0)",
org.eclipse.jgit.api;version="[4.3.0,4.4.0)",
org.eclipse.jgit.api.errors;version="[4.3.0,4.4.0)",
org.eclipse.jgit.diff;version="[4.3.0,4.4.0)",
@@ -61,5 +62,6 @@ Import-Package: org.eclipse.jgit.annotations;version="[4.3.0,4.4.0)",
org.eclipse.jgit.treewalk.filter;version="[4.3.0,4.4.0)",
org.eclipse.jgit.util;version="[4.3.0,4.4.0)",
org.eclipse.jgit.util.io;version="[4.3.0,4.4.0)",
+ org.eclipse.jsch.core;bundle-version="[1.1.100,2.0.0)",
org.slf4j;version="[1.7.0,2.0.0)"
Eclipse-ExtensibleAPI: true
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
index 8eb51d2642..aae49aca2b 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/Activator.java
@@ -60,12 +60,15 @@ import org.eclipse.egit.core.securestorage.EGitSecureStore;
import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.merge.MergeStrategy;
+import org.eclipse.jgit.transport.SshSessionFactory;
import org.eclipse.jgit.util.FS;
+import org.eclipse.jsch.core.IJSchService;
import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.debug.DebugOptionsListener;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
/**
* The plugin class for the org.eclipse.egit.core plugin. This
@@ -176,6 +179,7 @@ public class Activator extends Plugin implements DebugOptionsListener {
context.registerService(DebugOptionsListener.class.getName(), this,
props);
+ setupSSH(context);
repositoryCache = new RepositoryCache();
indexDiffCache = new IndexDiffCache();
try {
@@ -195,6 +199,17 @@ public class Activator extends Plugin implements DebugOptionsListener {
registerMergeStrategyRegistryListener();
}
+ @SuppressWarnings("unchecked")
+ private void setupSSH(final BundleContext context) {
+ final ServiceReference ssh;
+
+ ssh = context.getServiceReference(IJSchService.class.getName());
+ if (ssh != null) {
+ SshSessionFactory.setInstance(new EclipseSshSessionFactory(
+ (IJSchService) context.getService(ssh)));
+ }
+ }
+
private void registerPreDeleteResourceChangeListener() {
if (preDeleteProjectListener == null) {
preDeleteProjectListener = new IResourceChangeListener() {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/EclipseSshSessionFactory.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/EclipseSshSessionFactory.java
index d2d8cc37cd..43dd9366ef 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/EclipseSshSessionFactory.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/EclipseSshSessionFactory.java
@@ -8,13 +8,14 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
-package org.eclipse.egit.ui;
+package org.eclipse.egit.core;
+import org.eclipse.jgit.transport.CredentialsProvider;
+import org.eclipse.jgit.transport.CredentialsProviderUserInfo;
import org.eclipse.jgit.transport.JschConfigSessionFactory;
import org.eclipse.jgit.transport.OpenSshConfig;
import org.eclipse.jgit.util.FS;
import org.eclipse.jsch.core.IJSchService;
-import org.eclipse.jsch.ui.UserInfoPrompter;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
@@ -59,7 +60,9 @@ class EclipseSshSessionFactory extends JschConfigSessionFactory {
@Override
protected void configure(final OpenSshConfig.Host hc, final Session session) {
UserInfo userInfo = session.getUserInfo();
- if (!hc.isBatchMode() && userInfo == null)
- new UserInfoPrompter(session);
+ if (!hc.isBatchMode() && userInfo == null) {
+ final CredentialsProvider cp = CredentialsProvider.getDefault();
+ session.setUserInfo(new CredentialsProviderUserInfo(session, cp));
+ }
}
}
diff --git a/org.eclipse.egit.ui/META-INF/MANIFEST.MF b/org.eclipse.egit.ui/META-INF/MANIFEST.MF
index 872383f1cb..8f634bc7ce 100644
--- a/org.eclipse.egit.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.ui/META-INF/MANIFEST.MF
@@ -19,10 +19,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.ui.workbench.texteditor;bundle-version="[3.4.0,4.0.0)",
org.eclipse.compare;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.jsch.ui;bundle-version="[1.1.100,2.0.0)",
- org.eclipse.jsch.core;bundle-version="[1.1.100,2.0.0)",
org.eclipse.ui.editors;bundle-version="[3.4.0,4.0.0)",
- com.jcraft.jsch;bundle-version="[0.1.37,0.2.0)",
org.eclipse.ui.navigator;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.forms;bundle-version="[3.3.0,4.0.0)",
org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
index 1d37155c71..67c0eadcb1 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
@@ -62,8 +62,6 @@ import org.eclipse.jgit.events.ListenerHandle;
import org.eclipse.jgit.events.RepositoryEvent;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.CredentialsProvider;
-import org.eclipse.jgit.transport.SshSessionFactory;
-import org.eclipse.jsch.core.IJSchService;
import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.debug.DebugOptionsListener;
import org.eclipse.swt.graphics.Font;
@@ -311,7 +309,6 @@ public class Activator extends AbstractUIPlugin implements DebugOptionsListener
context.registerService(DebugOptionsListener.class.getName(), this,
props);
- setupSSH(context);
setupProxy(context);
setupRepoChangeScanner();
setupRepoIndexRefresh();
@@ -683,17 +680,6 @@ public class Activator extends AbstractUIPlugin implements DebugOptionsListener
rcs.schedule(RepositoryChangeScanner.REPO_SCAN_INTERVAL);
}
- @SuppressWarnings("unchecked")
- private void setupSSH(final BundleContext context) {
- final ServiceReference ssh;
-
- ssh = context.getServiceReference(IJSchService.class.getName());
- if (ssh != null) {
- SshSessionFactory.setInstance(new EclipseSshSessionFactory(
- (IJSchService) context.getService(ssh)));
- }
- }
-
private void setupProxy(final BundleContext context) {
final ServiceReference proxy;

Back to the top