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. *

* @param listener the listener that should be connected to this set * @param monitor a progress monitor @@ -297,7 +292,7 @@ public class SyncInfoSet { }, monitor); } - private ILock lock = Platform.getJobManager().newLock(); + private ILock lock = Job.getJobManager().newLock(); private Set listeners = Collections.synchronizedSet(new HashSet()); @@ -406,6 +401,7 @@ public class SyncInfoSet { * Indicate whether the set has nodes matching the given filter. * * @param filter a sync info filter + * @return whether the set has nodes that match the filter */ public boolean hasNodes(FastSyncInfoFilter filter) { SyncInfo[] infos = getSyncInfos(); @@ -464,6 +460,7 @@ public class SyncInfoSet { * Return all nodes in this set that match the given filter. * * @param filter a sync info filter + * @return the nodes that match the filter */ public SyncInfo[] getNodes(FastSyncInfoFilter filter) { List result = new ArrayList(); @@ -525,6 +522,7 @@ public class SyncInfoSet { * This method is used to release the lock on this set. The progress monitor is needed to allow * listeners to perform long-running operations is response to the set change. The lock is held * while the listeners are notified so listeners must be cautious in order to avoid deadlock. + * @param monitor a progress monitor */ public void endInput(IProgressMonitor monitor) { try { @@ -571,7 +569,7 @@ public class SyncInfoSet { monitor.beginTask(null, 100 + (newErrors.length > 0 ? 50 : 0) * allListeners.length); for (int i = 0; i < allListeners.length; i++) { final ISyncInfoSetChangeListener listener = allListeners[i]; - Platform.run(new ISafeRunnable() { + SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { // don't log the exception....it is already being logged in Platform#run } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.java index 79312295a..af34bc8c8 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.java @@ -91,7 +91,7 @@ public class Cache implements ICache { Object[] allListeners = listeners.getListeners(); for (int i = 0; i < allListeners.length; i++) { final Object listener = allListeners[i]; - Platform.run(new ISafeRunnable(){ + SafeRunner.run(new ISafeRunnable(){ public void run() throws Exception { ((ICacheListener)listener).cacheDisposed(Cache.this); } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java index 9cd942d35..355e5351c 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java @@ -14,8 +14,8 @@ import java.io.File; import java.util.*; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.jobs.ILock; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.osgi.util.NLS; import org.eclipse.team.core.TeamException; import org.eclipse.team.core.variants.CachedResourceVariant; @@ -30,7 +30,7 @@ public class ResourceVariantCache { // Maximum lifespan of local cache file, in milliseconds private static final long CACHE_FILE_LIFESPAN = 60*60*1000; // 1hr - // Map of registered cahces indexed by local name of a QualifiedName + // Map of registered caches indexed by local name of a QualifiedName private static Map caches = new HashMap(); // String (local name) > RemoteContentsCache private String name; @@ -38,12 +38,12 @@ public class ResourceVariantCache { private long lastCacheCleanup; private int cacheDirSize; - // Lock used to serialize the writting of cache contents - private ILock lock = Platform.getJobManager().newLock(); + // Lock used to serialize the writing of cache contents + private ILock lock = Job.getJobManager().newLock(); /** * Enables the use of remote contents caching for the given cacheId. The cache ID must be unique. - * A good candidate for this ID is the plugin ID of the plugin peforming the caching. + * A good candidate for this ID is the plugin ID of the plugin performing the caching. * * @param cacheId the unique Id of the cache being enabled */ @@ -56,7 +56,7 @@ public class ResourceVariantCache { /** * Returns whether caching has been enabled for the given Id. A cache should only be enabled once. - * It is conceivable that a cache be persisted over workbench invocations thus leading to a cahce that + * It is conceivable that a cache be persisted over workbench invocations thus leading to a cache that * is enabled on startup without intervention by the owning plugin. * * @param cacheId the unique Id of the cache @@ -67,7 +67,7 @@ public class ResourceVariantCache { } /** - * Disable the cache, dispoing of any file contents in the cache. + * Disable the cache, disposing of any file contents in the cache. * * @param cacheId the unique Id of the cache */ @@ -219,7 +219,7 @@ public class ResourceVariantCache { } /** - * @param id the id that uniquely identifes the remote resource that is cached. + * @param id the id that uniquely identifies the remote resource that is cached. * @return the cache entry */ public ResourceVariantCacheEntry getCacheEntry(String id) { diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java index b06e4741c..398ba6f00 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java @@ -14,6 +14,7 @@ import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.ILock; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.team.internal.core.Policy; /** @@ -21,7 +22,7 @@ import org.eclipse.team.internal.core.Policy; */ public class BatchingChangeSetManager extends ChangeSetManager { - private ILock lock = Platform.getJobManager().newLock(); + private ILock lock = Job.getJobManager().newLock(); public static class CollectorChangeEvent { 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 2a96e95ea..43601dadc 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 @@ -14,8 +14,7 @@ import java.util.*; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.*; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.core.runtime.jobs.MultiRule; +import org.eclipse.core.runtime.jobs.*; import org.eclipse.team.core.TeamException; import org.eclipse.team.internal.core.*; @@ -28,7 +27,7 @@ import org.eclipse.team.internal.core.*; * thread releases all it's nested locks. *

* 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