diff options
author | Michael Valenta | 2006-02-05 03:04:43 +0000 |
---|---|---|
committer | Michael Valenta | 2006-02-05 03:04:43 +0000 |
commit | f70a859269fee3920682337f9f3bb6fe945538be (patch) | |
tree | ee4c79f91f28c0b36bc7b64a794f24a25f20bec8 /bundles/org.eclipse.team.core | |
parent | 80e617145b57e4afe13fc331c4c14f762d52bdef (diff) | |
download | eclipse.platform.team-f70a859269fee3920682337f9f3bb6fe945538be.tar.gz eclipse.platform.team-f70a859269fee3920682337f9f3bb6fe945538be.tar.xz eclipse.platform.team-f70a859269fee3920682337f9f3bb6fe945538be.zip |
Cleaning up API in preparation for API freeze
Diffstat (limited to 'bundles/org.eclipse.team.core')
29 files changed, 425 insertions, 627 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IDiffCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ICache.java index 552835e4a..e279e2259 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IDiffCache.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ICache.java @@ -8,8 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.core.mapping; - +package org.eclipse.team.core; /** * A cache that is associated with a synchronization that allows clients @@ -28,41 +27,41 @@ package org.eclipse.team.core.mapping; * * @since 3.2 */ -public interface IDiffCache { +public interface ICache { /** - * Cache the given property with this context. - * @param name the property name that uniquely identifies the property + * Cache the given object with this context. + * @param name the name that uniquely identifies the object * @param value the value to be cached. */ - void putProperty(String name, Object value); + void put(String name, Object value); /** - * Retrieve a property that has been cached with the context - * @param name the name of the property - * @return the object associated with the property name or <code>null</code> + * Retrieve an object that has been cached with the context + * @param name the name of the object + * @return the object associated with the name or <code>null</code> */ - Object getProperty(String name); + Object get(String name); /** - * Remove the named property from the context - * @param name the property name + * Remove the named object from the cache + * @param name the name */ - void removeProperty(String name); + void remove(String name); /** - * Add a listener to the context that will receive notification - * when the context is disposed. Adding a listener that has already + * Add a listener to the cache that will receive notification + * when the cache is disposed. Adding a listener that has already * been added has no effect. * @param listener the listener to add */ - void addDisposeListener(IDisposeListener listener); + void addCacheListener(ICacheListener listener); /** * Remove the listener. Removing a listener that is not registered * has no effect. * @param listener the listener to remove */ - void removeDisposeListener(IDisposeListener listener); + void removeDisposeListener(ICacheListener listener); } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IDisposeListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ICacheListener.java index 3d73ac966..201bbb791 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IDisposeListener.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ICacheListener.java @@ -8,12 +8,14 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.core.mapping; +package org.eclipse.team.core; /** - * Listener that, when registered with a synchronization context, gets invoked - * when the context is disposed. + * Listener that, when registered with a cache, gets invoked + * when the cache is disposed. + * <p> + * Clients may implement this interface * * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as @@ -24,11 +26,11 @@ package org.eclipse.team.core.mapping; * * @since 3.2 */ -public interface IDisposeListener { +public interface ICacheListener { /** - * The given context has been disposed. + * The given cache has been disposed. * @param context the context that was disposed */ - void contextDisposed(ISynchronizationContext context); + void cacheDisposed(ICache cache); } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IPropertyChangeListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IPropertyChangeListener.java deleted file mode 100644 index 630eaa386..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IPropertyChangeListener.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.core.mapping; - -import java.util.EventListener; - -/** - * Listener for property changes. - * <p> - * Usage: - * <pre> - * IPropertyChangeListener listener = - * new IPropertyChangeListener() { - * public void propertyChange(PropertyChangeEvent event) { - * ... // code to deal with occurrence of property change - * } - * }; - * emitter.addPropertyChangeListener(listener); - * ... - * emitter.removePropertyChangeListener(listener); - * </pre> - * </p> - * <p> - * <strong>EXPERIMENTAL</strong>. This class or interface has been added as - * part of a work in progress. There is a guarantee neither that this API will - * work nor that it will remain the same. Please do not use this API without - * consulting with the Platform/Team team. - * </p> - * @since 3.2 - */ -public interface IPropertyChangeListener extends EventListener { - - /** - * Notification that a property has changed. - * <p> - * This method gets called when the observed object fires a property - * change event. - * </p> - * - * @param event the property change event object describing which - * property changed and how - */ - public void propertyChange(PropertyChangeEvent event); -} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IResourceMappingScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IResourceMappingScope.java index 52afb27f5..ca830f15d 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IResourceMappingScope.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IResourceMappingScope.java @@ -1,149 +1,25 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2006 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: - * IBM Corporation - initial API and implementation + * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.team.core.mapping; -import org.eclipse.core.resources.mapping.*; -import org.eclipse.team.core.mapping.provider.ResourceMappingScopeManager; +import org.eclipse.core.resources.IResource; /** - * Interface which defines the protocol for translating a set of - * <code>ResourceMapping</code> objects representing a view selection into the - * complete set of resources to be operated on. - * <p> - * This interface is not intended to be implemented by clients. Instead, clients should - * use a {@link ResourceMappingScopeManager} to generate a resource mapping scope from - * a set of input resource mappings. - * - * <p> - * <strong>EXPERIMENTAL</strong>. This class or interface has been added as - * part of a work in progress. There is a guarantee neither that this API will - * work nor that it will remain the same. Please do not use this API without - * consulting with the Platform/Team team. - * </p> - * - * @see org.eclipse.core.resources.mapping.ResourceMapping - * @see ResourceMappingScopeManager - * + * @deprecated use {@link ISynchronizationScope} instead * @since 3.2 */ -public interface IResourceMappingScope extends ISynchronizationScope { - - /** - * Property change constant used to indicate that the mappings - * of the scope have changed. The input mappings of the scope - * do not change but it is possible that changes to resources - * will result in additional mappings in the scope due to - * relationships between models and the resources that contain them. - * A mapping propery change event may proceed a traversal change - * event if both properties have changed simultaneoulsy. - * The value associatd with the event will be an array of - * resource mappings (i.e. <code>ResourceMapping[]</code>) - */ - public static final String MAPPINGS = "org.eclipse.team.core.traversalsChanged"; //$NON-NLS-1$ - - /** - * Return the array of mappings that acted as the input to the scope builder - * that was used to build this scope. This set usually come from a view - * selection but could come from another source. In most cases, clients will - * want to call the {@link #getMappings()} method instead of this one as it - * returns the complete set of mappings to be operated on. - * - * @return the set of mappings that acted as the input to the scope builder - * that was used to build this scope - */ - public ResourceMapping[] getInputMappings(); - - /** - * Return a scope that only contains the input mappings of this - * scope. - * @return a scope that only contains the input mappings of this - * scope - */ - public IResourceMappingScope asInputScope(); +public interface IResourceMappingScope { - /** - * Return an array of all of the mappings to be operated on. The returned - * mappings were included in the operation during the scope building - * process. The returned mappings may be the same as the input mappings but - * may also be a super set. Clients can call the - * {@link #hasAdditionalMappings()} method to determine if the two sets are - * the same or not. - * - * @return an array of all of the mappings to be operated on. - */ - public ResourceMapping[] getMappings(); + IResource[] getRoots(); - /** - * Return an array of traversals that cover the resource mappings to be - * operated on as returned by the {@link #getMappings()} method. The - * traversals were calculated during the scope building process and cached - * with the scope. - * - * @return the complete set of mappings to be operated on - */ - public ResourceTraversal[] getTraversals(); - - /** - * Return an array of traversals that cover the given resource mapping to be - * operated on. The traversals were calculated during the scope building - * process and cached with the scope. - * - * @param mapping a resource mapping being operated on - * @return the traversals that cover the given resource mapping (or - * <code>null</code> if the mapping is not contained in the input) - */ - public ResourceTraversal[] getTraversals(ResourceMapping mapping); - - /** - * Return whether the scope has additional mappings added to the input - * mappings during the scope building process. - * - * @return whether the input has additional mappings added to the seed - * mappings - */ - public boolean hasAdditionalMappings(); - - /** - * Return whether the scope has additional resources added due to additional - * resource mappings. - * - * @return whether the input has additional resources added due to - * additional resource mappings - */ - public boolean hasAdditonalResources(); - - /** - * Return all the model providers that have mappings in this scope. - * - * @return all the model providers that have mappings in this scope - */ - public ModelProvider[] getModelProviders(); - - /** - * Return all the mappings to be operated on for the given model provider - * id. - * - * @param modelProviderId the id of the model provider - * @return all the mappings for the given model provider id - */ - public ResourceMapping[] getMappings(String modelProviderId); - - /** - * Return the resource mapping in the scope associated with the given model - * object or <code>null</code> if there isn't one. This method has no knowledge - * of hierarchical models so it only matches directly against the mappings - * that are contained in the scope. - * @param modelObject the model object - * @return the mapping for the model object that is contained in this scope - */ - public ResourceMapping getMapping(Object modelObject); + boolean contains(IResource resource); } 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 e168b5e48..3a33ddd58 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 @@ -16,6 +16,7 @@ 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.ICache; import org.eclipse.team.core.diff.*; import org.eclipse.team.core.mapping.provider.MergeContext; import org.eclipse.team.core.mapping.provider.SynchronizationContext; @@ -86,7 +87,7 @@ public interface ISynchronizationContext { * * @return the input that defined the scope of this synchronization context. */ - IResourceMappingScope getScope(); + ISynchronizationScope getScope(); /** * Return a tree that contains {@link IDiff} entries for resources that @@ -94,7 +95,7 @@ public interface ISynchronizationContext { * resources that are within the scope of this context. The tree may include * diffs for additional resources, which should be ignored by the client. * Clients can test for inclusion using the method - * {@link IResourceMappingScope#contains(IResource)}. + * {@link ISynchronizationScope#contains(IResource)}. * <p> * The returned {@link IResourceDiffTree} will be homogeneous and contain either * {@link IResourceDiff} or {@link IThreeWayDiff} instances. Any @@ -135,7 +136,7 @@ public interface ISynchronizationContext { * applies. * @return the cache associated with this synchronization context */ - public IDiffCache getCache(); + public ICache getCache(); /** * Dispose of the synchronization context and the cache of the context. This diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScope.java index 3abd75d16..005dbd357 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScope.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScope.java @@ -11,41 +11,74 @@ package org.eclipse.team.core.mapping; import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.mapping.ResourceTraversal; +import org.eclipse.core.resources.mapping.*; +import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager; /** - * A synchronization scope defines the set of resources involved in a synchronization - * operation. + * Interface which defines the protocol for translating a set of + * <code>ResourceMapping</code> objects representing a view selection into the + * complete set of resources to be operated on. * <p> - * This interface is not intended to be implemented by clients - * </p> + * This interface is not intended to be implemented by clients. Instead, clients should + * use a {@link SynchronizationScopeManager} to generate a resource mapping scope from + * a set of input resource mappings. + * * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as * part of a work in progress. There is a guarantee neither that this API will * work nor that it will remain the same. Please do not use this API without * consulting with the Platform/Team team. - * </p> + * </p> + * + * @see org.eclipse.core.resources.mapping.ResourceMapping + * @see SynchronizationScopeManager + * * @since 3.2 */ -public interface ISynchronizationScope { - +public interface ISynchronizationScope extends IResourceMappingScope { + /** - * Property change constant used to indicate that the traversals - * of the scope have changed. The value associated with the - * change event will be an array of traversals (i.e. - * <code>ResourceTraversal[]</code> + * Return the array of mappings that acted as the input to the scope builder + * that was used to build this scope. This set usually come from a view + * selection but could come from another source. In most cases, clients will + * want to call the {@link #getMappings()} method instead of this one as it + * returns the complete set of mappings to be operated on. + * + * @return the set of mappings that acted as the input to the scope builder + * that was used to build this scope */ - public static final String TRAVERSALS = "org.eclipse.team.core.traversalsChanged"; //$NON-NLS-1$ + public ResourceMapping[] getInputMappings(); /** - * Return the set of resource traversals that define this scope. - * A resource is considered to be contained in this scope if - * the resource is contained in at least one of the returned - * traversals. - * @return the set of resource traversals that define this scope + * Return a scope that only contains the input mappings of this + * scope. + * @return a scope that only contains the input mappings of this + * scope + */ + public ISynchronizationScope asInputScope(); + + /** + * Return an array of all of the mappings to be operated on. The returned + * mappings were included in the operation during the scope building + * process. The returned mappings may be the same as the input mappings but + * may also be a super set. Clients can call the + * {@link #hasAdditionalMappings()} method to determine if the two sets are + * the same or not. + * + * @return an array of all of the mappings to be operated on. + */ + public ResourceMapping[] getMappings(); + + /** + * Return an array of traversals that cover the resource mappings to be + * operated on as returned by the {@link #getMappings()} method. The + * traversals were calculated during the scope building process and cached + * with the scope. + * + * @return the complete set of mappings to be operated on */ public ResourceTraversal[] getTraversals(); - + /** * Return the resources that are the roots of this scope. * The roots are determined by collecting the roots of @@ -64,19 +97,75 @@ public interface ISynchronizationScope { public boolean contains(IResource resource); /** - * Add a property change listener that will get invoked when a + * Add a scope change listener that will get invoked when a * property of the receiver changes. Adding a listener that is * already added has no effect. * * @param listener the listener to be added */ - public void addPropertyChangeListener(IPropertyChangeListener listener); + public void addScopeChangeListener(ISynchronizationScopeChangeListener listener); /** - * Remove a property change listener. Removing an unregistered listener + * Remove a scope change listener. Removing an unregistered listener * has no effect. * * @param listener the listener to be removed */ - public void removePropertyChangeListener(IPropertyChangeListener listener); + public void removeScopeChangeListener(ISynchronizationScopeChangeListener listener); + + /** + * Return an array of traversals that cover the given resource mapping to be + * operated on. The traversals were calculated during the scope building + * process and cached with the scope. + * + * @param mapping a resource mapping being operated on + * @return the traversals that cover the given resource mapping (or + * <code>null</code> if the mapping is not contained in the input) + */ + public ResourceTraversal[] getTraversals(ResourceMapping mapping); + + /** + * Return whether the scope has additional mappings added to the input + * mappings during the scope building process. + * + * @return whether the input has additional mappings added to the seed + * mappings + */ + public boolean hasAdditionalMappings(); + + /** + * Return whether the scope has additional resources added due to additional + * resource mappings. + * + * @return whether the input has additional resources added due to + * additional resource mappings + */ + public boolean hasAdditonalResources(); + + /** + * Return all the model providers that have mappings in this scope. + * + * @return all the model providers that have mappings in this scope + */ + public ModelProvider[] getModelProviders(); + + /** + * Return all the mappings to be operated on for the given model provider + * id. + * + * @param modelProviderId the id of the model provider + * @return all the mappings for the given model provider id + */ + public ResourceMapping[] getMappings(String modelProviderId); + + /** + * Return the resource mapping in the scope associated with the given model + * object or <code>null</code> if there isn't one. This method has no knowledge + * of hierarchical models so it only matches directly against the mappings + * that are contained in the scope. + * @param modelObject the model object + * @return the mapping for the model object that is contained in this scope + */ + public ResourceMapping getMapping(Object modelObject); + } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScopeChangeListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScopeChangeListener.java new file mode 100644 index 000000000..89a828617 --- /dev/null +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScopeChangeListener.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2000, 2005 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.team.core.mapping; + +import java.util.EventListener; + +import org.eclipse.core.resources.mapping.ResourceMapping; +import org.eclipse.core.resources.mapping.ResourceTraversal; + +/** + * Listener for synchronization scope changes. + * </p> + * <p> + * Clients may implement this interface. + * </p> + * + * @see ISynchronizationScope + * <p> + * <strong>EXPERIMENTAL</strong>. This class or interface has been added + * as part of a work in progress. There is a guarantee neither that this + * API will work nor that it will remain the same. Please do not use this + * API without consulting with the Platform/Team team. + * </p> + * + * @since 3.2 + */ +public interface ISynchronizationScopeChangeListener extends EventListener { + + /** + * Notification that the scope has changed. The change may be the inclusion + * of new resource mappings, new resource traversals or both. This can be + * due to changes to the resource mappings used to calculate the traversals + * of the scope or because new resources have come under the control of the + * repository provider (or other entity) that generated the scope in the + * first place. + * + * @param scope + * the scope that has changed + * @param newTraversals + * the new traversals (may be empty) + * @param newMappings + * the new mappings (may be empty) + */ + void scopeChanged(ISynchronizationScope scope, + ResourceMapping[] newMappings, ResourceTraversal[] newTraversals); +} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IResourceMappingScopeManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScopeManager.java index cef813892..b8cc4d8f7 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IResourceMappingScopeManager.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScopeManager.java @@ -14,20 +14,19 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.mapping.*; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.mapping.provider.IResourceMappingScopeParticipant; -import org.eclipse.team.core.mapping.provider.ResourceMappingScopeManager; +import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager; /** * A scope manager is responsible for ensuring that the resources - * contained within an {@link IResourceMappingScope} stay up-to-date + * contained within an {@link ISynchronizationScope} stay up-to-date * with the model elements (represented as {@link ResourceMapping} instances) * contained in the scope. The task of keeping a scope up-to-date is - * accomplished by obtaining {@link IResourceMappingScopeParticipant} instances + * accomplished by obtaining {@link ISynchronizationScopeParticipant} instances * for each model that has elements contained in the scope. * * <p> * This interface is not intended to be implemented by clients. Clients can instead - * subclass {@link ResourceMappingScopeManager}. + * subclass {@link SynchronizationScopeManager}. * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as * part of a work in progress. There is a guarantee neither that this API will @@ -36,18 +35,18 @@ import org.eclipse.team.core.mapping.provider.ResourceMappingScopeManager; * </p> * * @see org.eclipse.core.resources.mapping.ResourceMapping - * @see ResourceMappingScopeManager - * @see IResourceMappingScopeParticipant + * @see SynchronizationScopeManager + * @see ISynchronizationScopeParticipant * * @since 3.2 */ -public interface IResourceMappingScopeManager { +public interface ISynchronizationScopeManager { /** * Return the scope that is managed by this manager. * @return the scope that is managed by this manager */ - IResourceMappingScope getScope(); + ISynchronizationScope getScope(); /** * Return the projects that apply to this manager. @@ -115,7 +114,7 @@ public interface IResourceMappingScopeManager { /** * Refresh the given mapping asynchronously. This method - * is called by {@link IResourceMappingScopeParticipant} + * is called by {@link ISynchronizationScopeParticipant} * instances when they detect changes that require the scope * to be adjusted. * @param mappings the mappings to be refeshed. diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/IResourceMappingScopeParticipant.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScopeParticipant.java index a2597ba6e..9b5063e33 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/IResourceMappingScopeParticipant.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScopeParticipant.java @@ -8,22 +8,20 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.core.mapping.provider; +package org.eclipse.team.core.mapping; import org.eclipse.core.resources.*; import org.eclipse.core.resources.mapping.RemoteResourceMappingContext; import org.eclipse.core.resources.mapping.ResourceMapping; -import org.eclipse.team.core.mapping.*; /** * A scope participant is responsible for ensuring that the resources contained - * within an {@link IResourceMappingScope} that overlap with the participant's + * within an {@link ISynchronizationScope} that overlap with the participant's * model provider stay up-to-date with the model elements (represented as * {@link ResourceMapping} instances) contained in the scope. * * <p> - * This interface is not intended to be implemented by clients. CLients should instead subclass - * {@link ResourceMappingScopeParticipant}. + * Clients may implement this interface * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as * part of a work in progress. There is a guarantee neither that this API will @@ -32,11 +30,11 @@ import org.eclipse.team.core.mapping.*; * </p> * * @see org.eclipse.core.resources.mapping.ResourceMapping - * @see IResourceMappingScopeManager + * @see ISynchronizationScopeManager * * @since 3.2 */ -public interface IResourceMappingScopeParticipant { +public interface ISynchronizationScopeParticipant { /** * Callback that the manager makes to participants when the state of @@ -46,7 +44,7 @@ public interface IResourceMappingScopeParticipant { * more resources changes w.r.t. the context. It is the responsibility of the * participant to react to local changes that affect the resources in the * scope by calling - * {@link IResourceMappingScopeManager#refresh(ResourceMapping[], org.eclipse.core.runtime.IProgressMonitor)}. + * {@link ISynchronizationScopeManager#refresh(ResourceMapping[])}. * * @param manager * the scope manager @@ -57,7 +55,7 @@ public interface IResourceMappingScopeParticipant { * @return the resource mappings that need to be refreshed. */ ResourceMapping[] handleContextChange( - IResourceMappingScopeManager manager, IResource[] resources, IProject[] projects); + ISynchronizationScopeManager manager, IResource[] resources, IProject[] projects); /** * Callback from the scope manager when the scope is no longer needed. diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IResourceMappingScopeParticipantFactory.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScopeParticipantFactory.java index c8c4283d5..e8a25559f 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/IResourceMappingScopeParticipantFactory.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ISynchronizationScopeParticipantFactory.java @@ -13,11 +13,10 @@ package org.eclipse.team.core.mapping; import org.eclipse.core.resources.mapping.ModelProvider; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdapterManager; -import org.eclipse.team.core.mapping.provider.IResourceMappingScopeParticipant; /** * Factory interface for creating a participant for use with an - * {@link IResourceMappingScopeManager}. This factory should be + * {@link ISynchronizationScopeManager}. This factory should be * assocated with a {@link ModelProvider} using the {@link IAdaptable} * mechanism. * <p> @@ -26,8 +25,8 @@ import org.eclipse.team.core.mapping.provider.IResourceMappingScopeParticipant; * @see ModelProvider * @see IAdaptable * @see IAdapterManager - * @see IResourceMappingScopeManager - * @see IResourceMappingScopeParticipant + * @see ISynchronizationScopeManager + * @see ISynchronizationScopeParticipant * @see ResourceMappingScopeParticipant * <p> * <strong>EXPERIMENTAL</strong>. This class or interface has been added as @@ -37,7 +36,7 @@ import org.eclipse.team.core.mapping.provider.IResourceMappingScopeParticipant; * </p> * @since 3.2 */ -public interface IResourceMappingScopeParticipantFactory { +public interface ISynchronizationScopeParticipantFactory { /** * Create a participant in the scope management process for the given model provider. @@ -45,6 +44,6 @@ public interface IResourceMappingScopeParticipantFactory { * @param manager the scope manager * @return a participant in the scope management process */ - IResourceMappingScopeParticipant createParticipant(ModelProvider provider, IResourceMappingScopeManager manager); + ISynchronizationScopeParticipant createParticipant(ModelProvider provider, ISynchronizationScopeManager manager); } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/PropertyChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/PropertyChangeEvent.java deleted file mode 100644 index 314d29554..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/PropertyChangeEvent.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.core.mapping; - -import java.util.EventObject; - -import org.eclipse.core.runtime.Assert; - -/** - * An event object describing a change to a named property. - * <p> - * This concrete class was designed to be instantiated, but may - * also be subclassed if required. - * </p> - * <p> - * The Team framework contain classes that report property - * change events for internal state changes that may be of interest - * to external parties. A special listener interface - * (<code>IPropertyChangeListener</code>) is defined for this purpose, - * and a typical class allow listeners to be registered via - * an <code>addPropertyChangeListener</code> method. - * </p> - * <p> - * <strong>EXPERIMENTAL</strong>. This class or interface has been added as - * part of a work in progress. There is a guarantee neither that this API will - * work nor that it will remain the same. Please do not use this API without - * consulting with the Platform/Team team. - * </p> - * @see IPropertyChangeListener - */ -public class PropertyChangeEvent extends EventObject { - - /** - * Generated serial version UID for this class. - * @since 3.1 - */ - private static final long serialVersionUID = 3256726173533811256L; - - /** - * The name of the changed property. - */ - private String propertyName; - - /** - * The old value of the changed property, or <code>null</code> if - * not known or not relevant. - */ - private Object oldValue; - - /** - * The new value of the changed property, or <code>null</code> if - * not known or not relevant. - */ - private Object newValue; - - /** - * Creates a new property change event. - * - * @param source the object whose property has changed - * @param property the property that has changed (must not be <code>null</code>) - * @param oldValue the old value of the property, or <code>null</code> if none - * @param newValue the new value of the property, or <code>null</code> if none - */ - public PropertyChangeEvent(Object source, String property, Object oldValue, - Object newValue) { - super(source); - Assert.isNotNull(property); - this.propertyName = property; - this.oldValue = oldValue; - this.newValue = newValue; - } - - /** - * Returns the new value of the property. - * - * @return the new value, or <code>null</code> if not known - * or not relevant (for instance if the property was removed). - */ - public Object getNewValue() { - return newValue; - } - - /** - * Returns the old value of the property. - * - * @return the old value, or <code>null</code> if not known - * or not relevant (for instance if the property was just - * added and there was no old value). - */ - public Object getOldValue() { - return oldValue; - } - - /** - * Returns the name of the property that changed. - * <p> - * Warning: there is no guarantee that the property name returned - * is a constant string. Callers must compare property names using - * equals, not ==. - * </p> - * - * @return the name of the property that changed - */ - public String getProperty() { - return propertyName; - } -} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingScopeParticipant.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingScopeParticipant.java deleted file mode 100644 index a276797d1..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingScopeParticipant.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.core.mapping; - -import org.eclipse.team.core.mapping.provider.IResourceMappingScopeParticipant; - -/** - * Implementation of the {@link IResourceMappingScopeParticipant} class. - * - * @see IResourceMappingScopeParticipantFactory - * <p> - * <strong>EXPERIMENTAL</strong>. This class or interface has been added as - * part of a work in progress. There is a guarantee neither that this API will - * work nor that it will remain the same. Please do not use this API without - * consulting with the Platform/Team team. - * </p> - * @since 3.2 - */ -public abstract class ResourceMappingScopeParticipant implements - IResourceMappingScopeParticipant { - - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.provider.IResourceMappingScopeParticipant#dispose() - */ - public void dispose() { - // Do nothing, by default - } - -} diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java index aa9f587ae..682d62f42 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java @@ -48,7 +48,7 @@ public abstract class MergeContext extends SynchronizationContext implements IMe * Create a merge context. * @param type */ - protected MergeContext(IResourceMappingScope input, int type, IResourceDiffTree deltaTree) { + protected MergeContext(ISynchronizationScope input, int type, IResourceDiffTree deltaTree) { super(input, type, deltaTree); } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationContext.java index ae500a434..cbc95b33d 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationContext.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationContext.java @@ -15,9 +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.team.core.ICache; import org.eclipse.team.core.mapping.*; +import org.eclipse.team.internal.core.Cache; import org.eclipse.team.internal.core.Policy; -import org.eclipse.team.internal.core.mapping.DiffCache; /** * Abstract implementation of the {@link ISynchronizationContext} interface. @@ -35,10 +36,10 @@ import org.eclipse.team.internal.core.mapping.DiffCache; */ public abstract class SynchronizationContext implements ISynchronizationContext { - private IResourceMappingScope scope; + private ISynchronizationScope scope; private final int type; private final IResourceDiffTree diffTree; - private DiffCache cache; + private Cache cache; /** * Create a synchronization context. @@ -46,7 +47,7 @@ public abstract class SynchronizationContext implements ISynchronizationContext * @param type the type of synchronization (ONE_WAY or TWO_WAY) * @param diffTree the sync info tree that contains all out-of-sync resources */ - protected SynchronizationContext(IResourceMappingScope scope, int type, IResourceDiffTree diffTree) { + protected SynchronizationContext(ISynchronizationScope scope, int type, IResourceDiffTree diffTree) { this.scope = scope; this.type = type; this.diffTree = diffTree; @@ -55,7 +56,7 @@ public abstract class SynchronizationContext implements ISynchronizationContext /** * {@inheritDoc} */ - public IResourceMappingScope getScope() { + public ISynchronizationScope getScope() { return scope; } @@ -78,9 +79,9 @@ public abstract class SynchronizationContext implements ISynchronizationContext /** * {@inheritDoc} */ - public synchronized IDiffCache getCache() { + public synchronized ICache getCache() { if (cache == null) { - cache = new DiffCache(this); + cache = new Cache(); } return cache; } @@ -97,7 +98,7 @@ public abstract class SynchronizationContext implements ISynchronizationContext */ public void refresh(ResourceMapping[] mappings, IProgressMonitor monitor) throws CoreException { monitor.beginTask(null, 100); - ResourceMappingScopeManager manager = null; //getScopeManager(); + SynchronizationScopeManager manager = null; //getScopeManager(); if (manager == null) { // The scope manager is missing so just refresh everything refresh(scope.getTraversals(), IResource.NONE, Policy.subMonitorFor(monitor, 50)); diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceMappingScopeManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java index 6411ee72c..c27da1bc0 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceMappingScopeManager.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java @@ -62,12 +62,12 @@ import org.eclipse.team.internal.core.mapping.*; * * @since 3.2 */ -public class ResourceMappingScopeManager implements IResourceMappingScopeManager { +public class SynchronizationScopeManager implements ISynchronizationScopeManager { private static final int MAX_ITERATION = 10; private final ResourceMappingContext context; private final boolean consultModels; - private IResourceMappingScope scope; + private ISynchronizationScope scope; private boolean initialized; private ScopeManagerEventHandler handler; @@ -116,7 +116,7 @@ public class ResourceMappingScopeManager implements IResourceMappingScopeManager * @param resourceMappingContext a resource mapping context * @param consultModels whether modle providers should be consulted */ - public ResourceMappingScopeManager(ResourceMapping[] inputMappings, ResourceMappingContext resourceMappingContext, boolean consultModels) { + public SynchronizationScopeManager(ResourceMapping[] inputMappings, ResourceMappingContext resourceMappingContext, boolean consultModels) { this.context = resourceMappingContext; this.consultModels = consultModels; scope = createScope(inputMappings); @@ -216,11 +216,35 @@ public class ResourceMappingScopeManager implements IResourceMappingScopeManager refreshTraversals.addTraversals(result); } } - if (scope.getMappings().length > originalMappings.length) { - fileMappingsChangedEvent(originalMappings); - } - if (expanded) { - fireTraversalsChangedEvent(originalTraversals); + ResourceMapping[] currentMappings = scope.getMappings(); + if (expanded || currentMappings.length > originalMappings.length) { + ResourceTraversal[] newTraversals; + if (expanded) { + CompoundResourceTraversal originals = new CompoundResourceTraversal(); + originals.addTraversals(originalTraversals); + newTraversals = originals.getUncoveredTraversals(refreshTraversals); + } else { + newTraversals = new ResourceTraversal[0]; + } + ResourceMapping[] newMappings; + if (currentMappings.length > originalMappings.length) { + Set originalSet = new HashSet(); + List result = new ArrayList(); + for (int i = 0; i < originalMappings.length; i++) { + ResourceMapping mapping = originalMappings[i]; + originalSet.add(mapping); + } + for (int i = 0; i < currentMappings.length; i++) { + ResourceMapping mapping = currentMappings[i]; + if (!originalSet.contains(mapping)) { + result.add(mapping); + } + } + newMappings = (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]); + } else { + newMappings = new ResourceMapping[0]; + } + fireMappingsChangedEvent(newMappings, newTraversals); } monitor.done(); @@ -285,17 +309,8 @@ public class ResourceMappingScopeManager implements IResourceMappingScopeManager * The new mappings are obtained from the scope. * @param originalMappings the original mappings of the scope. */ - private void fileMappingsChangedEvent(ResourceMapping[] originalMappings) { - ((ResourceMappingScope)scope).fireMappingChangedEvent(originalMappings); - } - - /* - * Fire a traversals changed event to any listeners on the scope. - * The new traversals are obtained from the scope. - * @param originalTraversals the original traversals of the scope. - */ - protected final void fireTraversalsChangedEvent(ResourceTraversal[] originalTraversals) { - ((ResourceMappingScope)scope).fireTraversalsChangedEvent(originalTraversals); + private void fireMappingsChangedEvent(ResourceMapping[] newMappings, ResourceTraversal[] newTraversals) { + ((ResourceMappingScope)scope).fireTraversalsChangedEvent(newTraversals, newMappings); } /** @@ -306,7 +321,7 @@ public class ResourceMappingScopeManager implements IResourceMappingScopeManager * additional mappings */ protected final void setHasAdditionalMappings( - IResourceMappingScope scope, boolean hasAdditionalMappings) { + ISynchronizationScope scope, boolean hasAdditionalMappings) { ((ResourceMappingScope)scope).setHasAdditionalMappings(hasAdditionalMappings); } @@ -328,7 +343,7 @@ public class ResourceMappingScopeManager implements IResourceMappingScopeManager * @return a newly created scope that will be populated and returned by the * builder */ - protected final IResourceMappingScope createScope( + protected final ISynchronizationScope createScope( ResourceMapping[] inputMappings) { return new ResourceMappingScope(inputMappings); } @@ -412,7 +427,7 @@ public class ResourceMappingScopeManager implements IResourceMappingScopeManager /* (non-Javadoc) * @see org.eclipse.team.core.mapping.IResourceMappingScopeManager#getScope() */ - public IResourceMappingScope getScope() { + public ISynchronizationScope getScope() { return scope; } 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 77c363f30..5e1f197f2 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 @@ -14,7 +14,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.mapping.ResourceTraversal; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.team.core.mapping.IResourceMappingScopeManager; +import org.eclipse.team.core.mapping.ISynchronizationScopeManager; import org.eclipse.team.core.mapping.provider.MergeContext; import org.eclipse.team.core.mapping.provider.ResourceDiffTree; import org.eclipse.team.core.synchronize.SyncInfo; @@ -39,9 +39,9 @@ public abstract class SubscriberMergeContext extends MergeContext { private Subscriber subscriber; private SubscriberDiffTreeEventHandler handler; - private final IResourceMappingScopeManager manager; + private final ISynchronizationScopeManager manager; - protected SubscriberMergeContext(Subscriber subscriber, IResourceMappingScopeManager manager) { + protected SubscriberMergeContext(Subscriber subscriber, ISynchronizationScopeManager manager) { super(manager.getScope(), getType(subscriber), new ResourceDiffTree()); this.subscriber = subscriber; this.manager = manager; diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberScopeManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberScopeManager.java index 62f3f91b1..b953bc19b 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberScopeManager.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberScopeManager.java @@ -15,13 +15,11 @@ import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.core.resources.mapping.*; import org.eclipse.core.runtime.*; -import org.eclipse.team.core.mapping.IResourceMappingScopeManager; -import org.eclipse.team.core.mapping.IResourceMappingScopeParticipantFactory; -import org.eclipse.team.core.mapping.provider.IResourceMappingScopeParticipant; -import org.eclipse.team.core.mapping.provider.ResourceMappingScopeManager; +import org.eclipse.team.core.mapping.*; +import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager; /** - * A {@link IResourceMappingScopeManager} that uses a {@link Subscriber} to provide + * A {@link ISynchronizationScopeManager} that uses a {@link Subscriber} to provide * a {@link RemoteResourceMappingContext} and to notify participants when the * remote state of resources change. * <p> @@ -32,7 +30,7 @@ import org.eclipse.team.core.mapping.provider.ResourceMappingScopeManager; * </p> * @since 3.2 */ -public class SubscriberScopeManager extends ResourceMappingScopeManager implements ISubscriberChangeListener { +public class SubscriberScopeManager extends SynchronizationScopeManager implements ISubscriberChangeListener { private final Subscriber subscriber; private Map participants = new HashMap(); @@ -72,7 +70,7 @@ public class SubscriberScopeManager extends ResourceMappingScopeManager implemen */ public void dispose() { for (Iterator iter = participants.values().iterator(); iter.hasNext();) { - IResourceMappingScopeParticipant p = (IResourceMappingScopeParticipant) iter.next(); + ISynchronizationScopeParticipant p = (ISynchronizationScopeParticipant) iter.next(); p.dispose(); } super.dispose(); @@ -118,7 +116,7 @@ public class SubscriberScopeManager extends ResourceMappingScopeManager implemen for (int i = 0; i < providers.length; i++) { ModelProvider provider = providers[i]; if (!participants.containsKey(provider)) { - IResourceMappingScopeParticipant p = createParticipant(provider); + ISynchronizationScopeParticipant p = createParticipant(provider); if (p != null) { participants.put(provider, p); } @@ -129,10 +127,10 @@ public class SubscriberScopeManager extends ResourceMappingScopeManager implemen /* * Obtain a participant through the factory which is obtained using IAdaptable */ - private IResourceMappingScopeParticipant createParticipant(ModelProvider provider) { - Object factoryObject = provider.getAdapter(IResourceMappingScopeParticipantFactory.class); - if (factoryObject instanceof IResourceMappingScopeParticipantFactory) { - IResourceMappingScopeParticipantFactory factory = (IResourceMappingScopeParticipantFactory) factoryObject; + private ISynchronizationScopeParticipant createParticipant(ModelProvider provider) { + Object factoryObject = provider.getAdapter(ISynchronizationScopeParticipantFactory.class); + if (factoryObject instanceof ISynchronizationScopeParticipantFactory) { + ISynchronizationScopeParticipantFactory factory = (ISynchronizationScopeParticipantFactory) factoryObject; return factory.createParticipant(provider, this); } return null; @@ -158,9 +156,9 @@ public class SubscriberScopeManager extends ResourceMappingScopeManager implemen private void fireChange(final IResource[] resources, final IProject[] projects) { final Set result = new HashSet(); - IResourceMappingScopeParticipant[] handlers = (IResourceMappingScopeParticipant[]) participants.values().toArray(new IResourceMappingScopeParticipant[participants.size()]); + ISynchronizationScopeParticipant[] handlers = (ISynchronizationScopeParticipant[]) participants.values().toArray(new ISynchronizationScopeParticipant[participants.size()]); for (int i = 0; i < handlers.length; i++) { - final IResourceMappingScopeParticipant participant = handlers[i]; + final ISynchronizationScopeParticipant participant = handlers[i]; Platform.run(new ISafeRunnable() { public void run() throws Exception { ResourceMapping[] mappings = participant.handleContextChange(SubscriberScopeManager.this, resources, projects); diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/DiffCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.java index 942686c72..7481e7ecd 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/DiffCache.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.java @@ -8,13 +8,14 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.internal.core.mapping; +package org.eclipse.team.internal.core; import java.util.HashMap; import java.util.Map; import org.eclipse.core.runtime.*; -import org.eclipse.team.core.mapping.*; +import org.eclipse.team.core.ICache; +import org.eclipse.team.core.ICacheListener; /** * A synchronize operation context that supports caching of @@ -28,33 +29,25 @@ import org.eclipse.team.core.mapping.*; * consulting with the Platform/Team team. * </p> * - * @see org.eclipse.team.core.mapping.IDiffCache + * @see org.eclipse.team.core.ICache * @since 3.2 */ -public class DiffCache implements IDiffCache { +public class Cache implements ICache { Map properties; ListenerList listeners; - private final ISynchronizationContext context; - - /** - * CCreate an empty cache - */ - public DiffCache(ISynchronizationContext context) { - this.context = context; - } /* (non-Javadoc) * @see org.eclipse.team.ui.mapping.ISynchronizeOperationContext#addProperty(java.lang.String, java.lang.Object) */ - public synchronized void putProperty(String name, Object value) { + public synchronized void put(String name, Object value) { if (properties == null) { properties = new HashMap(); } properties.put(name, value); } - public synchronized Object getProperty(String name) { + public synchronized Object get(String name) { if (properties == null) return null; return properties.get(name); @@ -63,7 +56,7 @@ public class DiffCache implements IDiffCache { /* (non-Javadoc) * @see org.eclipse.team.ui.mapping.ISynchronizeOperationContext#removeProperty(java.lang.String) */ - public synchronized void removeProperty(String name) { + public synchronized void remove(String name) { if (properties != null) properties.remove(name); if (properties.isEmpty()) { @@ -75,7 +68,7 @@ public class DiffCache implements IDiffCache { /* (non-Javadoc) * @see org.eclipse.team.ui.mapping.ISynchronizeOperationContext#addDisposeListener(org.eclipse.team.ui.mapping.IDisposeListener) */ - public synchronized void addDisposeListener(IDisposeListener listener) { + public synchronized void addCacheListener(ICacheListener listener) { if (listeners == null) listeners = new ListenerList(ListenerList.IDENTITY); listeners.add(listener); @@ -85,7 +78,7 @@ public class DiffCache implements IDiffCache { /* (non-Javadoc) * @see org.eclipse.team.ui.mapping.ISynchronizeOperationContext#removeDisposeListener(org.eclipse.team.ui.mapping.IDisposeListener) */ - public synchronized void removeDisposeListener(IDisposeListener listener) { + public synchronized void removeDisposeListener(ICacheListener listener) { if (listeners != null) listeners.remove(listener); } @@ -100,7 +93,7 @@ public class DiffCache implements IDiffCache { final Object listener = allListeners[i]; Platform.run(new ISafeRunnable(){ public void run() throws Exception { - ((IDisposeListener)listener).contextDisposed(context); + ((ICacheListener)listener).cacheDisposed(Cache.this); } public void handleException(Throwable exception) { // Ignore since the platform logs the error diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java index c2b4ffec5..6b2c38f50 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java @@ -15,13 +15,13 @@ import java.util.Set; import org.eclipse.core.resources.mapping.ModelProvider; import org.eclipse.core.resources.mapping.ResourceMapping; -import org.eclipse.team.core.mapping.IResourceMappingScope; +import org.eclipse.team.core.mapping.ISynchronizationScope; import org.eclipse.team.internal.core.subscribers.AbstractSynchronizationScope; /** * Class that contains common resource mapping scope code. */ -public abstract class AbstractResourceMappingScope extends AbstractSynchronizationScope implements IResourceMappingScope { +public abstract class AbstractResourceMappingScope extends AbstractSynchronizationScope implements ISynchronizationScope { /* (non-Javadoc) * @see org.eclipse.team.core.mapping.IResourceMappingScope#getMapping(java.lang.Object) diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java index 4ec99d9e5..dea4d0f76 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java @@ -247,10 +247,9 @@ public class CompoundResourceTraversal { return getUncoveredTraversals(other); } - private ResourceTraversal[] getUncoveredTraversals(CompoundResourceTraversal otherTraversal) { + public ResourceTraversal[] getUncoveredTraversals(CompoundResourceTraversal otherTraversal) { CompoundResourceTraversal uncovered = new CompoundResourceTraversal(); for (Iterator iter = otherTraversal.files.iterator(); iter.hasNext();) { - Set files = new HashSet(); IResource resource = (IResource) iter.next(); if (!isCovered(resource, IResource.DEPTH_ZERO)) { uncovered.addResource(resource, IResource.DEPTH_ZERO); diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java index 26b5a2706..16e5c0a34 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java @@ -10,12 +10,9 @@ *******************************************************************************/ package org.eclipse.team.internal.core.mapping; -import java.util.ArrayList; -import java.util.List; - import org.eclipse.core.resources.mapping.ResourceMapping; import org.eclipse.core.resources.mapping.ResourceTraversal; -import org.eclipse.team.core.mapping.IResourceMappingScope; +import org.eclipse.team.core.mapping.ISynchronizationScope; /** * This scope wraps another scope and treats the input mappings of @@ -23,9 +20,9 @@ import org.eclipse.team.core.mapping.IResourceMappingScope; */ public class ResourceMappingInputScope extends AbstractResourceMappingScope { - IResourceMappingScope wrappedScope; + ISynchronizationScope wrappedScope; - public ResourceMappingInputScope(IResourceMappingScope wrappedScope) { + public ResourceMappingInputScope(ISynchronizationScope wrappedScope) { this.wrappedScope = wrappedScope; } @@ -48,17 +45,14 @@ public class ResourceMappingInputScope extends AbstractResourceMappingScope { * @see org.eclipse.team.ui.mapping.IResourceMappingScope#getTraversals() */ public ResourceTraversal[] getTraversals() { + CompoundResourceTraversal result = new CompoundResourceTraversal(); ResourceMapping[] mappings = getMappings(); - List result = new ArrayList(); for (int i = 0; i < mappings.length; i++) { ResourceMapping mapping = mappings[i]; ResourceTraversal[] traversals = getTraversals(mapping); - for (int j = 0; j < traversals.length; j++) { - ResourceTraversal traversal = traversals[j]; - result.add(traversal); - } + result.addTraversals(traversals); } - return ResourceMappingScope.combineTraversals((ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()])); + return result.asTraversals(); } /* (non-Javadoc) @@ -99,7 +93,7 @@ public class ResourceMappingInputScope extends AbstractResourceMappingScope { /* (non-Javadoc) * @see org.eclipse.team.core.mapping.IResourceMappingScope#asInputScope() */ - public IResourceMappingScope asInputScope() { + public ISynchronizationScope asInputScope() { return this; } } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingScope.java index 7d4e46ee2..21a178d54 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingScope.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingScope.java @@ -10,16 +10,15 @@ *******************************************************************************/ package org.eclipse.team.internal.core.mapping; -import java.util.*; +import java.util.HashMap; +import java.util.Map; -import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.mapping.ResourceMapping; import org.eclipse.core.resources.mapping.ResourceTraversal; -import org.eclipse.team.core.mapping.IResourceMappingScope; -import org.eclipse.team.core.mapping.PropertyChangeEvent; +import org.eclipse.team.core.mapping.ISynchronizationScope; /** - * Concrete implementation of the {@link IResourceMappingScope} + * Concrete implementation of the {@link ISynchronizationScope} * interface for use by clients. * <p> * This class is not intended to be subclasses by clients @@ -43,37 +42,6 @@ public class ResourceMappingScope extends AbstractResourceMappingScope { private boolean hasAdditionalResources; private final CompoundResourceTraversal compoundTraversal = new CompoundResourceTraversal(); - public static ResourceTraversal[] combineTraversals(ResourceTraversal[] allTraversals) { - Set zero = new HashSet(); - Set shallow = new HashSet(); - Set deep = new HashSet(); - for (int i = 0; i < allTraversals.length; i++) { - ResourceTraversal traversal = allTraversals[i]; - switch (traversal.getDepth()) { - case IResource.DEPTH_ZERO: - zero.addAll(Arrays.asList(traversal.getResources())); - break; - case IResource.DEPTH_ONE: - shallow.addAll(Arrays.asList(traversal.getResources())); - break; - case IResource.DEPTH_INFINITE: - deep.addAll(Arrays.asList(traversal.getResources())); - break; - } - } - List result = new ArrayList(); - if (!zero.isEmpty()) { - result.add(new ResourceTraversal((IResource[]) zero.toArray(new IResource[zero.size()]), IResource.DEPTH_ZERO, IResource.NONE)); - } - if (!shallow.isEmpty()) { - result.add(new ResourceTraversal((IResource[]) shallow.toArray(new IResource[shallow.size()]), IResource.DEPTH_ONE, IResource.NONE)); - } - if (!deep.isEmpty()) { - result.add(new ResourceTraversal((IResource[]) deep.toArray(new IResource[deep.size()]), IResource.DEPTH_INFINITE, IResource.NONE)); - } - return (ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()]); - } - public ResourceMappingScope(ResourceMapping[] selectedMappings) { inputMappings = selectedMappings; } @@ -152,23 +120,15 @@ public class ResourceMappingScope extends AbstractResourceMappingScope { public boolean hasAdditonalResources() { return hasAdditionalResources; } - - public void fireTraversalsChangedEvent(ResourceTraversal[] oldTraversals) { - firePropertyChangedEvent(new PropertyChangeEvent(this, IResourceMappingScope.TRAVERSALS, oldTraversals, getTraversals())); - } public CompoundResourceTraversal getCompoundTraversal() { return compoundTraversal; } - - public void fireMappingChangedEvent(ResourceMapping[] originalMappings) { - firePropertyChangedEvent(new PropertyChangeEvent(this, IResourceMappingScope.MAPPINGS, originalMappings, getMappings())); - } /* (non-Javadoc) * @see org.eclipse.team.core.mapping.IResourceMappingScope#asInputScope() */ - public IResourceMappingScope asInputScope() { + public ISynchronizationScope asInputScope() { return new ResourceMappingInputScope(this); } } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java index 372ab695c..1853e4e4f 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java @@ -17,15 +17,15 @@ import org.eclipse.core.resources.mapping.ResourceMapping; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.mapping.IResourceMappingScopeManager; -import org.eclipse.team.core.mapping.provider.ResourceMappingScopeManager; +import org.eclipse.team.core.mapping.ISynchronizationScopeManager; +import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager; import org.eclipse.team.internal.core.BackgroundEventHandler; public class ScopeManagerEventHandler extends BackgroundEventHandler { public static final int REFRESH = 10; private Set toRefresh = new HashSet(); - private IResourceMappingScopeManager manager; + private ISynchronizationScopeManager manager; class ResourceMappingEvent extends Event { private final ResourceMapping[] mappings; @@ -35,7 +35,7 @@ public class ScopeManagerEventHandler extends BackgroundEventHandler { } } - public ScopeManagerEventHandler(ResourceMappingScopeManager manager) { + public ScopeManagerEventHandler(SynchronizationScopeManager manager) { super("Reconciling Scope", "Error occurred reconsiling the scope"); this.manager = manager; } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java index db24cbe54..e7db93d59 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java @@ -11,16 +11,13 @@ package org.eclipse.team.internal.core.subscribers; import java.util.*; -import java.util.ArrayList; -import java.util.List; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.mapping.ResourceMapping; import org.eclipse.core.resources.mapping.ResourceTraversal; import org.eclipse.core.runtime.*; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.team.core.mapping.*; import org.eclipse.team.core.mapping.ISynchronizationScope; +import org.eclipse.team.core.mapping.ISynchronizationScopeChangeListener; /** * An abstract implementation of an {@link ISynchronizationScope}. @@ -82,16 +79,17 @@ public abstract class AbstractSynchronizationScope implements ISynchronizationSc } /** - * Fire the given event to all listeners. - * @param event the event + * Fire the scope change event + * @param newTraversals the new traversals (may be empty) + * @param newMappings the new mappings (may be empty) */ - protected void firePropertyChangedEvent(final PropertyChangeEvent event) { + public void fireTraversalsChangedEvent(final ResourceTraversal[] newTraversals, final ResourceMapping[] newMappings) { Object[] allListeners = listeners.getListeners(); for (int i = 0; i < allListeners.length; i++) { final Object listener = allListeners[i]; Platform.run(new ISafeRunnable() { public void run() throws Exception { - ((IPropertyChangeListener)listener).propertyChange(event); + ((ISynchronizationScopeChangeListener)listener).scopeChanged(AbstractSynchronizationScope.this, newMappings, newTraversals); } public void handleException(Throwable exception) { // Logged by Platform @@ -103,19 +101,15 @@ public abstract class AbstractSynchronizationScope implements ISynchronizationSc /* (non-Javadoc) * @see org.eclipse.team.core.mapping.ISynchronizationScope#addPropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener) */ - public void addPropertyChangeListener(IPropertyChangeListener listener) { + public void addScopeChangeListener(ISynchronizationScopeChangeListener listener) { listeners.add(listener); } /* (non-Javadoc) * @see org.eclipse.team.core.mapping.ISynchronizationScope#removePropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener) */ - public void removePropertyChangeListener(IPropertyChangeListener listener) { + public void removeScopeChangeListener(ISynchronizationScopeChangeListener listener) { listeners.remove(listener); } - - protected void fireTraveralsChangedEvent(ResourceTraversal[] oldTraversals, ResourceTraversal[] newTraversals) { - firePropertyChangedEvent(new PropertyChangeEvent(this, TRAVERSALS, oldTraversals, newTraversals)); - } } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java new file mode 100644 index 000000000..8b14325db --- /dev/null +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2000, 2005 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.team.internal.core.subscribers; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.mapping.ResourceMapping; +import org.eclipse.core.resources.mapping.ResourceTraversal; +import org.eclipse.team.core.mapping.ISynchronizationScope; +import org.eclipse.team.internal.core.mapping.AbstractResourceMappingScope; + +/** + * A synchronization scope for a set of resources. + */ +public class RootResourceSynchronizationScope extends AbstractResourceMappingScope { + + private IResource[] roots; + + public RootResourceSynchronizationScope(IResource[] roots) { + this.roots = roots; + } + + public ResourceTraversal[] getTraversals() { + return new ResourceTraversal[] {new ResourceTraversal(roots, IResource.DEPTH_INFINITE, IResource.NONE)}; + } + + /** + * Set the traversal of this scope to a single traversal + * of infinite depth on the given resources. + * @param roots the new roots of the scope + */ + public void setRoots(IResource[] roots) { + this.roots = roots; + fireTraversalsChangedEvent(getTraversals(), getMappings()); + } + + public ResourceMapping[] getInputMappings() { + return getMappings(); + } + + public ISynchronizationScope asInputScope() { + return this; + } + + public ResourceMapping[] getMappings() { + List result = new ArrayList(); + for (int i = 0; i < roots.length; i++) { + IResource resource = roots[i]; + Object o = resource.getAdapter(ResourceMapping.class); + if (o instanceof ResourceMapping) { + result.add(o); + } + } + return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]); + } + + public ResourceTraversal[] getTraversals(ResourceMapping mapping) { + Object object = mapping.getModelObject(); + if (object instanceof IResource) { + IResource resource = (IResource) object; + return new ResourceTraversal[] {new ResourceTraversal(new IResource[] { resource }, IResource.DEPTH_INFINITE, IResource.NONE)}; + } + return null; + } + + public boolean hasAdditionalMappings() { + return false; + } + + public boolean hasAdditonalResources() { + return false; + } + +} 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 a8449e11c..35ce109a0 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 @@ -29,7 +29,7 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler { private ResourceDiffTree tree; private SubscriberDiffCollector collector; - private IResourceMappingScopeManager manager; + private ISynchronizationScopeManager manager; private Object family; /* @@ -84,7 +84,7 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler { * @param scope the scope of the handler * @param tree the tree to be populated by this handler */ - public SubscriberDiffTreeEventHandler(Subscriber subscriber, IResourceMappingScopeManager manager, ResourceDiffTree tree) { + public SubscriberDiffTreeEventHandler(Subscriber subscriber, ISynchronizationScopeManager manager, ResourceDiffTree tree) { super(subscriber, manager.getScope()); this.manager = manager; this.tree = tree; diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java index dc69b0e0b..0332f0b06 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java @@ -15,6 +15,7 @@ import java.util.List; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.resources.mapping.ResourceMapping; import org.eclipse.core.resources.mapping.ResourceTraversal; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.IJobChangeEvent; @@ -22,7 +23,8 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.osgi.util.NLS; import org.eclipse.team.core.ITeamStatus; import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.mapping.*; +import org.eclipse.team.core.mapping.ISynchronizationScope; +import org.eclipse.team.core.mapping.ISynchronizationScopeChangeListener; import org.eclipse.team.core.subscribers.Subscriber; import org.eclipse.team.internal.core.*; @@ -48,7 +50,7 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler { private final Subscriber subscriber; private ISynchronizationScope scope; - private IPropertyChangeListener scopeChangeListener; + private ISynchronizationScopeChangeListener scopeChangeListener; /** * Internal resource synchronization event. Can contain a result. @@ -114,14 +116,14 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler { NLS.bind(Messages.SubscriberEventHandler_errors, new String[] { subscriber.getName() })); this.subscriber = subscriber; this.scope = scope; - scopeChangeListener = new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(ISynchronizationScope.TRAVERSALS)) { - reset((ResourceTraversal[])event.getOldValue(), (ResourceTraversal[])event.getNewValue()); - } - } - }; - this.scope.addPropertyChangeListener(scopeChangeListener); + scopeChangeListener = new ISynchronizationScopeChangeListener() { + public void scopeChanged(ISynchronizationScope scope, + ResourceMapping[] newMappings, + ResourceTraversal[] newTraversals) { + reset(new ResourceTraversal[0], scope.getTraversals()); + } + }; + this.scope.addScopeChangeListener(scopeChangeListener); } /** @@ -431,6 +433,6 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler { */ public void shutdown() { super.shutdown(); - scope.removePropertyChangeListener(scopeChangeListener); + scope.removeScopeChangeListener(scopeChangeListener); } } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java index cbb0f0824..bc54c78c2 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java @@ -44,7 +44,7 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler { public static ISynchronizationScope createScope(IResource[] roots, Subscriber subscriber) { if (roots == null) roots = subscriber.roots(); - return new SynchronizationScope(new ResourceTraversal[] {new ResourceTraversal(roots, IResource.DEPTH_INFINITE, IResource.NONE)}); + return new RootResourceSynchronizationScope(roots); } /** @@ -201,7 +201,7 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler { * queued by this method are back-to-back */ public void reset(IResource[] roots) { - SynchronizationScope scope = (SynchronizationScope)getScope(); + RootResourceSynchronizationScope scope = (RootResourceSynchronizationScope)getScope(); if (roots == null) roots = getSubscriber().roots(); scope.setRoots(roots); diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SynchronizationScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SynchronizationScope.java deleted file mode 100644 index da599fbee..000000000 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SynchronizationScope.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.core.subscribers; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.mapping.ResourceTraversal; - -/** - * A synchronization scope for a set of resources. - * - */ -public class SynchronizationScope extends AbstractSynchronizationScope { - - private ResourceTraversal[] traversals; - - public SynchronizationScope(ResourceTraversal[] traversals) { - this.traversals = traversals; - } - - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.ISynchronizationScope#getTraversals() - */ - public ResourceTraversal[] getTraversals() { - return traversals; - } - - /** - * Set the traversal of this scope to a single traversal - * of infinite depth on the given resources. - * @param roots the new roots of the scope - */ - public void setRoots(IResource[] roots) { - setTraversals(new ResourceTraversal[] {new ResourceTraversal(roots, IResource.DEPTH_INFINITE, IResource.NONE)}); - } - - /** - * Set the traversals to the given traversals and notify the - * listeners of the change. - * @param traversals the new traversals that define the scope - */ - protected void setTraversals(ResourceTraversal[] traversals) { - ResourceTraversal[] oldTraversals = this.traversals; - this.traversals = traversals; - fireTraveralsChangedEvent(oldTraversals, traversals); - } - -} |