From d939b2ef6ec7cde9859ffde36c5eef3c59311cad Mon Sep 17 00:00:00 2001
From: Michael Valenta
Date: Mon, 26 Feb 2007 13:18:08 +0000
Subject: Bug 175438 Deprecation warnings in Team core plugin
---
.../org/eclipse/team/core/RepositoryProvider.java | 19 +++++++++-------
.../eclipse/team/core/diff/provider/DiffTree.java | 3 ++-
.../eclipse/team/core/synchronize/SyncInfoSet.java | 18 +++++++--------
.../src/org/eclipse/team/internal/core/Cache.java | 2 +-
.../team/internal/core/ResourceVariantCache.java | 16 ++++++-------
.../core/subscribers/BatchingChangeSetManager.java | 3 ++-
.../internal/core/subscribers/BatchingLock.java | 26 +++++++++++++---------
7 files changed, 47 insertions(+), 40 deletions(-)
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
index b46182e3e..8c4341e46 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
@@ -18,8 +18,7 @@ import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.*;
import org.eclipse.core.resources.team.IMoveDeleteHook;
import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.history.IFileHistoryProvider;
import org.eclipse.team.core.subscribers.Subscriber;
@@ -64,7 +63,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
private IProject project;
// lock to ensure that map/unmap and getProvider support concurrency
- private static final ILock mappingLock = Platform.getJobManager().newLock();
+ private static final ILock mappingLock = Job.getJobManager().newLock();
// Session property used to identify projects that are not mapped
private static final Object NOT_MAPPED = new Object();
@@ -92,7 +91,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
// getProvider itself does not (and can not) obtain a scheduling rule.
// Thus, the locking order is always scheduling rule followed by
// mappingLock.
- Platform.getJobManager().beginRule(rule, null);
+ Job.getJobManager().beginRule(rule, null);
try {
mappingLock.acquire();
RepositoryProvider existingProvider = null;
@@ -144,7 +143,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
} catch (CoreException e) {
throw TeamPlugin.wrapException(e);
} finally {
- Platform.getJobManager().endRule(rule);
+ Job.getJobManager().endRule(rule);
}
}
@@ -247,7 +246,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(project);
try{
// See the map(IProject, String) method for a description of lock ordering
- Platform.getJobManager().beginRule(rule, null);
+ Job.getJobManager().beginRule(rule, null);
try {
mappingLock.acquire();
String id = project.getPersistentProperty(TeamPlugin.PROVIDER_PROP_KEY);
@@ -289,7 +288,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
} catch (CoreException e) {
throw TeamPlugin.wrapException(e);
} finally {
- Platform.getJobManager().endRule(rule);
+ Job.getJobManager().endRule(rule);
}
}
@@ -364,6 +363,8 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
* that modify the contents of files.
* Returns null
if the provider does not wish to participate in
* file modification validation.
+ * @return an IFileModificationValidator
for pre-checking operations
+ * that modify the contents of files
*
* @see org.eclipse.core.resources.IFileModificationValidator
*/
@@ -389,6 +390,8 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
* to control how moves and deletes occur and includes the ability to prevent them.
*
* Returning null
signals that the default move and delete behavior is desired.
+ * @return an IMoveDeleteHook
for handling moves and deletes
+ * that occur within projects managed by the provider
*
* @see org.eclipse.core.resources.team.IMoveDeleteHook
*/
@@ -582,7 +585,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
if (!project.isAccessible()) return false;
try {
if (lookupProviderProp(project) != null) return true;
- // Do a quick check to see it the poroject is known to be unshared.
+ // Do a quick check to see it the project is known to be unshared.
// This is done to avoid accessing the persistent property store
if (isMarkedAsUnshared(project))
return false;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
index e53188e64..54848ff42 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
@@ -15,6 +15,7 @@ import java.util.*;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.ILock;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.team.core.diff.*;
import org.eclipse.team.internal.core.Policy;
import org.eclipse.team.internal.core.mapping.DiffChangeEvent;
@@ -41,7 +42,7 @@ public class DiffTree implements IDiffTree {
private PathTree pathTree = new PathTree();
- private ILock lock = Platform.getJobManager().newLock();
+ private ILock lock = Job.getJobManager().newLock();
private DiffTreeStatistics statistics = new DiffTreeStatistics();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
index 608466162..8a22bed8a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
@@ -21,14 +21,9 @@ import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.ILock;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.team.core.ITeamStatus;
import org.eclipse.team.core.TeamStatus;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter.SyncInfoDirectionFilter;
@@ -278,7 +273,7 @@ public class SyncInfoSet {
* implementation.
*
* Disconnecting is done by calling removeChangeListener
. Once disconnected,
- * a listener can reconnect to be reinitialized.
+ * a listener can reconnect to be re-initialized.
*
* The locking is managed by the platform via scheduling rules. This class simply - * provides the nesting mechnism in order to allow the client to determine when + * provides the nesting mechanism in order to allow the client to determine when * the lock for the thread has been released. Therefore, this lock will block if * another thread already locks the same resource.
*/ @@ -58,7 +57,7 @@ public class BatchingLock { * acquire the rule if it is not the workspace root. * @param resource * @param monitor - * @return the schedulsing rule that was obtained + * @return the scheduling rule that was obtained */ public ISchedulingRule pushRule(ISchedulingRule resource, IProgressMonitor monitor) { // The scheduling rule is either the project or the resource's parent @@ -66,17 +65,17 @@ public class BatchingLock { if (rule != NULL_SCHEDULING_RULE) { boolean success = false; try { - Platform.getJobManager().beginRule(rule, monitor); + Job.getJobManager().beginRule(rule, monitor); addRule(rule); success = true; } finally { if (!success) { try { - // The begin was cancelled (or some other problem occurred). + // The begin was canceled (or some other problem occurred). // Free the scheduling rule // so the clients of ReentrantLock don't need to - // do an endRule when the operation is cancelled. - Platform.getJobManager().endRule(rule); + // do an endRule when the operation is canceled. + Job.getJobManager().endRule(rule); } catch (RuntimeException e) { // Log and ignore so the original exception is not lost TeamPlugin.log(IStatus.ERROR, "Failed to end scheduling rule", e); //$NON-NLS-1$ @@ -112,7 +111,7 @@ public class BatchingLock { } Assert.isTrue(stackedRule.equals(rule), "end for resource '" + rule + "' does not match stacked rule '" + stackedRule + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (rule != NULL_SCHEDULING_RULE) { - Platform.getJobManager().endRule(rule); + Job.getJobManager().endRule(rule); } } } @@ -182,7 +181,7 @@ public class BatchingLock { throw e; } finally { // We have to clear the resources no matter what since the next attempt - // to fluch may not have an appropriate scheduling rule + // to flush may not have an appropriate scheduling rule changedResources.clear(); } } @@ -266,7 +265,7 @@ public class BatchingLock { try { return info.pushRule(resourceRule, monitor); } catch (OperationCanceledException e) { - // The operation was cancelled. + // The operation was canceled. // If this is the outermost acquire then remove the info that was just added if (added) { synchronized (infos) { @@ -293,6 +292,9 @@ public class BatchingLock { * be identical to the rule returned by the corresponding acquire(). If the rule * for the release is non-null and all remaining rules held by the lock are null, * the the flush operation provided in the acquire method will be executed. + * @param rule the scheduling rule + * @param monitor a progress monitor + * @throws TeamException */ public void release(ISchedulingRule rule, IProgressMonitor monitor) throws TeamException { ThreadInfo info = getThreadInfo(); @@ -316,6 +318,8 @@ public class BatchingLock { /** * Flush any changes accumulated by the lock so far. + * @param monitor a progress monitor + * @throws TeamException */ public void flush(IProgressMonitor monitor) throws TeamException { ThreadInfo info = getThreadInfo(); -- cgit v1.2.3