Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Ptaszkiewicz2014-11-17 08:57:07 +0000
committerSzymon Ptaszkiewicz2014-11-17 08:57:07 +0000
commitb43f5ea6e8a0543e2c17c1bf53bee62cef022399 (patch)
treed1a7feb6e420a6d542f904a2edf7d86210ce2f8a /bundles/org.eclipse.team.core
parent0859978fb44777f6eb7ced86c2e31455e52d23db (diff)
downloadeclipse.platform.team-b43f5ea6e8a0543e2c17c1bf53bee62cef022399.tar.gz
eclipse.platform.team-b43f5ea6e8a0543e2c17c1bf53bee62cef022399.tar.xz
eclipse.platform.team-b43f5ea6e8a0543e2c17c1bf53bee62cef022399.zip
Bug 451737 - Add org.eclipse.team.core plugin to General > Tracing preference page
Diffstat (limited to 'bundles/org.eclipse.team.core')
-rw-r--r--bundles/org.eclipse.team.core/plugin.properties6
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml13
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java23
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java18
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java11
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java11
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java9
8 files changed, 60 insertions, 35 deletions
diff --git a/bundles/org.eclipse.team.core/plugin.properties b/bundles/org.eclipse.team.core/plugin.properties
index 3308088de..f8d7adf92 100644
--- a/bundles/org.eclipse.team.core/plugin.properties
+++ b/bundles/org.eclipse.team.core/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2011 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
@@ -18,4 +18,6 @@ Repository=Repository Providers
DefaultValidator=Default File Modification Validator
StorageMergers = Storage Mergers
-BundleImporters = Bundle Importers \ No newline at end of file
+BundleImporters = Bundle Importers
+
+TraceComponentLabel = Platform Team Core
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index da01e79cd..1addde26c 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
- Copyright (c) 2001, 2011 IBM Corporation and others.
+ Copyright (c) 2001, 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
@@ -180,4 +180,15 @@
contentTypeId="org.eclipse.core.runtime.text"
storageMergerId="org.eclipse.team.ui.textStorageMerger"/>
</extension>
+ <extension
+ point="org.eclipse.ui.trace.traceComponents">
+ <component
+ id="org.eclipse.team.core.trace"
+ label="%TraceComponentLabel">
+ <bundle
+ consumed="false"
+ name="org.eclipse.team.core">
+ </bundle>
+ </component>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
index 140ab941f..c8feb042c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 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
@@ -302,7 +302,7 @@ public final class Team {
pIgnore.put(pattern, Boolean.valueOf(enabled));
} else if (!Boolean.valueOf(enabled).equals(
pIgnore.get(pattern))) {
- if(TeamPlugin.getPlugin().isDebugging()){
+ if(Policy.DEBUG){
TeamPlugin
.log(IStatus.WARNING,
NLS.bind(
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java
index 1fb92c8f0..d758e0f95 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 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,25 +11,28 @@
package org.eclipse.team.internal.core;
import org.eclipse.core.runtime.*;
+import org.eclipse.osgi.service.debug.DebugOptions;
+import org.eclipse.osgi.service.debug.DebugOptionsListener;
public class Policy {
//debug constants
+ public static boolean DEBUG = false;
public static boolean DEBUG_STREAMS = false;
public static boolean DEBUG_REFRESH_JOB = true;
public static boolean DEBUG_BACKGROUND_EVENTS = false;
public static boolean DEBUG_THREADING = false;
- static {
- //init debug options
- if (TeamPlugin.getPlugin().isDebugging()) {
- DEBUG_STREAMS = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/streams"));//$NON-NLS-1$ //$NON-NLS-2$
- DEBUG_REFRESH_JOB = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/refreshjob"));//$NON-NLS-1$ //$NON-NLS-2$
- DEBUG_BACKGROUND_EVENTS = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/backgroundevents"));//$NON-NLS-1$ //$NON-NLS-2$
- DEBUG_THREADING = "true".equalsIgnoreCase(Platform.getDebugOption(TeamPlugin.ID + "/threading"));//$NON-NLS-1$ //$NON-NLS-2$
+ static final DebugOptionsListener DEBUG_OPTIONS_LISTENER = new DebugOptionsListener() {
+ public void optionsChanged(DebugOptions options) {
+ DEBUG = options.getBooleanOption(TeamPlugin.ID + "/debug", false); //$NON-NLS-1$
+ DEBUG_STREAMS = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/streams", false); //$NON-NLS-1$
+ DEBUG_REFRESH_JOB = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/refreshjob", false); //$NON-NLS-1$
+ DEBUG_BACKGROUND_EVENTS = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/backgroundevents", false); //$NON-NLS-1$
+ DEBUG_THREADING = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/threading", false); //$NON-NLS-1$
}
- }
-
+ };
+
/**
* Progress monitor helpers.
*
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
index 7d401c55f..03510f89e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 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,10 +17,13 @@ import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.runtime.content.IContentTypeManager;
+import org.eclipse.osgi.service.debug.DebugOptions;
+import org.eclipse.osgi.service.debug.DebugOptionsListener;
import org.eclipse.team.core.*;
import org.eclipse.team.core.mapping.DelegatingStorageMerger;
import org.eclipse.team.internal.core.mapping.IStreamMergerDelegate;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
/**
* <code>TeamPlugin</code> is the plug-in runtime class for the Team
@@ -61,7 +64,8 @@ final public class TeamPlugin extends Plugin {
// The one and only plug-in instance
private static TeamPlugin plugin;
-
+
+ private ServiceRegistration debugRegistration;
private IStreamMergerDelegate mergerDelegate;
/**
@@ -77,6 +81,12 @@ final public class TeamPlugin 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);
+
Team.startup();
}
@@ -85,6 +95,10 @@ final public class TeamPlugin extends Plugin {
*/
public void stop(BundleContext context) throws Exception {
try {
+ // unregister debug options listener
+ debugRegistration.unregister();
+ debugRegistration = null;
+
Team.shutdown();
ResourceVariantCache.shutdown();
} finally {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java
index b1f8235e4..dcbd8ba85 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.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
@@ -32,7 +32,6 @@ import org.eclipse.team.internal.core.TeamPlugin;
* much of the operation completed; conversely, at what point to resume.
*/
public class PollingInputStream extends FilterInputStream {
- private static final boolean DEBUG = Policy.DEBUG_STREAMS;
private int numAttempts;
private IProgressMonitor monitor;
private boolean cancellable;
@@ -79,7 +78,7 @@ public class PollingInputStream extends FilterInputStream {
if (checkCancellation()) throw new OperationCanceledException();
if (++attempts == numAttempts)
throw new InterruptedIOException(Messages.PollingInputStream_closeTimeout);
- if (DEBUG) System.out.println("close retry=" + attempts); //$NON-NLS-1$
+ if (Policy.DEBUG_STREAMS) System.out.println("close retry=" + attempts); //$NON-NLS-1$
} catch (IOException e) {
// ignore it - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=203423#c10
}
@@ -104,7 +103,7 @@ public class PollingInputStream extends FilterInputStream {
} catch (InterruptedIOException e) {
if (++attempts == numAttempts)
throw new InterruptedIOException(Messages.PollingInputStream_readTimeout);
- if (DEBUG) System.out.println("read retry=" + attempts); //$NON-NLS-1$
+ if (Policy.DEBUG_STREAMS) System.out.println("read retry=" + attempts); //$NON-NLS-1$
}
}
}
@@ -130,7 +129,7 @@ public class PollingInputStream extends FilterInputStream {
if (e.bytesTransferred != 0) return e.bytesTransferred; // keep partial transfer
if (++attempts == numAttempts)
throw new InterruptedIOException(Messages.PollingInputStream_readTimeout);
- if (DEBUG) System.out.println("read retry=" + attempts); //$NON-NLS-1$
+ if (Policy.DEBUG_STREAMS) System.out.println("read retry=" + attempts); //$NON-NLS-1$
}
}
}
@@ -154,7 +153,7 @@ public class PollingInputStream extends FilterInputStream {
if (e.bytesTransferred != 0) return e.bytesTransferred; // keep partial transfer
if (++attempts == numAttempts)
throw new InterruptedIOException(Messages.PollingInputStream_readTimeout);
- if (DEBUG) System.out.println("read retry=" + attempts); //$NON-NLS-1$
+ if (Policy.DEBUG_STREAMS) System.out.println("read retry=" + attempts); //$NON-NLS-1$
}
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java
index 60cae7978..d0b683ccc 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java
@@ -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
@@ -30,7 +30,6 @@ import org.eclipse.team.internal.core.Policy;
* much of the operation completed; conversely, at what point to resume.
*/
public class PollingOutputStream extends FilterOutputStream {
- private static final boolean DEBUG = Policy.DEBUG_STREAMS;
private int numAttempts;
private IProgressMonitor monitor;
private boolean cancellable;
@@ -66,7 +65,7 @@ public class PollingOutputStream extends FilterOutputStream {
} catch (InterruptedIOException e) {
if (++attempts == numAttempts)
throw new InterruptedIOException(Messages.PollingOutputStream_writeTimeout);
- if (DEBUG) System.out.println("write retry=" + attempts); //$NON-NLS-1$
+ if (Policy.DEBUG_STREAMS) System.out.println("write retry=" + attempts); //$NON-NLS-1$
}
}
}
@@ -100,7 +99,7 @@ public class PollingOutputStream extends FilterOutputStream {
e.bytesTransferred = count;
throw e;
}
- if (DEBUG) System.out.println("write retry=" + attempts); //$NON-NLS-1$
+ if (Policy.DEBUG_STREAMS) System.out.println("write retry=" + attempts); //$NON-NLS-1$
}
}
}
@@ -131,7 +130,7 @@ public class PollingOutputStream extends FilterOutputStream {
e.bytesTransferred = count;
throw e;
}
- if (DEBUG) System.out.println("write retry=" + attempts); //$NON-NLS-1$
+ if (Policy.DEBUG_STREAMS) System.out.println("write retry=" + attempts); //$NON-NLS-1$
}
}
}
@@ -158,7 +157,7 @@ public class PollingOutputStream extends FilterOutputStream {
if (checkCancellation()) throw new OperationCanceledException();
if (++attempts == numAttempts)
throw new InterruptedIOException(Messages.PollingOutputStream_closeTimeout);
- if (DEBUG) System.out.println("close retry=" + attempts); //$NON-NLS-1$
+ if (Policy.DEBUG_STREAMS) System.out.println("close retry=" + attempts); //$NON-NLS-1$
}
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
index 5bd6d554b..6f27f4f38 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.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
@@ -32,9 +32,6 @@ import org.eclipse.team.internal.core.*;
* another thread already locks the same resource.</p>
*/
public class BatchingLock {
-
- private final static boolean DEBUG = Policy.DEBUG_THREADING;
-
// This is a placeholder rule used to indicate that no scheduling rule is needed
/* internal use only */ static final ISchedulingRule NULL_SCHEDULING_RULE= new ISchedulingRule() {
public boolean contains(ISchedulingRule rule) {
@@ -259,7 +256,7 @@ public class BatchingLock {
Thread thisThread = Thread.currentThread();
infos.put(thisThread, info);
added = true;
- if(DEBUG) System.out.println("[" + thisThread.getName() + "] acquired batching lock on " + resourceRule); //$NON-NLS-1$ //$NON-NLS-2$
+ if(Policy.DEBUG_THREADING) System.out.println("[" + thisThread.getName() + "] acquired batching lock on " + resourceRule); //$NON-NLS-1$ //$NON-NLS-2$
}
}
try {
@@ -304,7 +301,7 @@ public class BatchingLock {
synchronized (infos) {
if (!info.isNested()) {
Thread thisThread = Thread.currentThread();
- if(DEBUG) System.out.println("[" + thisThread.getName() + "] released batching lock"); //$NON-NLS-1$ //$NON-NLS-2$
+ if(Policy.DEBUG_THREADING) System.out.println("[" + thisThread.getName() + "] released batching lock"); //$NON-NLS-1$ //$NON-NLS-2$
infos.remove(thisThread);
}
}

Back to the top