Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2006-01-24 21:53:40 +0000
committerMichael Valenta2006-01-24 21:53:40 +0000
commit8922ee9432ec8e0b790e6ce53d609c5f07c7df4e (patch)
tree6d55c6fdbb6f979d8e3c32d4a72c15703cb4b20e
parent41f2d19fa10728b847a767f5d4f49bd00e8cb488 (diff)
downloadeclipse.platform.team-8922ee9432ec8e0b790e6ce53d609c5f07c7df4e.tar.gz
eclipse.platform.team-8922ee9432ec8e0b790e6ce53d609c5f07c7df4e.tar.xz
eclipse.platform.team-8922ee9432ec8e0b790e6ce53d609c5f07c7df4e.zip
Update javadoc to indicate asynchronous nature of tree updatingI20060124b
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IMergeContext.java18
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationContext.java108
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberMergeContext.java1
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java8
4 files changed, 96 insertions, 39 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IMergeContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IMergeContext.java
index 1edcfc87b..b7e02b8a9 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IMergeContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IMergeContext.java
@@ -12,6 +12,7 @@ package org.eclipse.team.core.mapping;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.team.core.diff.*;
import org.eclipse.team.core.mapping.provider.MergeContext;
@@ -19,9 +20,20 @@ import org.eclipse.team.core.mapping.provider.MergeContext;
/**
* Provides the context for an <code>IResourceMappingMerger</code> or a model
* specific synchronization view that supports merging.
- *
- * TODO: Need to have a story for folder merging (see bug 113898) TODO: How are
- * merge/markasMerge changes batched? IWorkspace#run? (see bug 113928)
+ * * <p>
+ * <a name="async">The diff tree associated with this context may be updated asynchronously in reponse
+ * to calls to any method of this context (e.g. merge and markAsMerged methods) that may result in changes
+ * in the synchronization state of resources. It may also get updated as a result
+ * of changes triggered from other sources. Hence, the callback from the diff tree
+ * to report changes may occur in the same thread as the method call or
+ * asynchronously in a separate thread, regardless of who triggered the refresh.
+ * Clients of this method (and any other asynchronous method on this context) may
+ * determine if all changes have been collected using {@link IJobManager#find(Object)}
+ * using this context as the <code>family</code> argument in order to determine
+ * if there are any jobs running that are populating the diff tree. Clients may also
+ * call {@link IJobManager#join(Object, IProgressMonitor)} if they wish to wait until
+ * all background handlers related to this context are finished.
+ * </p>
* <p>
* This interface is not intended to be implemented by clients. Clients should
* instead subclass {@link MergeContext}.
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationContext.java
index a523b9c90..3693202d2 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationContext.java
@@ -15,11 +15,10 @@ import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.team.core.diff.*;
import org.eclipse.team.core.mapping.provider.MergeContext;
import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
/**
* Allows a model provider to build a view of their model that includes
@@ -36,6 +35,20 @@ import org.eclipse.team.core.synchronize.SyncInfoSet;
* clients should listen to both sources in order to guarantee that they update
* any dependent state appropriately.
* <p>
+ * <a name="async">The diff tree associated with this context may be updated asynchronously in reponse
+ * to calls to any method of this context (e.g. refresh methods) that may result in changes
+ * in the synchronization state of resources. It may also get updated as a result
+ * of changes triggered from other sources. Hence, the callback from the diff tree
+ * to report changes may occur in the same thread as the method call or
+ * asynchronously in a separate thread, regardless of who triggered the refresh.
+ * Clients of this method (and any other asynchronous method on this context) may
+ * determine if all changes have been collected using {@link IJobManager#find(Object)}
+ * using this context as the <code>family</code> argument in order to determine
+ * if there are any jobs running that are populating the diff tree. Clients may also
+ * call {@link IJobManager#join(Object, IProgressMonitor)} if they wish to wait until
+ * all background handlers related to this context are finished.
+ * </p>
+ * <p>
* This interface is not intended to be implemented by clients. They should subclass
* {@link SynchronizationContext} or one of its subclasses instead.
*
@@ -58,7 +71,7 @@ public interface ISynchronizationContext {
* context is a two-way synchronization.
*/
public final static int TWO_WAY = 2;
-
+
/**
* Synchronization type constant that indicates that
* context is a three-way synchronization.
@@ -74,7 +87,7 @@ public interface ISynchronizationContext {
* @return the input that defined the scope of this synchronization context.
*/
IResourceMappingScope getScope();
-
+
/**
* Return a tree that contains {@link IDiffNode} nodes for resources that
* are out-of-sync. The tree will contain diffs for any out-of-sync
@@ -112,7 +125,7 @@ public interface ISynchronizationContext {
* @see IThreeWayDiff
*/
public int getType();
-
+
/**
* Return the cache associated with this synchronization context.
* The cache is maintained for the lifetime of this context and is
@@ -122,35 +135,44 @@ public interface ISynchronizationContext {
* applies.
* @return the cache associated with this synchronization context
*/
- public IDiffCache getCache();
-
+ public IDiffCache getCache();
+
/**
* Dispose of the synchronization context and the cache of the context. This
* method should be invoked by clients when the context is no longer needed.
*/
public void dispose();
-
- /**
- * Refresh the context in order to update the sync-info to include the
- * latest remote state. any changes will be reported through the change
- * listeners registered with the sync-info tree of this context. Changes to
- * the set may be triggered by a call to this method or by a refresh
- * triggered by some other source.
+
+ /**
+ * Refresh the context in order to update the diff tree returned by
+ * {@link #getDiffTree()} to include the latest synchronization state for
+ * the resources. Any changes will be reported through the change listeners
+ * registered with the diff tree of this context.
+ * <p>
+ * Changes to the diff tree may be triggered by a call to this method or by a
+ * refresh triggered by some other source. Hence, the callback from the diff tree
+ * to report changes may occur in the same thread as the refresh or
+ * <a href="#async">asynchronously</a> in a separate thread, regardless of who triggered
+ * the refresh.
*
- * @see SyncInfoSet#addSyncSetChangedListener(ISyncInfoSetChangeListener)
- * @see org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent
+ * @see #getDiffTree()
+ * @see IDiffTree#addDiffChangeListener(IDiffChangeListener)
*
- * @param traversals the resource traversals which indicate which resources
- * are to be refreshed
- * @param flags additional refresh behavior. For instance, if
+ * @param traversals
+ * the resource traversals which indicate which resources are to
+ * be refreshed
+ * @param flags
+ * additional refresh behavior. For instance, if
* <code>RemoteResourceMappingContext.FILE_CONTENTS_REQUIRED</code>
* is one of the flags, this indicates that the client will be
* accessing the contents of the files covered by the traversals.
* <code>NONE</code> should be used when no additional behavior
* is required
- * @param monitor a progress monitor, or <code>null</code> if progress
+ * @param monitor
+ * a progress monitor, or <code>null</code> if progress
* reporting is not desired
- * @throws CoreException if the refresh fails. Reasons include:
+ * @throws CoreException
+ * if the refresh fails. Reasons include:
* <ul>
* <li>The server could not be contacted for some reason (e.g.
* the context in which the operation is being called must be
@@ -158,20 +180,34 @@ public interface ISynchronizationContext {
* SERVER_CONTACT_PROHIBITED. </li>
* </ul>
*/
- public void refresh(ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Refresh the portion of the context related to the given resource mappings.
- * The provided mappings must be mappings that appear in the scope of this context.
- * The refresh will first regenerate the scope for the mappings in case new resources
- * are included in the mappings. Then the synchronization state of the resources covered
- * by the mapping will be refreshed. If new resources are included in the scope, a property
- * change event will be fired from the scope. If the synchronization state of any of the resources
- * covered by the mapping change, a change event will be fired from the diff tree of this contet.
- * @param mappings the mappings to be refreshed
- * @param monitor a progress monitor
- * @throws CoreException if errors occur
- */
- public void refresh(ResourceMapping[] mappings, IProgressMonitor monitor) throws CoreException;
+ public void refresh(ResourceTraversal[] traversals, int flags,
+ IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Refresh the portion of the context related to the given resource
+ * mappings. The provided mappings must be mappings that appear in the scope
+ * of this context. The refresh will first regenerate the scope for the
+ * mappings in case new resources are included in the mappings. Then the
+ * synchronization state of the resources covered by the mapping will be
+ * refreshed. If new resources are included in the scope, a property change
+ * event will be fired from the scope. If the synchronization state of any
+ * of the resources covered by the mapping change, a change event will be
+ * fired from the diff tree of this contet.
+ * <p>
+ * Changes to the diff tree may be triggered by a call to this method or by a
+ * refresh triggered by some other source. Hence, the callback from the diff tree
+ * to report changes may occur in the same thread as the refresh or
+ * <a href="#async">asynchronously</a> in a separate thread, regardless of who triggered
+ * the refresh.
+ *
+ * @param mappings
+ * the mappings to be refreshed
+ * @param monitor
+ * a progress monitor
+ * @throws CoreException
+ * if errors occur
+ */
+ public void refresh(ResourceMapping[] mappings, IProgressMonitor monitor)
+ throws CoreException;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberMergeContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberMergeContext.java
index 48daf6071..5d2d534ac 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberMergeContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberMergeContext.java
@@ -61,6 +61,7 @@ public abstract class SubscriberMergeContext extends MergeContext {
*/
protected void initialize(IProgressMonitor monitor, boolean refresh) throws CoreException {
handler = new SubscriberDiffTreeEventHandler(subscriber, getScope(), (ResourceDiffTree)getDiffTree());
+ handler.setJobFamily(this);
handler.start();
if (refresh) {
refresh(getScope().getTraversals(), IResource.NONE, monitor);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java
index 77c923ef2..f882b7458 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java
@@ -31,6 +31,7 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
private ResourceDiffTree tree;
private SubscriberDiffCollector collector;
+ private Object family;
/*
* An event used to represent a change in a diff
@@ -200,4 +201,11 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
super.shutdown();
}
+ protected Object getJobFamiliy() {
+ return family;
+ }
+ public void setJobFamily(Object family) {
+ this.family = family;
+ }
+
}

Back to the top