1 12 package org.eclipse.team.internal.ccvs.ssh2; 13 14 import org.eclipse.core.runtime.Platform; 15 import org.eclipse.jsch.core.IJSchService; 16 import org.eclipse.ui.plugin.AbstractUIPlugin; 17 import org.osgi.framework.BundleContext; 18 import org.osgi.util.tracker.ServiceTracker; 19 20 public class CVSSSH2Plugin extends AbstractUIPlugin { 21 22 public static String ID = "org.eclipse.team.cvs.ssh2"; private static CVSSSH2Plugin plugin; 24 25 static String SSH_HOME_DEFAULT = null; 26 static { 27 String ssh_dir_name = ".ssh"; 29 if (Platform.getOS().equals(Platform.OS_WIN32)) { 31 ssh_dir_name = "ssh"; } 33 SSH_HOME_DEFAULT = System.getProperty("user.home"); if (SSH_HOME_DEFAULT != null) { 35 SSH_HOME_DEFAULT = SSH_HOME_DEFAULT + java.io.File.separator + ssh_dir_name; 36 } else { 37 38 } 39 } 40 41 private ServiceTracker tracker; 42 43 public CVSSSH2Plugin() { 44 super(); 45 plugin = this; 46 } 47 48 public void stop(BundleContext context) throws Exception { 49 try { 50 JSchSession.shutdown(); 51 tracker.close(); 52 } finally { 53 super.stop(context); 54 } 55 } 56 57 public static CVSSSH2Plugin getDefault() { 58 return plugin; 59 } 60 61 public void start(BundleContext context) throws Exception { 62 super.start(context); 63 tracker = new ServiceTracker(getBundle().getBundleContext(), IJSchService.class.getName(), null); 64 tracker.open(); 65 } 66 67 public IJSchService getJSchService() { 68 return (IJSchService)tracker.getService(); 69 } 70 } 71 | Popular Tags |