diff options
author | Szymon Ptaszkiewicz | 2014-11-17 10:15:38 +0000 |
---|---|---|
committer | Szymon Ptaszkiewicz | 2014-11-17 10:15:38 +0000 |
commit | 1d8aca23ea32306beacb5e95249cd38c0116bac7 (patch) | |
tree | 863c3969eb33de93fba2c614ed172cfa06c7884b | |
parent | 770b282bc458d759b7e02cce21e6164182374fbc (diff) | |
download | eclipse.platform.team-1d8aca23ea32306beacb5e95249cd38c0116bac7.tar.gz eclipse.platform.team-1d8aca23ea32306beacb5e95249cd38c0116bac7.tar.xz eclipse.platform.team-1d8aca23ea32306beacb5e95249cd38c0116bac7.zip |
Bug 451740 - Add org.eclipse.team.cvs.ssh2 plugin to General > Tracing preference page
4 files changed, 40 insertions, 10 deletions
diff --git a/bundles/org.eclipse.team.cvs.ssh2/plugin.properties b/bundles/org.eclipse.team.cvs.ssh2/plugin.properties index fdf351690..c2d238133 100644 --- a/bundles/org.eclipse.team.cvs.ssh2/plugin.properties +++ b/bundles/org.eclipse.team.cvs.ssh2/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2006 IBM Corporation and others. +# Copyright (c) 2000, 2014 IBM Corporation 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 @@ -12,3 +12,4 @@ providerName=Eclipse.org pluginName=CVS SSH2 ssh2PreferencePage.name=SSH2 Connection Method +traceComponentLabel=Platform Team CVS SSH2 diff --git a/bundles/org.eclipse.team.cvs.ssh2/plugin.xml b/bundles/org.eclipse.team.cvs.ssh2/plugin.xml index cf1e58dc6..200f0ac18 100644 --- a/bundles/org.eclipse.team.cvs.ssh2/plugin.xml +++ b/bundles/org.eclipse.team.cvs.ssh2/plugin.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <!-- - Copyright (c) 2003, 2011 IBM Corporation and others. + Copyright (c) 2003, 2014 IBM Corporation 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 @@ -42,5 +42,15 @@ </run> </adapter> </extension> - +<extension + point="org.eclipse.ui.trace.traceComponents"> + <component + id="org.eclipse.team.cvs.ssh2.trace" + label="%traceComponentLabel"> + <bundle + consumed="false" + name="org.eclipse.team.cvs.ssh2"> + </bundle> + </component> +</extension> </plugin> diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2Plugin.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2Plugin.java index 9e803e15e..b198c1498 100644 --- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2Plugin.java +++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2Plugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation 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 @@ -11,9 +11,14 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ssh2; +import java.util.Hashtable; + import org.eclipse.core.runtime.Plugin; import org.eclipse.jsch.core.IJSchService; +import org.eclipse.osgi.service.debug.DebugOptions; +import org.eclipse.osgi.service.debug.DebugOptionsListener; import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; import org.osgi.util.tracker.ServiceTracker; public class CVSSSH2Plugin extends Plugin { @@ -21,6 +26,7 @@ public class CVSSSH2Plugin extends Plugin { public static String ID = "org.eclipse.team.cvs.ssh2"; //$NON-NLS-1$ private static CVSSSH2Plugin plugin; + private ServiceRegistration debugRegistration; private ServiceTracker tracker; public CVSSSH2Plugin() { @@ -30,6 +36,10 @@ public class CVSSSH2Plugin extends Plugin { public void stop(BundleContext context) throws Exception { try { + // unregister debug options listener + debugRegistration.unregister(); + debugRegistration = null; + JSchSession.shutdown(); tracker.close(); } finally { @@ -43,6 +53,12 @@ public class CVSSSH2Plugin extends Plugin { public void start(BundleContext context) throws Exception { super.start(context); + + // register debug options listener + Hashtable properties = new Hashtable(2); + properties.put(DebugOptions.LISTENER_SYMBOLICNAME, ID); + debugRegistration = context.registerService(DebugOptionsListener.class, Policy.DEBUG_OPTIONS_LISTENER, properties); + tracker = new ServiceTracker(getBundle().getBundleContext(), IJSchService.class.getName(), null); tracker.open(); } diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/Policy.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/Policy.java index 123357f8c..cc776ec4e 100644 --- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/Policy.java +++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/Policy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. + * Copyright (c) 2009, 2014 IBM Corporation 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 @@ -10,13 +10,16 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ssh2; +import org.eclipse.osgi.service.debug.DebugOptions; +import org.eclipse.osgi.service.debug.DebugOptionsListener; + public class Policy { // debug constants public static boolean DEBUG = false; - static { - // init debug options - if (CVSSSH2Plugin.getDefault().isDebugging()) - DEBUG = true; - } + static final DebugOptionsListener DEBUG_OPTIONS_LISTENER = new DebugOptionsListener() { + public void optionsChanged(DebugOptions options) { + DEBUG = options.getBooleanOption(CVSSSH2Plugin.ID + "/debug", false); //$NON-NLS-1$ + } + }; } |