Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Ptaszkiewicz2014-11-17 08:43:54 +0000
committerSzymon Ptaszkiewicz2014-11-17 08:43:54 +0000
commit0859978fb44777f6eb7ced86c2e31455e52d23db (patch)
tree5da60e25e79025c5cd4060a4e97b0b490a9b3bb6 /bundles/org.eclipse.core.net
parentb15d7bbdd46145f0bfd6a57fc451491f4947498c (diff)
downloadeclipse.platform.team-0859978fb44777f6eb7ced86c2e31455e52d23db.tar.gz
eclipse.platform.team-0859978fb44777f6eb7ced86c2e31455e52d23db.tar.xz
eclipse.platform.team-0859978fb44777f6eb7ced86c2e31455e52d23db.zip
Bug 451736 - Add org.eclipse.core.net plugin to General > Tracing preference page
Diffstat (limited to 'bundles/org.eclipse.core.net')
-rw-r--r--bundles/org.eclipse.core.net/plugin.properties3
-rw-r--r--bundles/org.eclipse.core.net/plugin.xml14
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java44
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Policy.java16
4 files changed, 34 insertions, 43 deletions
diff --git a/bundles/org.eclipse.core.net/plugin.properties b/bundles/org.eclipse.core.net/plugin.properties
index 7df2960f3..14a667bcd 100644
--- a/bundles/org.eclipse.core.net/plugin.properties
+++ b/bundles/org.eclipse.core.net/plugin.properties
@@ -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
@@ -17,3 +17,4 @@
#
PLUGIN_NAME=Internet Connection Management
PLUGIN_PROVIDER=Eclipse.org
+TRACE_COMPONENT_LABEL=Platform Core Net
diff --git a/bundles/org.eclipse.core.net/plugin.xml b/bundles/org.eclipse.core.net/plugin.xml
index 2e20c34d3..3b0f7a53c 100644
--- a/bundles/org.eclipse.core.net/plugin.xml
+++ b/bundles/org.eclipse.core.net/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<!--
- Copyright (c) 2007, 2011 IBM Corporation and others.
+ Copyright (c) 2007, 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
@@ -22,5 +22,15 @@
class="org.eclipse.core.internal.net.PreferenceModifyListener">
</modifier>
</extension>
-
+ <extension
+ point="org.eclipse.ui.trace.traceComponents">
+ <component
+ id="org.eclipse.core.net.trace"
+ label="%TRACE_COMPONENT_LABEL">
+ <bundle
+ consumed="false"
+ name="org.eclipse.core.net">
+ </bundle>
+ </component>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
index 419bd090f..4b692f444 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 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
@@ -26,6 +26,7 @@ import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.osgi.service.debug.DebugOptions;
+import org.eclipse.osgi.service.debug.DebugOptionsListener;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Filter;
@@ -54,12 +55,10 @@ public class Activator implements BundleActivator {
private ServiceTracker instanceLocationTracker;
- private ServiceTracker debugTracker;
+ private ServiceRegistration debugRegistration;
private ServiceRegistration proxyService;
- private boolean debug = false;
-
private PreferenceManager preferenceManger;
/**
@@ -164,15 +163,10 @@ public class Activator implements BundleActivator {
instanceLocationTracker = new ServiceTracker(context, filter, null);
instanceLocationTracker.open();
- debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
- debugTracker.open();
-
- String symbolicName = context.getBundle().getSymbolicName();
- if (symbolicName != null) {
- String key = symbolicName + "/debug"; //$NON-NLS-1$
- String value = getDebugOption(key);
- this.debug = value == null ? false : value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
+ // 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);
if (Boolean
.valueOf(System.getProperty(PROP_REGISTER_SERVICE, "true")).booleanValue()) { //$NON-NLS-1$
@@ -183,32 +177,16 @@ public class Activator implements BundleActivator {
.getName(), proxyManager, new Hashtable());
}
}
-
- String getDebugOption(String option) {
- if (debugTracker == null)
- return null;
- DebugOptions options = (DebugOptions) debugTracker.getService();
- if (options != null)
- return options.getOption(option);
- return null;
- }
-
- /**
- * Returns whether this plug-in is in debug mode.
- */
- boolean isDebugging() {
- return debug;
- }
public void stop(BundleContext context) throws Exception {
if (proxyService != null) {
proxyService.unregister();
proxyService = null;
}
-
- if (debugTracker != null) {
- debugTracker.close();
- debugTracker = null;
+
+ if (debugRegistration != null) {
+ debugRegistration.unregister();
+ debugRegistration = null;
}
if (instanceLocationTracker != null) {
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Policy.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Policy.java
index 1d2495049..e73c1a99a 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Policy.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Policy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 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,6 +12,9 @@ package org.eclipse.core.internal.net;
import java.util.Date;
+import org.eclipse.osgi.service.debug.DebugOptions;
+import org.eclipse.osgi.service.debug.DebugOptionsListener;
+
public class Policy {
// general debug flag
@@ -19,13 +22,12 @@ public class Policy {
public static boolean DEBUG_SYSTEM_PROVIDERS = false;
- static {
- // init debug options
- if (Activator.getInstance().isDebugging()) {
- DEBUG = true;
- DEBUG_SYSTEM_PROVIDERS = "true".equalsIgnoreCase(Activator.getInstance().getDebugOption(Activator.ID + "/systemproviders")); //$NON-NLS-1$ //$NON-NLS-2$
+ static final DebugOptionsListener DEBUG_OPTIONS_LISTENER = new DebugOptionsListener() {
+ public void optionsChanged(DebugOptions options) {
+ DEBUG = options.getBooleanOption(Activator.ID + "/debug", false); //$NON-NLS-1$
+ DEBUG_SYSTEM_PROVIDERS = DEBUG && options.getBooleanOption(Activator.ID + "/systemproviders", false); //$NON-NLS-1$
}
- }
+ };
/**
* Print a debug message to the console. Pre-pend the message with the

Back to the top