Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSet.java105
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoTree.java86
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java52
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java48
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSMergeContext.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSMappingMergeOperation.java28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheRemoteContentsOperation.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java6
-rw-r--r--bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/AdditionalMappingsDialog.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DefaultResourceMappingMerger.java16
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IDisposeListener.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IDisposeListener.java)4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/INavigatorContentExtensionFactory.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IResourceMappingContentProvider.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ISynchronizationCache.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ISynchronizeOperationContext.java)19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/NavigatorContentExtension.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingCheckinOperation.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingContentProvider.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingLoadOperation.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingOperationScope.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SimpleResourceMappingOperationInput.java)171
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceNavigatorContentExtensionFactory.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SynchronizationCache.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizeOperationContext.java)17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IMergeContext.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IMergeStatus.java81
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingMerger.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingOperationInput.java110
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingOperationScope.java105
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ISynchronizationContext.java68
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ITeamViewerContext.java67
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ResourceMappingOperationInput.java251
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/TeamViewerContext.java62
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/MergeContext.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeContext.java)53
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/MergeStatus.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeStatus.java)35
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/ResourceMappingMergeOperation.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ResourceMappingMergeOperation.java)18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/ResourceMappingOperation.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ResourceMappingOperation.java)49
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/ResourceMappingOperationScopeBuilder.java258
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/SynchronizationContext.java93
41 files changed, 1074 insertions, 878 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSet.java
new file mode 100644
index 000000000..507cb5834
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoSet.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.core.synchronize;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IResource;
+
+/**
+ * A dynamic collection of {@link SyncInfo} objects that provides
+ * change notification to registered listeners. Batching of change notifications
+ * can be accomplished using the <code>beginInput/endInput</code> methods.
+ * <p>
+ * This interface is not intended to be implemented by clients. Clients
+ * that need an instance of a set can use either a {@link SyncInfoSet} or
+ * {@link SyncInfoTree}
+ *
+ * <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 SyncInfoSet
+ * @see SyncInfoTree
+ *
+ * @since 3.2
+ */
+public interface ISyncInfoSet {
+
+ /**
+ * Return an array of <code>SyncInfo</code> for all out-of-sync resources that are contained by the set.
+ *
+ * @return an array of <code>SyncInfo</code>
+ */
+ public SyncInfo[] getSyncInfos();
+
+ /**
+ * Return all out-of-sync resources contained in this set. The default implementation
+ * uses <code>getSyncInfos()</code> to determine the resources contained in the set.
+ * Subclasses may override to optimize.
+ *
+ * @return all out-of-sync resources contained in the set
+ */
+ public IResource[] getResources();
+
+ /**
+ * Return the <code>SyncInfo</code> for the given resource or <code>null</code>
+ * if the resource is not contained in the set.
+ *
+ * @param resource the resource
+ * @return the <code>SyncInfo</code> for the resource or <code>null</code> if
+ * the resource is in-sync or doesn't have synchronization information in this set.
+ */
+ public SyncInfo getSyncInfo(IResource resource);
+
+ /**
+ * Return the number of out-of-sync resources contained in this set.
+ *
+ * @return the size of the set.
+ * @see #countFor(int, int)
+ */
+ public int size();
+
+ /**
+ * Return whether the set is empty.
+ *
+ * @return <code>true</code> if the set is empty
+ */
+ public boolean isEmpty();
+
+ /**
+ * Return an iterator over all <code>SyncInfo</code>
+ * contained in this set.
+ * @return an iterator over all <code>SyncInfo</code>
+ * contained in this set.
+ */
+ public Iterator iterator();
+
+ /**
+ * Registers the given listener for sync info set notifications. Has
+ * no effect if an identical listener is already registered.
+ *
+ * @param listener listener to register
+ */
+ public void addSyncSetChangedListener(ISyncInfoSetChangeListener listener);
+
+ /**
+ * Removes the given listener from participant notifications. Has
+ * no effect if listener is not already registered.
+ *
+ * @param listener listener to remove
+ */
+ public void removeSyncSetChangedListener(ISyncInfoSetChangeListener listener);
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoTree.java
new file mode 100644
index 000000000..35c1b8ce1
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/ISyncInfoTree.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.core.synchronize;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.mapping.ResourceTraversal;
+
+/**
+ * Provides addition API for accessing the <code>SyncInfo</code> in the set through
+ * their resource's hierarchical relationships.
+ * <p>
+ * Events fired from a <code>ISyncInfoTree</code> will be instances of <code>ISyncInfoTreeChangeEvent</code>.
+ * </p>
+ * <p>
+ * This interface is not intended to be implemented by clients. Clients
+ * that need an instance of a set can use {@link SyncInfoTree}
+ *
+ * <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 SyncInfoTree
+ * @since 3.2
+ */
+public interface ISyncInfoTree extends ISyncInfoSet {
+
+ /**
+ * Return whether the given resource has any children in the sync set. The children
+ * could be either out-of-sync resources that are contained by the set or containers
+ * that are ancestors of out-of-sync resources contained by the set.
+ *
+ * @param resource the resource to check for children.
+ * @return <code>true</code> if the resource has children in the set.
+ */
+ public boolean hasMembers(IResource resource);
+
+ /**
+ * Return the <code>SyncInfo</code> for each out-of-sync resource in the subtree rooted at the given resource
+ * to the depth specified. The depth is one of:
+ * <ul>
+ * <li><code>IResource.DEPTH_ZERO</code>: the resource only,
+ * <li><code>IResource.DEPTH_ONE</code>: the resource or its direct children,
+ * <li><code>IResource.DEPTH_INFINITE</code>: the resource and all of it's descendants.
+ * <ul>
+ * If the given resource is out of sync, it will be included in the result.
+ * <p>
+ * The default implementation makes use of <code>getSyncInfo(IResource)</code>,
+ * <code>members(IResource)</code> and <code>getSyncInfos()</code>
+ * to provide the varying depths. Subclasses may override to optimize.
+ * </p>
+ * @param resource the root of the resource subtree
+ * @param depth the depth of the subtree
+ * @return the <code>SyncInfo</code> for any out-of-sync resources
+ */
+ public SyncInfo[] getSyncInfos(IResource resource, int depth);
+
+ /**
+ * Return the immediate children of the given resource who are either out-of-sync
+ * or contain out-of-sync resources.
+ *
+ * @param resource the parent resource
+ * @return the children of the resource that are either out-of-sync or are ancestors of
+ * out-of-sync resources contained in the set
+ */
+ public IResource[] members(IResource resource);
+
+ /**
+ * Return the sync info contained in this set that are contained
+ * in the given traversals.
+ * @param traversals the traversals
+ * @return the sync info contained in this set that are contained
+ * in the given traversals
+ */
+ public SyncInfo[] getSyncInfos(ResourceTraversal[] traversals);
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
index fb37f07cb..7cd5053ac 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
@@ -33,7 +33,7 @@ import org.eclipse.team.internal.core.subscribers.SyncSetChangedEvent;
* @see ISyncInfoSetChangeListener
* @since 3.0
*/
-public class SyncInfoSet {
+public class SyncInfoSet implements ISyncInfoSet {
// fields used to hold resources of interest
// {IPath -> SyncInfo}
private Map resources = Collections.synchronizedMap(new HashMap());
@@ -66,21 +66,15 @@ public class SyncInfoSet {
}
}
- /**
- * Return an array of <code>SyncInfo</code> for all out-of-sync resources that are contained by the set.
- *
- * @return an array of <code>SyncInfo</code>
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoSet#getSyncInfos()
*/
public synchronized SyncInfo[] getSyncInfos() {
return (SyncInfo[]) resources.values().toArray(new SyncInfo[resources.size()]);
}
- /**
- * Return all out-of-sync resources contained in this set. The default implementation
- * uses <code>getSyncInfos()</code> to determine the resources contained in the set.
- * Subclasses may override to optimize.
- *
- * @return all out-of-sync resources contained in the set
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoSet#getResources()
*/
public IResource[] getResources() {
SyncInfo[] infos = getSyncInfos();
@@ -92,23 +86,15 @@ public class SyncInfoSet {
return (IResource[]) resources.toArray(new IResource[resources.size()]);
}
- /**
- * Return the <code>SyncInfo</code> for the given resource or <code>null</code>
- * if the resource is not contained in the set.
- *
- * @param resource the resource
- * @return the <code>SyncInfo</code> for the resource or <code>null</code> if
- * the resource is in-sync or doesn't have synchronization information in this set.
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoSet#getSyncInfo(org.eclipse.core.resources.IResource)
*/
public synchronized SyncInfo getSyncInfo(IResource resource) {
return (SyncInfo)resources.get(resource.getFullPath());
}
- /**
- * Return the number of out-of-sync resources contained in this set.
- *
- * @return the size of the set.
- * @see #countFor(int, int)
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoSet#size()
*/
public synchronized int size() {
return resources.size();
@@ -142,10 +128,8 @@ public class SyncInfoSet {
return countFor(SyncInfo.CONFLICTING, SyncInfo.DIRECTION_MASK) > 0;
}
- /**
- * Return whether the set is empty.
- *
- * @return <code>true</code> if the set is empty
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoSet#isEmpty()
*/
public synchronized boolean isEmpty() {
return resources.isEmpty();
@@ -185,11 +169,8 @@ public class SyncInfoSet {
return info;
}
- /**
- * Registers the given listener for sync info set notifications. Has
- * no effect if an identical listener is already registered.
- *
- * @param listener listener to register
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoSet#addSyncSetChangedListener(org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener)
*/
public void addSyncSetChangedListener(ISyncInfoSetChangeListener listener) {
synchronized(listeners) {
@@ -197,11 +178,8 @@ public class SyncInfoSet {
}
}
- /**
- * Removes the given listener from participant notifications. Has
- * no effect if listener is not already registered.
- *
- * @param listener listener to remove
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoSet#removeSyncSetChangedListener(org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener)
*/
public void removeSyncSetChangedListener(ISyncInfoSetChangeListener listener) {
synchronized(listeners) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java
index 7e4ed3c28..13d5e91b3 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java
@@ -29,7 +29,7 @@ import org.eclipse.team.internal.core.subscribers.SyncSetChangedEvent;
* @see SyncInfoSet
* @since 3.0
*/
-public class SyncInfoTree extends SyncInfoSet {
+public class SyncInfoTree extends SyncInfoSet implements ISyncInfoTree {
protected Map parents = Collections.synchronizedMap(new HashMap());
@@ -54,13 +54,8 @@ public class SyncInfoTree extends SyncInfoSet {
}
}
- /**
- * Return whether the given resource has any children in the sync set. The children
- * could be either out-of-sync resources that are contained by the set or containers
- * that are ancestors of out-of-sync resources contained by the set.
- *
- * @param resource the resource to check for children.
- * @return <code>true</code> if the resource has children in the set.
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoTree#hasMembers(org.eclipse.core.resources.IResource)
*/
public synchronized boolean hasMembers(IResource resource) {
if (resource.getType() == IResource.FILE) return false;
@@ -71,23 +66,8 @@ public class SyncInfoTree extends SyncInfoSet {
return (allDescendants != null && !allDescendants.isEmpty());
}
- /**
- * Return the <code>SyncInfo</code> for each out-of-sync resource in the subtree rooted at the given resource
- * to the depth specified. The depth is one of:
- * <ul>
- * <li><code>IResource.DEPTH_ZERO</code>: the resource only,
- * <li><code>IResource.DEPTH_ONE</code>: the resource or its direct children,
- * <li><code>IResource.DEPTH_INFINITE</code>: the resource and all of it's descendants.
- * <ul>
- * If the given resource is out of sync, it will be included in the result.
- * <p>
- * The default implementation makes use of <code>getSyncInfo(IResource)</code>,
- * <code>members(IResource)</code> and <code>getSyncInfos()</code>
- * to provide the varying depths. Subclasses may override to optimize.
- * </p>
- * @param resource the root of the resource subtree
- * @param depth the depth of the subtree
- * @return the <code>SyncInfo</code> for any out-of-sync resources
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoTree#getSyncInfos(org.eclipse.core.resources.IResource, int)
*/
public synchronized SyncInfo[] getSyncInfos(IResource resource, int depth) {
if (depth == IResource.DEPTH_ZERO || resource.getType() == IResource.FILE) {
@@ -318,13 +298,8 @@ public class SyncInfoTree extends SyncInfoSet {
return (IResource[]) children.toArray(new IResource[children.size()]);
}
- /**
- * Return the immediate children of the given resource who are either out-of-sync
- * or contain out-of-sync resources.
- *
- * @param resource the parent resource
- * @return the children of the resource that are either out-of-sync or are ancestors of
- * out-of-sync resources contained in the set
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoTree#members(org.eclipse.core.resources.IResource)
*/
public synchronized IResource[] members(IResource resource) {
if (resource.getType() == IResource.FILE) return new IResource[0];
@@ -356,13 +331,8 @@ public class SyncInfoTree extends SyncInfoSet {
return (IResource[]) children.toArray(new IResource[children.size()]);
}
- /**
- * Return the sync info contained in this set that are contained
- * in the given traversals.
- * @param traversals the traversals
- * @return the sync info contained in this set that are contained
- * in the given traversals
- * @since 3.2
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.ISyncInfoTree#getSyncInfos(org.eclipse.core.resources.mapping.ResourceTraversal[])
*/
public SyncInfo[] getSyncInfos(ResourceTraversal[] traversals) {
SyncInfoSet set = new SyncInfoSet();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSMergeContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSMergeContext.java
index b5cec8d68..5f6acb376 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSMergeContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSMergeContext.java
@@ -21,20 +21,26 @@ import org.eclipse.team.internal.ccvs.core.CVSSyncInfo;
import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
import org.eclipse.team.internal.ui.mapping.ResourceMappingScope;
import org.eclipse.team.ui.mapping.*;
+import org.eclipse.team.ui.operations.MergeContext;
import org.eclipse.team.ui.synchronize.ISynchronizeScope;
public class CVSMergeContext extends MergeContext {
private WorkspaceSynchronizeParticipant participant;
- public static IMergeContext createContext(IResourceMappingOperationInput input, IProgressMonitor monitor) {
- WorkspaceSynchronizeParticipant participant = new WorkspaceSynchronizeParticipant(input.asSynchronizationScope());
+ public static IMergeContext createContext(IResourceMappingOperationScope input, IProgressMonitor monitor) {
+ WorkspaceSynchronizeParticipant participant = new WorkspaceSynchronizeParticipant(asSynchronizationScope(input));
participant.refreshNow(participant.getResources(), NLS.bind("Preparing to merge {0}", new String[] { "TODO: mapping description for CVS merge context initialization" }), monitor);
return new CVSMergeContext(THREE_WAY, participant, input);
}
- protected CVSMergeContext(String type, WorkspaceSynchronizeParticipant participant, IResourceMappingOperationInput input) {
- super(type, participant.getSyncInfoSet(), input);
+ private static ISynchronizeScope asSynchronizationScope(IResourceMappingOperationScope input) {
+ // TODO Temporary implementation
+ return new ResourceMappingScope("TODO: Need appropriate labels", input.getMappings(), input.getTraversals());
+ }
+
+ protected CVSMergeContext(String type, WorkspaceSynchronizeParticipant participant, IResourceMappingOperationScope input) {
+ super(input, type, participant.getSyncInfoSet());
this.participant = participant;
}
@@ -61,12 +67,9 @@ public class CVSMergeContext extends MergeContext {
}
public void refresh(ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException {
- IResource[] resources = new ResourceMappingScope("", getResourceMappings(ALL_MAPPINGS), traversals).getRoots();
+ // TODO: Shouldn't need to use a scope here
+ IResource[] resources = new ResourceMappingScope("", getScope().getMappings(), traversals).getRoots();
participant.refreshNow(resources, "TODO: CVS Merge Context Refresh", monitor);
}
- public ISynchronizeScope getScope() {
- return (ResourceMappingScope)participant.getScope();
- }
-
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java
index 19ce0f030..c77c934ef 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java
@@ -14,6 +14,7 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
@@ -46,7 +47,7 @@ public class UpdateSilentAction extends WorkspaceTraversalAction {
//regular update action
IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
if (store.getBoolean(ICVSUIConstants.PREF_ENABLEMODELUPDATE)){
- new CVSMappingMergeOperation(getTargetPart(),getOperationInput()).run();
+ new CVSMappingMergeOperation(getTargetPart(), getSelectedResourceMappings(CVSProviderPlugin.getTypeId()), getResourceMappingContext()).run();
} else {
new UpdateOperation(getTargetPart(), getCVSResourceMappings(), Command.NO_LOCAL_OPTIONS, null /* no tag */).run();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
index 9e4601ed2..15d0f8672 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
@@ -24,8 +24,8 @@ import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.core.subscribers.SubscriberResourceMappingContext;
import org.eclipse.team.internal.ui.dialogs.AdditionalMappingsDialog;
-import org.eclipse.team.internal.ui.mapping.SimpleResourceMappingOperationInput;
-import org.eclipse.team.ui.mapping.*;
+import org.eclipse.team.ui.mapping.IResourceMappingOperationScope;
+import org.eclipse.team.ui.operations.ResourceMappingOperationScopeBuilder;
import org.eclipse.ui.PlatformUI;
@@ -46,10 +46,9 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction {
protected ResourceMapping[] getCVSResourceMappings() {
ResourceMapping[] selectedMappings = getSelectedResourceMappings(CVSProviderPlugin.getTypeId());
try {
- IResourceMappingOperationInput input = getOperationInput();
- input.buildInput(new NullProgressMonitor());
- if (input.hasAdditionalMappings()) {
- return showAllMappings(input);
+ IResourceMappingOperationScope scope = new ResourceMappingOperationScopeBuilder().buildScope(selectedMappings, getResourceMappingContext(), new NullProgressMonitor());
+ if (scope.hasAdditionalMappings()) {
+ return showAllMappings(scope);
}
} catch (CoreException e) {
CVSUIPlugin.log(e);
@@ -57,11 +56,11 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction {
return selectedMappings;
}
- private ResourceMapping[] showAllMappings(final IResourceMappingOperationInput input) {
+ private ResourceMapping[] showAllMappings(final IResourceMappingOperationScope scope) {
final boolean[] canceled = new boolean[] { false };
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
- AdditionalMappingsDialog dialog = new AdditionalMappingsDialog(getShell(), "Participating Elements", input);
+ AdditionalMappingsDialog dialog = new AdditionalMappingsDialog(getShell(), "Participating Elements", scope);
int result = dialog.open();
canceled[0] = result != Dialog.OK;
}
@@ -71,7 +70,7 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction {
if (canceled[0]) {
return new ResourceMapping[0];
}
- return input.getInputMappings();
+ return scope.getMappings();
}
protected static IResource[] getRootTraversalResources(ResourceMapping[] mappings, ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
@@ -105,10 +104,6 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction {
return SubscriberResourceMappingContext.getCompareContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
}
- protected SimpleResourceMappingOperationInput getOperationInput() {
- return new ResourceMappingOperationInput(getSelectedResourceMappings(CVSProviderPlugin.getTypeId()), getResourceMappingContext());
- }
-
public static IResource[] getResourcesToCompare(final ResourceMapping[] mappings, final Subscriber subscriber) throws InvocationTargetException {
// Determine what resources need to be synchronized.
// Use a resource mapping context to include any relevant remote resources
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSMappingMergeOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSMappingMergeOperation.java
index ae4ff71f3..d03447df8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSMappingMergeOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSMappingMergeOperation.java
@@ -12,7 +12,7 @@ package org.eclipse.team.internal.ccvs.ui.mappings;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.resources.mapping.ModelProvider;
+import org.eclipse.core.resources.mapping.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
@@ -25,30 +25,31 @@ import org.eclipse.team.internal.ccvs.ui.operations.CacheBaseContentsOperation;
import org.eclipse.team.internal.ccvs.ui.operations.CacheRemoteContentsOperation;
import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.mapping.ResourceMappingScope;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.mapping.*;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.ResourceScope;
+import org.eclipse.team.ui.mapping.IMergeContext;
+import org.eclipse.team.ui.operations.ResourceMappingMergeOperation;
+import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.IWorkbenchPart;
public class CVSMappingMergeOperation extends ResourceMappingMergeOperation {
protected static final String UPDATE_CLIENT_MERGE_INFO = "update_client_merge_info_prompt"; //$NON-NLS-1 //$NON-NLS-1$ //$NON-NLS-1$
- public CVSMappingMergeOperation(IWorkbenchPart part, IResourceMappingOperationInput input) {
- super(part, input);
+ public CVSMappingMergeOperation(IWorkbenchPart part, ResourceMapping[] selectedMappings, ResourceMappingContext context) {
+ super(part, selectedMappings, context);
}
protected IMergeContext buildMergeContext(IProgressMonitor monitor) {
monitor.beginTask(null, 100);
- IMergeContext context = CVSMergeContext.createContext(getInput(), Policy.subMonitorFor(monitor, 50));
+ IMergeContext context = CVSMergeContext.createContext(getScope(), Policy.subMonitorFor(monitor, 50));
// cache the base and remote contents
// TODO: Refreshing and caching now takes 3 round trips.
// OPTIMIZE: remote state and contents could be obtained in 1
// OPTIMIZE: Based could be avoided if we always cached base locally
try {
- new CacheBaseContentsOperation(getPart(), getInput().getInputMappings(), context.getSyncInfoTree(), true).run(Policy.subMonitorFor(monitor, 25));
- new CacheRemoteContentsOperation(getPart(), getInput().getInputMappings(), context.getSyncInfoTree()).run(Policy.subMonitorFor(monitor, 25));
+ new CacheBaseContentsOperation(getPart(), getScope().getMappings(), context.getSyncInfoTree(), true).run(Policy.subMonitorFor(monitor, 25));
+ new CacheRemoteContentsOperation(getPart(), getScope().getMappings(), context.getSyncInfoTree()).run(Policy.subMonitorFor(monitor, 25));
} catch (InvocationTargetException e) {
CVSUIPlugin.log(CVSException.wrapException(e));
} catch (InterruptedException e) {
@@ -61,7 +62,7 @@ public class CVSMappingMergeOperation extends ResourceMappingMergeOperation {
protected void requiresManualMerge(ModelProvider[] providers, IMergeContext context) throws CoreException {
// Sync Action
- ResourceScope scope = new ResourceScope(context.getScope().getRoots()); //create resource scope from here; sync
+ ResourceScope scope = new ResourceScope(getOtherScope().getRoots()); //create resource scope from here; sync
WorkspaceSynchronizeParticipant participant = new WorkspaceSynchronizeParticipant(scope);
TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
@@ -76,6 +77,13 @@ public class CVSMappingMergeOperation extends ResourceMappingMergeOperation {
});
}
}
+
+ /*
+ * TODO This needs to change
+ */
+ public ISynchronizeScope getOtherScope() {
+ return new ResourceMappingScope("", getScope().getMappings(), getScope().getTraversals());
+ }
private void provideInfo() {
getShell().getDisplay().syncExec(new Runnable() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
index 4b0e08ddc..c1bd252cb 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
@@ -14,8 +14,8 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.synchronize.ISyncInfoTree;
import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
@@ -29,7 +29,7 @@ public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
private final boolean includeOutgoing;
- public CacheBaseContentsOperation(IWorkbenchPart part, ResourceMapping[] mappers, SyncInfoTree tree, boolean includeOutgoing) {
+ public CacheBaseContentsOperation(IWorkbenchPart part, ResourceMapping[] mappers, ISyncInfoTree tree, boolean includeOutgoing) {
super(part, mappers, tree);
this.includeOutgoing = includeOutgoing;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheRemoteContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheRemoteContentsOperation.java
index 73a0d0e8c..b1019757c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheRemoteContentsOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheRemoteContentsOperation.java
@@ -14,8 +14,8 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.synchronize.ISyncInfoTree;
import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
@@ -27,7 +27,7 @@ import org.eclipse.ui.IWorkbenchPart;
*/
public class CacheRemoteContentsOperation extends CacheTreeContentsOperation {
- public CacheRemoteContentsOperation(IWorkbenchPart part, ResourceMapping[] mappers, SyncInfoTree tree) {
+ public CacheRemoteContentsOperation(IWorkbenchPart part, ResourceMapping[] mappers, ISyncInfoTree tree) {
super(part, mappers, tree);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
index 89d0c98ff..e46ba3590 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java
@@ -19,8 +19,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.synchronize.ISyncInfoTree;
import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.*;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
@@ -33,9 +33,9 @@ import org.eclipse.ui.IWorkbenchPart;
*/
public abstract class CacheTreeContentsOperation extends SingleCommandOperation {
- private final SyncInfoTree tree;
+ private final ISyncInfoTree tree;
- public CacheTreeContentsOperation(IWorkbenchPart part, ResourceMapping[] mappers, SyncInfoTree tree) {
+ public CacheTreeContentsOperation(IWorkbenchPart part, ResourceMapping[] mappers, ISyncInfoTree tree) {
super(part, mappers, Command.NO_LOCAL_OPTIONS);
this.tree = tree;
}
diff --git a/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF
index 55fb05126..bd6f3e8e8 100644
--- a/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF
@@ -17,6 +17,7 @@ Export-Package: org.eclipse.team.internal.ui;x-friends:="org.eclipse.team.cvs.ss
org.eclipse.team.internal.ui.wizards;x-friends:="org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui",
org.eclipse.team.ui,
org.eclipse.team.ui.mapping,
+ org.eclipse.team.ui.operations,
org.eclipse.team.ui.synchronize
Require-Bundle: org.eclipse.ui.ide;resolution:=optional,
org.eclipse.core.resources,
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/AdditionalMappingsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/AdditionalMappingsDialog.java
index 69300005f..074dc5ff4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/AdditionalMappingsDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/AdditionalMappingsDialog.java
@@ -13,16 +13,15 @@ package org.eclipse.team.internal.ui.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
-import org.eclipse.team.ui.mapping.IResourceMappingOperationInput;
-import org.eclipse.team.ui.mapping.TeamViewerContext;
+import org.eclipse.team.ui.mapping.IResourceMappingOperationScope;
public class AdditionalMappingsDialog extends DetailsDialog {
private ResourceMappingSelectionArea selectedMappingsArea;
private ResourceMappingHierarchyArea allMappingsArea;
- private final IResourceMappingOperationInput input;
+ private final IResourceMappingOperationScope input;
- public AdditionalMappingsDialog(Shell parentShell, String dialogTitle, IResourceMappingOperationInput input) {
+ public AdditionalMappingsDialog(Shell parentShell, String dialogTitle, IResourceMappingOperationScope input) {
super(parentShell, dialogTitle);
this.input = input;
}
@@ -38,7 +37,7 @@ public class AdditionalMappingsDialog extends DetailsDialog {
*/
private void createSelectedMappingsArea(Composite parent) {
Composite composite = createComposite(parent);
- selectedMappingsArea = new ResourceMappingSelectionArea(input.getSeedMappings(), false, false);
+ selectedMappingsArea = new ResourceMappingSelectionArea(input.getInputMappings(), false, false);
selectedMappingsArea.setDescription("Selected Elements");
//selectedMappingsArea.addPropertyChangeListener(this);
selectedMappingsArea.createArea(composite);
@@ -52,7 +51,7 @@ public class AdditionalMappingsDialog extends DetailsDialog {
*/
private void createAllMappingsArea(Composite parent) {
Composite composite = createComposite(parent);
- allMappingsArea = ResourceMappingHierarchyArea.create(new TeamViewerContext(input));
+ allMappingsArea = ResourceMappingHierarchyArea.create(input, null);
allMappingsArea.setDescription("All elements to be operated on");
//allMappingsArea.addPropertyChangeListener(this);
allMappingsArea.createArea(composite);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java
index 61f3ca4cb..1ea5237ec 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/ResourceMappingHierarchyArea.java
@@ -209,18 +209,18 @@ public class ResourceMappingHierarchyArea extends DialogArea {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.mapping.IResourceMappingContentProvider#init(org.eclipse.team.ui.mapping.ITeamViewerContext)
*/
- public void init(ITeamViewerContext context) {
+ public void init(IResourceMappingOperationScope input, ISynchronizationContext context) {
for (Iterator iter = providers.values().iterator(); iter.hasNext();) {
NavigatorContentExtension extension = (NavigatorContentExtension) iter.next();
IResourceMappingContentProvider provider = extension.getContentProvider();
- provider.init(extension.getContext());
+ provider.init(input, context);
}
}
}
- public static ResourceMappingHierarchyArea create(ITeamViewerContext context) {
- ModelProvider[] providers = context.getModelProviders();
+ public static ResourceMappingHierarchyArea create(IResourceMappingOperationScope input, ISynchronizationContext context) {
+ ModelProvider[] providers = input.getModelProviders();
Map extensions = new HashMap();
for (int i = 0; i < providers.length; i++) {
ModelProvider provider = providers[i];
@@ -236,12 +236,12 @@ public class ResourceMappingHierarchyArea extends DialogArea {
}
}
if (factory != null) {
- NavigatorContentExtension extension = factory.createProvider(provider, context);
+ NavigatorContentExtension extension = factory.createProvider(provider);
extensions.put(provider, extension);
}
}
CompositeContentProvider provider = new CompositeContentProvider(extensions);
- provider.init(context);
+ provider.init(input, context);
return new ResourceMappingHierarchyArea(provider);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DefaultResourceMappingMerger.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DefaultResourceMappingMerger.java
index 7053f39a8..f72d20573 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DefaultResourceMappingMerger.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/DefaultResourceMappingMerger.java
@@ -19,10 +19,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.ui.mapping.IMergeContext;
-import org.eclipse.team.ui.mapping.IResourceMappingMerger;
-import org.eclipse.team.ui.mapping.IResourceMappingOperationInput;
-import org.eclipse.team.ui.mapping.MergeStatus;
+import org.eclipse.team.ui.mapping.*;
+import org.eclipse.team.ui.operations.MergeStatus;
/**
* A default merger that delegates the merge to the merge context.
@@ -30,9 +28,9 @@ import org.eclipse.team.ui.mapping.MergeStatus;
public class DefaultResourceMappingMerger implements IResourceMappingMerger {
private final ModelProvider provider;
- private final IResourceMappingOperationInput input;
+ private final IResourceMappingOperationScope input;
- public DefaultResourceMappingMerger(ModelProvider provider, IResourceMappingOperationInput input) {
+ public DefaultResourceMappingMerger(ModelProvider provider, IResourceMappingOperationScope input) {
this.provider = provider;
this.input = input;
}
@@ -49,7 +47,7 @@ public class DefaultResourceMappingMerger implements IResourceMappingMerger {
}
private SyncInfoTree getSetToMerge(IMergeContext mergeContext) {
- ResourceMapping[] mappings = input.getResourceMappings(provider.getDescriptor().getId());
+ ResourceMapping[] mappings = input.getMappings(provider.getDescriptor().getId());
SyncInfoTree result = new SyncInfoTree();
for (int i = 0; i < mappings.length; i++) {
ResourceMapping mapping = mappings[i];
@@ -64,9 +62,9 @@ public class DefaultResourceMappingMerger implements IResourceMappingMerger {
}
private IStatus covertFilesToMappings(IStatus status, IMergeContext mergeContext) {
- if (status.getCode() == MergeStatus.CONFLICTS) {
+ if (status.getCode() == IMergeStatus.CONFLICTS) {
// In general, we can't say which mapping failed so return them all
- return new MergeStatus(status.getPlugin(), status.getMessage(), input.getResourceMappings(provider.getDescriptor().getId()));
+ return new MergeStatus(status.getPlugin(), status.getMessage(), input.getMappings(provider.getDescriptor().getId()));
}
return status;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IDisposeListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IDisposeListener.java
index 261b023c5..9b8e3fd68 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IDisposeListener.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IDisposeListener.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.mapping;
+package org.eclipse.team.internal.ui.mapping;
/**
* Listener that, when registered with a synchronization context, gets invoked
@@ -28,5 +28,5 @@ public interface IDisposeListener {
/**
* The given context has been disposed.
*/
- void contextDisposed(ISynchronizeOperationContext context);
+ void contextDisposed(ISynchronizationCache context);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/INavigatorContentExtensionFactory.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/INavigatorContentExtensionFactory.java
index 2ab75c715..0e500499e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/INavigatorContentExtensionFactory.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/INavigatorContentExtensionFactory.java
@@ -12,7 +12,6 @@ package org.eclipse.team.internal.ui.mapping;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.team.ui.mapping.ITeamViewerContext;
/**
* Factory for creating a NavigatorContentProvider for
@@ -29,7 +28,7 @@ import org.eclipse.team.ui.mapping.ITeamViewerContext;
*/
public interface INavigatorContentExtensionFactory {
- public NavigatorContentExtension createProvider(ModelProvider provider, ITeamViewerContext context);
+ public NavigatorContentExtension createProvider(ModelProvider provider);
/**
* TODO: Should not need this but I added it to make it work
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IResourceMappingContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IResourceMappingContentProvider.java
index 10d6ccff0..f1a15df43 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IResourceMappingContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IResourceMappingContentProvider.java
@@ -11,7 +11,8 @@
package org.eclipse.team.internal.ui.mapping;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.team.ui.mapping.ITeamViewerContext;
+import org.eclipse.team.ui.mapping.IResourceMappingOperationScope;
+import org.eclipse.team.ui.mapping.ISynchronizationContext;
/**
* A model content provider is a tree content provider that is used to display
@@ -29,5 +30,5 @@ public interface IResourceMappingContentProvider extends ITreeContentProvider {
* methods of this content provider is invoked.
* @param context a team context
*/
- public void init(ITeamViewerContext context);
+ public void init(IResourceMappingOperationScope input, ISynchronizationContext context);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ISynchronizeOperationContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ISynchronizationCache.java
index dbe6cd6ca..1947ae5f5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ISynchronizeOperationContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ISynchronizationCache.java
@@ -8,17 +8,19 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.mapping;
+package org.eclipse.team.internal.ui.mapping;
/**
- * A synchronization context that allows clients to cache operation
- * state for the duration of the operation. When the context is disposed,
- * the cache will be cleared.
+ * A cache that is associated with a synchronization operation that allows
+ * clients to cache synchronization state related to their model for the
+ * duration of the operation. When the context is disposed, the cache will be
+ * disposed and any listeners notified.
* <p>
- * This interface is not intended to be implemented by clients. Clients
- * should instead subclass <@link org.eclipse.team.ui.mapping.SynchronizeOperationContext}
+ * This interface is not intended to be implemented by clients. Clients should
+ * instead subclass <@link
+ * org.eclipse.team.ui.mapping.SynchronizeOperationContext}
*
- * @see org.eclipse.team.ui.mapping.SynchronizeOperationContext
+ * @see org.eclipse.team.internal.ui.mapping.SynchronizationCache
*
* <p>
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as
@@ -29,7 +31,7 @@ package org.eclipse.team.ui.mapping;
*
* @since 3.2
*/
-public interface ISynchronizeOperationContext extends ISynchronizationContext {
+public interface ISynchronizationCache {
/**
* Cache the given property with this context.
@@ -65,4 +67,5 @@ public interface ISynchronizeOperationContext extends ISynchronizationContext {
* @param listener the listener to remove
*/
void removeDisposeListener(IDisposeListener listener);
+
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/NavigatorContentExtension.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/NavigatorContentExtension.java
index 3ff6b71f8..7490c6e38 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/NavigatorContentExtension.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/NavigatorContentExtension.java
@@ -12,7 +12,6 @@ package org.eclipse.team.internal.ui.mapping;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.team.ui.mapping.ITeamViewerContext;
/**
* Placeholder for Common Navigator extension
@@ -30,12 +29,10 @@ import org.eclipse.team.ui.mapping.ITeamViewerContext;
public abstract class NavigatorContentExtension {
private static final ResourceMappingLabelProvider RESOURCE_MAPPING_LABEL_PROVIDER = new ResourceMappingLabelProvider();
- private final ITeamViewerContext context;
private final ModelProvider provider;
- public NavigatorContentExtension(ModelProvider provider, ITeamViewerContext context) {
+ public NavigatorContentExtension(ModelProvider provider) {
this.provider = provider;
- this.context = context;
}
/**
@@ -64,10 +61,6 @@ public abstract class NavigatorContentExtension {
return RESOURCE_MAPPING_LABEL_PROVIDER;
}
- public ITeamViewerContext getContext() {
- return context;
- }
-
public void dispose() {
// TODO Auto-generated method stub
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingCheckinOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingCheckinOperation.java
index a07cc4f2d..327d59389 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingCheckinOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingCheckinOperation.java
@@ -12,9 +12,10 @@ package org.eclipse.team.internal.ui.mapping;
import java.lang.reflect.InvocationTargetException;
+import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.resources.mapping.ResourceMappingContext;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.ui.mapping.IResourceMappingOperationInput;
-import org.eclipse.team.ui.mapping.ResourceMappingOperation;
+import org.eclipse.team.ui.operations.ResourceMappingOperation;
import org.eclipse.ui.IWorkbenchPart;
/**
@@ -83,8 +84,8 @@ import org.eclipse.ui.IWorkbenchPart;
*/
public abstract class ResourceMappingCheckinOperation extends ResourceMappingOperation {
- protected ResourceMappingCheckinOperation(IWorkbenchPart part, IResourceMappingOperationInput input) {
- super(part, input);
+ protected ResourceMappingCheckinOperation(IWorkbenchPart part, ResourceMapping[] selectedMappings, ResourceMappingContext context) {
+ super(part, selectedMappings, context);
}
protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingContentProvider.java
index 2049ab59e..cccc9318a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingContentProvider.java
@@ -20,7 +20,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.ui.mapping.ITeamViewerContext;
+import org.eclipse.team.ui.mapping.*;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.model.WorkbenchAdapter;
@@ -37,8 +37,9 @@ import org.eclipse.ui.model.WorkbenchAdapter;
*/
public class ResourceMappingContentProvider implements IResourceMappingContentProvider {
- private ITeamViewerContext context;
+ private ISynchronizationContext context;
private final ModelProvider provider;
+ private IResourceMappingOperationScope input;
public class ResourceAndDepth extends WorkbenchAdapter implements IAdaptable {
Object parent;
@@ -96,8 +97,7 @@ public class ResourceMappingContentProvider implements IResourceMappingContentPr
}
}
- public ResourceMappingContentProvider(ITeamViewerContext context, ModelProvider provider) {
- this.context = context;
+ public ResourceMappingContentProvider(ModelProvider provider) {
this.provider = provider;
}
@@ -124,16 +124,16 @@ public class ResourceMappingContentProvider implements IResourceMappingContentPr
private ResourceTraversal[] getTraversals() {
List result = new ArrayList();
- ResourceMapping[] mappings = context.getResourceMappings(provider.getDescriptor().getId());
+ ResourceMapping[] mappings = input.getMappings(provider.getDescriptor().getId());
for (int i = 0; i < mappings.length; i++) {
ResourceMapping mapping = mappings[i];
- ResourceTraversal[] traversals = context.getTraversals(mapping);
+ ResourceTraversal[] traversals = input.getTraversals(mapping);
for (int j = 0; j < traversals.length; j++) {
ResourceTraversal traversal = traversals[j];
result.add(traversal);
}
}
- return SimpleResourceMappingOperationInput.combineTraversals((ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()]));
+ return ResourceMappingOperationScope.combineTraversals((ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()]));
}
public Object getParent(Object element) {
@@ -166,10 +166,8 @@ public class ResourceMappingContentProvider implements IResourceMappingContentPr
// Nothing to do
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.mapping.IResourceMappingContentProvider#init(org.eclipse.team.ui.mapping.ITeamViewerContext)
- */
- public void init(ITeamViewerContext context) {
+ public void init(IResourceMappingOperationScope input, ISynchronizationContext context) {
+ this.input = input;
this.context = context;
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingLoadOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingLoadOperation.java
index cbbe86858..22cb1eb26 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingLoadOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingLoadOperation.java
@@ -12,9 +12,10 @@ package org.eclipse.team.internal.ui.mapping;
import java.lang.reflect.InvocationTargetException;
+import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.resources.mapping.ResourceMappingContext;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.ui.mapping.IResourceMappingOperationInput;
-import org.eclipse.team.ui.mapping.ResourceMappingOperation;
+import org.eclipse.team.ui.operations.ResourceMappingOperation;
import org.eclipse.ui.IWorkbenchPart;
/**
@@ -50,8 +51,8 @@ import org.eclipse.ui.IWorkbenchPart;
*/
public class ResourceMappingLoadOperation extends ResourceMappingOperation {
- protected ResourceMappingLoadOperation(IWorkbenchPart part, IResourceMappingOperationInput input) {
- super(part, input);
+ protected ResourceMappingLoadOperation(IWorkbenchPart part, ResourceMapping[] selectedMappings, ResourceMappingContext context) {
+ super(part, selectedMappings, context);
}
protected void execute(IProgressMonitor monitor)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SimpleResourceMappingOperationInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingOperationScope.java
index aa5a81483..5c3daec63 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SimpleResourceMappingOperationInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceMappingOperationScope.java
@@ -1,9 +1,9 @@
/*******************************************************************************
* 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
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
@@ -14,15 +14,13 @@ import java.util.*;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.ui.mapping.IResourceMappingOperationInput;
-import org.eclipse.team.ui.synchronize.ISynchronizeScope;
+import org.eclipse.team.ui.mapping.IResourceMappingOperationScope;
/**
- * A simple implementation of an operation input that
- * does not transform the input.
+ * Concrete implementation of the {@link IResourceMappingOperationScope}
+ * interface for use by clients.
+ * <p>
+ * This class is not intended to be subclasses by clients
*
* <p>
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as
@@ -31,63 +29,17 @@ import org.eclipse.team.ui.synchronize.ISynchronizeScope;
* consulting with the Platform/Team team.
* </p>
*
+ * @see org.eclipse.core.resources.mapping.ResourceMapping
+ *
* @since 3.2
*/
-public class SimpleResourceMappingOperationInput implements
- IResourceMappingOperationInput {
-
- private ResourceMapping[] mappings;
- private ResourceMappingContext context;
- private Map mappingToTraversalsMap = new HashMap();
+public class ResourceMappingOperationScope implements
+ IResourceMappingOperationScope {
- public SimpleResourceMappingOperationInput(ResourceMapping[] mappings, ResourceMappingContext context) {
- this.mappings = mappings;
- this.context = context;
- }
-
- public ResourceMapping[] getSeedMappings() {
- return mappings;
- }
-
- public void buildInput(IProgressMonitor monitor) throws CoreException {
- buildInputMappingToTraversalsMap(monitor);
- }
-
- public ResourceMapping[] getInputMappings() {
- return mappings;
- }
-
- public ResourceTraversal[] getInputTraversals() {
- Collection values = mappingToTraversalsMap.values();
- List result = new ArrayList();
- for (Iterator iter = values.iterator(); iter.hasNext();) {
- ResourceTraversal[] traversals = (ResourceTraversal[]) iter.next();
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- result.add(traversal);
- }
- }
- return combineTraversals((ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()]));
- }
+ private ResourceMapping[] inputMappings;
+ private final Map mappingsToTraversals = new HashMap();
+ private boolean hasAdditionalMappings;
- public ResourceTraversal[] getTraversals(ResourceMapping mapping) {
- return (ResourceTraversal[])mappingToTraversalsMap.get(mapping);
- }
-
- public boolean hasAdditionalMappings() {
- return false;
- }
-
- private void buildInputMappingToTraversalsMap(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(null, mappings.length * 100);
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
- ResourceTraversal[] traversals = mapping.getTraversals(context, Policy.subMonitorFor(monitor, 100));
- mappingToTraversalsMap.put(mapping, traversals);
- }
- monitor.done();
- }
-
public static ResourceTraversal[] combineTraversals(ResourceTraversal[] allTraversals) {
Set zero = new HashSet();
Set shallow = new HashSet();
@@ -118,10 +70,84 @@ public class SimpleResourceMappingOperationInput implements
}
return (ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()]);
}
+
+ /**
+ * @param selectedMappings
+ */
+ public ResourceMappingOperationScope(ResourceMapping[] selectedMappings) {
+ inputMappings = selectedMappings;
+ }
+
+ /**
+ * Add the mapping and its traversals to the scope. This method should
+ * only be invoked during the scope building process.
+ * @param mapping the mapping being added to the scope
+ * @param traversals the traversals for that mapping
+ */
+ public void addMapping(ResourceMapping mapping, ResourceTraversal[] traversals) {
+ mappingsToTraversals.put(mapping, traversals);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#getInputMappings()
+ */
+ public ResourceMapping[] getInputMappings() {
+ return inputMappings;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#getMappings()
+ */
+ public ResourceMapping[] getMappings() {
+ return (ResourceMapping[]) mappingsToTraversals.keySet().toArray(new ResourceMapping[mappingsToTraversals.size()]);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#getTraversals()
+ */
+ public ResourceTraversal[] getTraversals() {
+ Collection values = mappingsToTraversals.values();
+ List result = new ArrayList();
+ for (Iterator iter = values.iterator(); iter.hasNext();) {
+ ResourceTraversal[] traversals = (ResourceTraversal[]) iter.next();
+ for (int i = 0; i < traversals.length; i++) {
+ ResourceTraversal traversal = traversals[i];
+ result.add(traversal);
+ }
+ }
+ return combineTraversals((ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()]));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#getTraversals(org.eclipse.core.resources.mapping.ResourceMapping)
+ */
+ public ResourceTraversal[] getTraversals(ResourceMapping mapping) {
+ return (ResourceTraversal[])mappingsToTraversals.get(mapping);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#hasAdditionalMappings()
+ */
+ public boolean hasAdditionalMappings() {
+ return hasAdditionalMappings;
+ }
+
+ /**
+ * Set whether the scope has additional mappings to the input mappings.
+ * This method should only be invoked during the scope building process.
+ * @param hasAdditionalMappings whether the scope has additional mappings
+ */
+ public void setHasAdditionalMappings(boolean hasAdditionalMappings) {
+ this.hasAdditionalMappings = hasAdditionalMappings;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#getModelProviders()
+ */
public ModelProvider[] getModelProviders() {
Set result = new HashSet();
- ResourceMapping[] mappings = getInputMappings();
+ ResourceMapping[] mappings = getMappings();
for (int i = 0; i < mappings.length; i++) {
ResourceMapping mapping = mappings[i];
result.add(mapping.getModelProvider());
@@ -129,13 +155,12 @@ public class SimpleResourceMappingOperationInput implements
return (ModelProvider[]) result.toArray(new ModelProvider[result.size()]);
}
- public ResourceMappingContext getContext() {
- return context;
- }
-
- public ResourceMapping[] getResourceMappings(String id) {
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#getMappings(java.lang.String)
+ */
+ public ResourceMapping[] getMappings(String id) {
Set result = new HashSet();
- ResourceMapping[] mappings = getInputMappings();
+ ResourceMapping[] mappings = getMappings();
for (int i = 0; i < mappings.length; i++) {
ResourceMapping mapping = mappings[i];
if (mapping.getModelProviderId().equals(id)) {
@@ -145,9 +170,5 @@ public class SimpleResourceMappingOperationInput implements
return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
}
-
- public ISynchronizeScope asSynchronizationScope() {
- // TODO Temporary implementation
- return new ResourceMappingScope("TODO: Need appropriate labels", getInputMappings(), getInputTraversals());
- }
+
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceNavigatorContentExtensionFactory.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceNavigatorContentExtensionFactory.java
index 74db3ebcd..cf5ab6582 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceNavigatorContentExtensionFactory.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ResourceNavigatorContentExtensionFactory.java
@@ -12,7 +12,6 @@ package org.eclipse.team.internal.ui.mapping;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.team.ui.mapping.ITeamViewerContext;
public class ResourceNavigatorContentExtensionFactory implements
INavigatorContentExtensionFactory {
@@ -23,12 +22,12 @@ public class ResourceNavigatorContentExtensionFactory implements
this.provider = provider;
}
- public NavigatorContentExtension createProvider(final ModelProvider provider, ITeamViewerContext context) {
- return new NavigatorContentExtension(provider, context) {
+ public NavigatorContentExtension createProvider(final ModelProvider provider) {
+ return new NavigatorContentExtension(provider) {
private ResourceMappingContentProvider resourceMappingContentProvider;
public IResourceMappingContentProvider getContentProvider() {
if (resourceMappingContentProvider == null)
- resourceMappingContentProvider = new ResourceMappingContentProvider(getContext(), provider);
+ resourceMappingContentProvider = new ResourceMappingContentProvider(provider);
return resourceMappingContentProvider;
}
public void dispose() {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizeOperationContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SynchronizationCache.java
index 8cf8da7ae..3e9dbc40f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizeOperationContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/SynchronizationCache.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.mapping;
+package org.eclipse.team.internal.ui.mapping;
import java.util.HashMap;
import java.util.Map;
@@ -29,22 +29,21 @@ import org.eclipse.jface.util.SafeRunnable;
* consulting with the Platform/Team team.
* </p>
*
- * @see org.eclipse.team.ui.mapping.ISynchronizeOperationContext
+ * @see org.eclipse.team.internal.ui.mapping.ISynchronizationCache
* @since 3.2
*/
-public abstract class SynchronizeOperationContext extends TeamViewerContext implements ISynchronizeOperationContext {
+public class SynchronizationCache implements ISynchronizationCache {
Map properties;
ListenerList listeners;
/**
- * Create an operation context for the given input.
- * @param input the input of the context
+ * CCreate an empty cache
*/
- public SynchronizeOperationContext(IResourceMappingOperationInput input) {
- super(input);
+ public SynchronizationCache() {
+ // nothing to do
}
-
+
/* (non-Javadoc)
* @see org.eclipse.team.ui.mapping.ISynchronizeOperationContext#addProperty(java.lang.String, java.lang.Object)
*/
@@ -101,7 +100,7 @@ public abstract class SynchronizeOperationContext extends TeamViewerContext impl
final Object listener = allListeners[i];
Platform.run(new SafeRunnable(){
public void run() throws Exception {
- ((IDisposeListener)listener).contextDisposed(SynchronizeOperationContext.this);
+ ((IDisposeListener)listener).contextDisposed(SynchronizationCache.this);
}
});
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IMergeContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IMergeContext.java
index ee3604613..ef2c8ebbe 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IMergeContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IMergeContext.java
@@ -16,13 +16,14 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoSet;
+import org.eclipse.team.ui.operations.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
- * TODO: How are merge/markasMerge changes batched? IWorkspace#run?
+ * 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>
* This interface is not intended to be implemented by clients. Clients should
* instead subclass {@link MergeContext}.
@@ -38,7 +39,7 @@ import org.eclipse.team.core.synchronize.SyncInfoSet;
* @see MergeContext
* @since 3.2
*/
-public interface IMergeContext extends ISynchronizeOperationContext {
+public interface IMergeContext extends ISynchronizationContext {
/**
* Method that allows the model merger to signal that the file in question
@@ -85,7 +86,7 @@ public interface IMergeContext extends ISynchronizeOperationContext {
* Any resource changes triggered by this merge will be reported through the
* resource delta mechanism and the sync-info tree associated with this context.
*
- * TODO: How do we handle folder additions/removals generically?
+ * TODO: How do we handle folder additions/removals generically? (see bug 113898)
*
* @see SyncInfoSet#addSyncSetChangedListener(ISyncInfoSetChangeListener)
* @see org.eclipse.core.resources.IWorkspace#addResourceChangeListener(IResourceChangeListener)
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IMergeStatus.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IMergeStatus.java
new file mode 100644
index 000000000..29ea43bac
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IMergeStatus.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.mapping;
+
+import org.eclipse.compare.IStreamMerger;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.team.ui.operations.MergeStatus;
+
+/**
+ * A special status that is returned when the return code
+ * of the <code>merge</code> method is <code>CONFLICTS</code>.
+ * It is possible that there were problems that caused the
+ * auto-merge to fail. In that case, the implementor of
+ * <code>IResourceMappingMerger</code> can return a multi-status
+ * in which one of the children is a <code>MergeStatus</code> and
+ * the others describe other problems that were encountered.
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * Clients can instead us the {@link MergeStatus} class.
+ *
+ * <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.team.ui.mapping.IResourceMappingMerger
+ * @see MergeStatus
+ *
+ * @since 3.2
+ */
+public interface IMergeStatus extends IStatus {
+
+ /**
+ * Indicates that a change conflict prevented some or all of the resource
+ * mappings to be merged (value <code>1</code>). When this code is
+ * returned, the status must be of type
+ * <code>MergeStatus</code> and must contain the list of all
+ * resource mappings for which a manual merge is required.
+ */
+ public static final int CONFLICTS = IStreamMerger.CONFLICT;
+
+ /**
+ * Status code describing an internal error (value <code>2</code>).
+ * The status return is not required to be of type <code>MergeStatus</code>
+ * for internal errors.
+ */
+ public static final int INTERNAL_ERROR = IStreamMerger.INTERNAL_ERROR;
+
+ /**
+ * Returns the set of resource mappings for which an auto-merge was
+ * not performed. If the code of the status is <code>CONFLICTS</code>
+ * the status may contain a set of mappings or files depending
+ * on what method returned the status.
+ * @return the set of resource mappings for which an auto-merge was
+ * not performed.
+ */
+ public abstract ResourceMapping[] getConflictingMappings();
+
+ /**
+ * Returns the set of file for which an auto-merge was
+ * not performed. If the code of the status is <code>CONFLICTS</code>
+ * the status may contain a set of mappings or files depending
+ * on what method returned the status.
+ * @return the set of files for which an auto-merge was
+ * not performed.
+ */
+ public abstract IFile[] getConflictingFiles();
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingMerger.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingMerger.java
index 4de3e0075..4199b9740 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingMerger.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingMerger.java
@@ -36,7 +36,7 @@ import org.eclipse.core.runtime.*;
* <code>IResourceMappingMerger</code>, clients can obtain the merger
* from the Resources model provider {@link org.eclipse.core.resources.mapping.ResourceModelProvider}
* and use that.
- * TODO: This is OK for now but will need to change
+ * TODO: This is OK for now but will need to change (see bug 113901)
*
* @see org.eclipse.compare.IStreamMerger
* @see org.eclipse.core.resources.mapping.ResourceMapping
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingOperationInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingOperationInput.java
deleted file mode 100644
index 3908a9888..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingOperationInput.java
+++ /dev/null
@@ -1,110 +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.ui.mapping;
-
-import org.eclipse.core.resources.mapping.ModelProvider;
-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.ui.synchronize.ISynchronizeScope;
-
-/**
- * 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>
- * <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
- *
- * @since 3.2
- */
-public interface IResourceMappingOperationInput {
-
- /**
- * Return the set of mappings that were selected
- * when the operation was launched. These mappings
- * are used to seed the input determination process.
- * @return the set of mappings that were selected
- * when the operation was launched
- */
- public ResourceMapping[] getSeedMappings();
-
- /**
- * Calculate the set of mappings to be operated on.
- * This method must be called before <code>getInputMappings</code>
- * or <code>getInputTraversals</code>.
- *
- * @param monitor a progress monitor
- * @throws CoreException
- */
- public void buildInput(IProgressMonitor monitor) throws CoreException;
-
- /**
- * Return the complete set of mappings to be operated on.
- * This method should only be invoked after <code>buildInput</code>
- * is called.
- * @return the complete set of mappings to be operated on
- */
- public ResourceMapping[] getInputMappings();
-
- /**
- * Return the set of traversals that cover the input
- * resource mappings.
- * This method should only be invoked after <code>buildInput</code>
- * is called.
- * @return the complete set of mappings to be operated on
- */
- public ResourceTraversal[] getInputTraversals();
-
- /**
- * Return the traversals that cover the given mapping.
- * @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 input has additional mappings added to the
- * seed mappings.
- * This method should only be invoked after <code>buildInput</code>
- * is called.
- * @return whether the input has additional mappings added to the
- * seed mappings
- */
- public boolean hasAdditionalMappings();
-
- /**
- * Return all the model providers that have mappings in this input.
- * @return all the model providers that have mappings in this input
- */
- public ModelProvider[] getModelProviders();
-
- /**
- * Return all the mappings 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[] getResourceMappings(String modelProviderId);
-
- public ISynchronizeScope asSynchronizationScope();
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingOperationScope.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingOperationScope.java
new file mode 100644
index 000000000..71a57ab5f
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/IResourceMappingOperationScope.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * 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.ui.mapping;
+
+import org.eclipse.core.resources.mapping.*;
+
+/**
+ * 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>
+ * <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
+ *
+ * @since 3.2
+ */
+public interface IResourceMappingOperationScope {
+
+ /**
+ * 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 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 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 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);
+
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ISynchronizationContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ISynchronizationContext.java
index 265eaff4e..16a083860 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ISynchronizationContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ISynchronizationContext.java
@@ -14,10 +14,10 @@ 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.synchronize.ISyncInfoSetChangeListener;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.core.synchronize.SyncInfoTree;
+import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.internal.ui.mapping.ISynchronizationCache;
+import org.eclipse.team.ui.operations.MergeContext;
+import org.eclipse.team.ui.operations.SynchronizationContext;
import org.eclipse.team.ui.synchronize.ISynchronizeScope;
/**
@@ -35,7 +35,8 @@ import org.eclipse.team.ui.synchronize.ISynchronizeScope;
* clients should listen to both sources in order to guarantee that they update
* any dependent state appropriately.
* <p>
- * This interface is not intended to be implemented by clients.
+ * This interface is not intended to be implemented by clients. They should subclass
+ * {@link SynchronizationContext} or one of its subclasses instead.
*
* <p>
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as
@@ -44,9 +45,12 @@ import org.eclipse.team.ui.synchronize.ISynchronizeScope;
* consulting with the Platform/Team team.
* </p>
*
+ * @see SynchronizationContext
+ * @see MergeContext
+ *
* @since 3.2
*/
-public interface ISynchronizationContext extends ITeamViewerContext {
+public interface ISynchronizationContext {
/**
* Synchronization type constant that indicates that
@@ -61,14 +65,14 @@ public interface ISynchronizationContext extends ITeamViewerContext {
public final static String THREE_WAY = "three-way"; //$NON-NLS-1$
/**
- * Return the scope of this synchronization context. The scope determines
- * the set of resources to which the context applies. Changes in the scope
- * may result in changes to the sync-info available in the tree of this
- * context.
+ * Return the input that defined the scope of this synchronization context.
+ * The input determines the set of resources to which the context applies.
+ * Changes in the input may result in changes to the sync-info available in
+ * the tree of this context.
*
- * @return the set of mappings for which this context applies.
+ * @return the input that defined the scope of this synchronization context.
*/
- public ISynchronizeScope getScope();
+ IResourceMappingOperationScope getScope();
/**
* Return a tree that contains <code>SyncInfo</code> nodes for resources
@@ -81,25 +85,31 @@ public interface ISynchronizationContext extends ITeamViewerContext {
* @return a tree that contains a <code>SyncInfo</code> node for any
* resources that are out-of-sync.
*/
- public SyncInfoTree getSyncInfoTree();
+ public ISyncInfoTree getSyncInfoTree();
/**
* Returns synchronization info for the given resource, or <code>null</code>
* if there is no synchronization info because the resource is not a
- * candidate for synchronization.
+ * candidate for synchronization. This method can be used to obtain the
+ * {@link SyncInfo} and hence the base and remote resource variant handles
+ * for resources that are in-sync or out-of-sync. The sync info for
+ * out-of-sync resources can also be obtained from the {@link #getSyncInfoTree()}
+ * method.
* <p>
- * Note that sync info may be returned for non-existing or for resources
- * which have no corresponding remote resource.
+ * Note that sync info may be returned for non-existing resources or for
+ * resources which have no corresponding remote resource.
* </p>
* <p>
- * This method will be quick. If synchronization calculation requires content from
- * the server it must be cached when the context is created or refreshed. A client should
- * call refresh before calling this method to ensure that the latest information
- * is available for computing the sync state.
+ * This method will be quick. If synchronization calculation requires
+ * content from the server it must be cached when the context is created or
+ * refreshed. A client should call refresh before calling this method to
+ * ensure that the latest information is available for computing the sync
+ * state.
* </p>
+ *
* @param resource the resource of interest
* @return sync info
- * @throws CoreException
+ * @throws CoreException
*/
public SyncInfo getSyncInfo(IResource resource) throws CoreException;
@@ -120,8 +130,19 @@ public interface ISynchronizationContext extends ITeamViewerContext {
public String getType();
/**
- * Dispose of the synchronization context. This method should be
- * invoked by clients when the context is no longer needed.
+ * Return the cache assocated with this synchronization context.
+ * The cache is maintained for the lifetime of this context and is
+ * disposed when the the context is disposed. It can be used by
+ * clients to cache model state related to the context so that it can
+ * be mainatined for the life of the operation to which the context
+ * applies.
+ * @return the cache assocated with this synchronization context
+ */
+ public ISynchronizationCache 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();
@@ -154,5 +175,4 @@ public interface ISynchronizationContext extends ITeamViewerContext {
* </ul>
*/
public void refresh(ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException;
-
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ITeamViewerContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ITeamViewerContext.java
deleted file mode 100644
index c289a82a1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ITeamViewerContext.java
+++ /dev/null
@@ -1,67 +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.ui.mapping;
-
-import org.eclipse.core.resources.mapping.*;
-
-/**
- * A context determined by Team providers and passed to model views
- * in order to display a subset of a model that is involved in a team
- * operation
- *
- * <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 ITeamViewerContext {
-
- public static final String ALL_MAPPINGS = "";
-
- /**
- * Return the model providers that have mappings
- * in this context.
- * @return the model providers that have mappings
- * in this context
- */
- public ModelProvider[] getModelProviders();
-
- /**
- * Return the set of resource mappings associated with
- * the given model provider affected by the
- * team operation that provided the context. If all
- * resource mappings are desired, pass <code>ALL_MAPPINGS</code>
- * as the model provider id.
- * @param modelProviderId the model provider id.
- * @return a set of resource mappings
- */
- public ResourceMapping[] getResourceMappings(String modelProviderId);
-
- /**
- * Return the set of traversals that cover the
- * resource mappings in this context.
- * @return the complete set of mappings to be operated on
- */
- public ResourceTraversal[] getTraversals();
-
- /**
- * Return the traversals that cover the given mapping.
- * @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 in the context)
- */
- public ResourceTraversal[] getTraversals(ResourceMapping mapping);
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ResourceMappingOperationInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ResourceMappingOperationInput.java
deleted file mode 100644
index b7fa0e347..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ResourceMappingOperationInput.java
+++ /dev/null
@@ -1,251 +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.ui.mapping;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.IModelProviderDescriptor;
-import org.eclipse.core.resources.mapping.ModelProvider;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.mapping.SimpleResourceMappingOperationInput;
-
-/**
- * Transform the set of selected resource mappings into the
- * complete set of resource mappings affected by the operation.
- * <p>
- * Here's a summary of the input determination scheme
- * <ol>
- * <li>Obtain selected mappings
- * <li>Project mappings onto resources using the appropriate
- * context(s) in order to obtain a set of ResourceTraverals
- * <li>Determine what model providers are interested in the targeted resources
- * <li>From those model providers, obtain the set of affected resource mappings
- * <li>If the original set is the same as the new set, we are done.
- * <li>if the set differs from the original selection, rerun the mapping process
- * for any new mappings
- * <ul>
- * <li>Only need to query model providers for mappings for new resources
- * <li>If new mappings are obtained,
- * ask model provider to compress the mappings?
- * <li>keep repeating until no new mappings or resources are added
- * </ul>
- * <li>Compress the mappings from each provider
- * <li>flag overlapping mappings from independent providers
- * <li>Display the original set and the new set with an explanation
- * <ul>
- * <li>The original set and final set may involve mappings from
- * multiple providers.
- * <li>The number of providers can be reduced by assuming that
- * extending models can display the elements of extended models.
- * Then we are only left with conflicting models.
- * <li>Could use a content provider approach a.k.a. Common Navigator
- * or component based approach
- * </ul>
- * </ol>
- *
- * <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 class ResourceMappingOperationInput extends SimpleResourceMappingOperationInput {
-
- private final Map inputMappingsToResources = new HashMap();
- private final Map targetMappingsToResources = new HashMap();
- private boolean hasAdditionalMappings;
-
- public ResourceMappingOperationInput(ResourceMapping[] mappings, ResourceMappingContext context) {
- super(mappings, context);
- }
-
- public void buildInput(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- buildInputMappingToResourcesMap(Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
- Set targetMappings = inputMappingsToResources.keySet();
- Set handledResources = new HashSet();
- Set newResources;
- do {
- newResources = addToTargetMappingToResourceMap(targetMappings, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
- IResource[] adjusted = adjustNewResources(newResources);
- targetMappings = internalGetMappingsFromProviders(adjusted, getAffectedNatures(targetMappings), Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
-
- //TODO: The new resources aren't really just the new ones so reduce the set if needed
- if (!handledResources.isEmpty()) {
- for (Iterator iter = newResources.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- if (handledResources.contains(resource)) {
- iter.remove();
- }
- }
- }
-
- handledResources.addAll(newResources);
-
- } while (!newResources.isEmpty());
- hasAdditionalMappings = internalHasAdditionalMappings();
- }
-
- /*
- * Give the subclass a chance to add resources to the set of affected resources
- */
- private IResource[] adjustNewResources(Set newResources) {
- IResource[] resources = (IResource[]) newResources.toArray(new IResource[newResources.size()]);
- IResource[] adjusted = adjustInputResources(resources);
- return adjusted;
- }
-
- /**
- * Adjust the given set of input resources to include any additional
- * resources required by a particular repository provider for the current
- * operation. By default the original set is returned but subclasses may
- * override. Overriding methods should return a set of resources that
- * include the original resource either explicitly or implicitly as a child
- * of a returned resource.
- *
- * @param resources the input resources
- * @return the input resources adjusted to include any additional resources
- * required for the current operation
- */
- protected IResource[] adjustInputResources(IResource[] resources) {
- return resources;
- }
-
- private boolean internalHasAdditionalMappings() {
- ResourceMapping[] inputMappings = getSeedMappings();
- if (inputMappings .length == targetMappingsToResources.size()) {
- for (int i = 0; i < inputMappings.length; i++) {
- ResourceMapping mapping = inputMappings[i];
- if (!targetMappingsToResources.containsKey(mapping)) {
- return true;
- }
- }
- return false;
- }
- return true;
- }
-
- private String[] getAffectedNatures(Set targetMappings) {
- Set result = new HashSet();
- for (Iterator iter = targetMappings.iterator(); iter.hasNext();) {
- ResourceMapping mapping = (ResourceMapping) iter.next();
- IProject[] projects = mapping.getProjects();
- for (int j = 0; j < projects.length; j++) {
- IProject project = projects[j];
- try {
- result.addAll(Arrays.asList(project.getDescription().getNatureIds()));
- } catch (CoreException e) {
- TeamUIPlugin.log(e);
- }
- }
- }
- return (String[]) result.toArray(new String[result.size()]);
- }
-
- private Set internalGetMappingsFromProviders(IResource[] resources, String[] affectedNatures, IProgressMonitor monitor) throws CoreException {
- Set result = new HashSet();
- IModelProviderDescriptor[] descriptors = ModelProvider.getModelProviderDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- IModelProviderDescriptor descriptor = descriptors[i];
- ResourceMapping[] mappings = getMappings(descriptor, resources, affectedNatures, getContext(), monitor);
- result.addAll(Arrays.asList(mappings));
- }
- return result;
- }
-
- public ResourceMapping[] getMappings(IModelProviderDescriptor descriptor, IResource[] resources, String[] affectedNatures, ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
- IResource[] matchingResources = descriptor.getMatchingResources(resources, affectedNatures);
- return descriptor.getModelProvider().getMappings(matchingResources, context, monitor);
- }
-
- private Set addToTargetMappingToResourceMap(Set targetMappings, IProgressMonitor monitor) throws CoreException {
- Set newResources = new HashSet();
- for (Iterator iter = targetMappings.iterator(); iter.hasNext();) {
- ResourceMapping mapping = (ResourceMapping) iter.next();
- if (!targetMappingsToResources.containsKey(mapping)) {
- ResourceTraversal[] traversals = mapping.getTraversals(getContext(), Policy.subMonitorFor(monitor, 100));
- targetMappingsToResources.put(mapping, traversals);
- newResources.addAll(internalGetResources(traversals));
- }
- }
- return newResources;
- }
-
- private Collection internalGetResources(ResourceTraversal[] traversals) {
- Set result = new HashSet();
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- IResource resource = resources[j];
- //TODO: should we check for parent/child relationships?
- result.add(resource);
- }
- }
- return result;
- }
-
- private void buildInputMappingToResourcesMap(IProgressMonitor monitor) throws CoreException {
- ResourceMapping[] inputMappings = getSeedMappings();
- monitor.beginTask(null, inputMappings.length * 100);
- for (int i = 0; i < inputMappings.length; i++) {
- ResourceMapping mapping = inputMappings[i];
- ResourceTraversal[] traversals = mapping.getTraversals(getContext(), Policy.subMonitorFor(monitor, 100));
- inputMappingsToResources.put(mapping, traversals);
- }
- monitor.done();
- }
-
- public ResourceMapping[] getInputMappings() {
- return (ResourceMapping[]) targetMappingsToResources.keySet().toArray(new ResourceMapping[targetMappingsToResources.size()]);
- }
-
- public ResourceTraversal[] getInputTraversals() {
- Collection values = targetMappingsToResources.values();
- List result = new ArrayList();
- for (Iterator iter = values.iterator(); iter.hasNext();) {
- ResourceTraversal[] traversals = (ResourceTraversal[]) iter.next();
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- result.add(traversal);
- }
- }
- return combineTraversals((ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()]));
- }
-
- public ResourceTraversal[] getTraversals(ResourceMapping mapping) {
- return (ResourceTraversal[])targetMappingsToResources.get(mapping);
- }
-
- public boolean hasAdditionalMappings() {
- return hasAdditionalMappings;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/TeamViewerContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/TeamViewerContext.java
deleted file mode 100644
index cb892f352..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/TeamViewerContext.java
+++ /dev/null
@@ -1,62 +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.ui.mapping;
-
-import org.eclipse.core.resources.mapping.*;
-
-
-/**
- * A concrete implementation of the <code>ITeamViewerContext</code>
- *
- * <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 class TeamViewerContext implements ITeamViewerContext {
-
- private final IResourceMappingOperationInput input;
-
- public TeamViewerContext(IResourceMappingOperationInput input) {
- this.input = input;
- }
-
- /**
- * Return the input used to create this operation context.
- * @return the input used to create this operation context
- */
- public IResourceMappingOperationInput getInput() {
- return input;
- }
-
- public ModelProvider[] getModelProviders() {
- return getInput().getModelProviders();
- }
-
- public ResourceMapping[] getResourceMappings(String id) {
- if (id.equals(ALL_MAPPINGS))
- return getInput().getInputMappings();
- return getInput().getResourceMappings(id);
- }
-
- public ResourceTraversal[] getTraversals() {
- return getInput().getInputTraversals();
- }
-
- public ResourceTraversal[] getTraversals(ResourceMapping mapping) {
- return getInput().getTraversals(mapping);
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/MergeContext.java
index 2dd3c53f7..f6c4e39e1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/MergeContext.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.mapping;
+package org.eclipse.team.ui.operations;
import java.io.*;
import java.util.*;
@@ -23,6 +23,7 @@ import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.internal.core.TeamPlugin;
import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.ui.mapping.*;
/**
* Provides the context for an <code>IResourceMappingMerger</code>.
@@ -31,7 +32,7 @@ import org.eclipse.team.internal.ui.TeamUIPlugin;
* The ancestor context is only required for merges while the remote
* is required for both merge and replace.
*
- * TODO: Need to have a story for folder merging
+ * TODO: Need to have a story for folder merging (see bug 113898)
*
* <p>
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as
@@ -43,44 +44,16 @@ import org.eclipse.team.internal.ui.TeamUIPlugin;
* @see IResourceMappingMerger
* @since 3.2
*/
-public abstract class MergeContext extends SynchronizeOperationContext implements IMergeContext {
+public abstract class MergeContext extends SynchronizationContext implements IMergeContext {
private static final String TXT_EXTENTION = "txt"; //$NON-NLS-1$
-
- private final String type;
- private final SyncInfoTree tree;
/**
* Create a merge context.
* @param type
*/
- protected MergeContext(String type, SyncInfoTree tree, IResourceMappingOperationInput input) {
- super(input);
- this.type = type;
- this.tree = tree;
- }
-
- /**
- * Return the type of merge to take place. A
- * type of <code>TWO_WAY</code> indicates that
- * the local contents are to be replaced with
- * the remote contents while a type of <code>THREE_WAY</code>
- * indicates that the remote changes should be merged
- * with the local changes.
- * @return the type of merge to take place
- */
- public final String getType() {
- return type;
- }
-
- /**
- * Return a tree that contains a <code>SyncInfo</code>
- * node for any resources that are out-of-sync.
- * @return a tree that contains a <code>SyncInfo</code>
- * node for any resources that are out-of-sync.
- */
- public final SyncInfoTree getSyncInfoTree() {
- return tree;
+ protected MergeContext(IResourceMappingOperationScope input, String type, SyncInfoTree tree) {
+ super(input, type, tree);
}
/**
@@ -116,8 +89,6 @@ public abstract class MergeContext extends SynchronizeOperationContext implement
* Any resource changes triggered by this merge will be reported through the
* resource delta mechanism and the sync-info tree associated with this context.
*
- * TODO: How do we handle folder removals generically?
- *
* @see SyncInfoSet#addSyncSetChangedListener(ISyncInfoSetChangeListener)
* @see org.eclipse.core.resources.IWorkspace#addResourceChangeListener(IResourceChangeListener)
*
@@ -136,8 +107,8 @@ public abstract class MergeContext extends SynchronizeOperationContext implement
SyncInfo info = (SyncInfo) iter.next();
IStatus s = merge(info, monitor);
if (!s.isOK()) {
- if (s.getCode() == MergeStatus.CONFLICTS) {
- failedFiles.addAll(Arrays.asList(((MergeStatus)s).getConflictingFiles()));
+ if (s.getCode() == IMergeStatus.CONFLICTS) {
+ failedFiles.addAll(Arrays.asList(((IMergeStatus)s).getConflictingFiles()));
} else {
return s;
}
@@ -163,7 +134,7 @@ public abstract class MergeContext extends SynchronizeOperationContext implement
* @return a status indicating success or failure. A code of
* <code>MergeStatus.CONFLICTS</code> indicates that the file contain
* non-mergable conflicts and must be merged manually.
- * @see org.eclipse.team.ui.mapping.MergeContext#merge(org.eclipse.core.resources.IFile, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.team.ui.operations.MergeContext#merge(org.eclipse.core.resources.IFile, org.eclipse.core.runtime.IProgressMonitor)
*/
public IStatus merge(SyncInfo info, IProgressMonitor monitor) {
IResource r = info.getLocal();
@@ -203,7 +174,7 @@ public abstract class MergeContext extends SynchronizeOperationContext implement
return performReplace(info, monitor);
}
} catch (CoreException e) {
- return new Status(IStatus.ERROR, TeamPlugin.ID, MergeStatus.INTERNAL_ERROR, NLS.bind("Merge of {0} failed due to an internal error.", new String[] { file.getFullPath().toString() }), e);
+ return new Status(IStatus.ERROR, TeamPlugin.ID, IMergeStatus.INTERNAL_ERROR, NLS.bind("Merge of {0} failed due to an internal error.", new String[] { file.getFullPath().toString() }), e);
}
}
@@ -258,7 +229,7 @@ public abstract class MergeContext extends SynchronizeOperationContext implement
if (merger == null)
merger = CompareUI.createStreamMerger(TXT_EXTENTION);
if (merger == null)
- return new Status(IStatus.ERROR, TeamPlugin.ID, MergeStatus.INTERNAL_ERROR, NLS.bind("Auto-merge support for {0} is not available.", new String[] { file.getFullPath().toString() }), null);
+ return new Status(IStatus.ERROR, TeamPlugin.ID, IMergeStatus.INTERNAL_ERROR, NLS.bind("Auto-merge support for {0} is not available.", new String[] { file.getFullPath().toString() }), null);
return merge(merger, info, monitor);
}
@@ -362,7 +333,7 @@ public abstract class MergeContext extends SynchronizeOperationContext implement
try {
return new BufferedInputStream(new FileInputStream(tmpFile));
} catch (FileNotFoundException e) {
- throw new CoreException(new Status(IStatus.ERROR, TeamPlugin.ID, MergeStatus.INTERNAL_ERROR, NLS.bind("Could not read from temporary file {0}: {1}", new String[] { tmpFile.getAbsolutePath(), e.getMessage() }), e));
+ throw new CoreException(new Status(IStatus.ERROR, TeamPlugin.ID, IMergeStatus.INTERNAL_ERROR, NLS.bind("Could not read from temporary file {0}: {1}", new String[] { tmpFile.getAbsolutePath(), e.getMessage() }), e));
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeStatus.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/MergeStatus.java
index 4c20a2ab9..bd6e9e276 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeStatus.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/MergeStatus.java
@@ -1,10 +1,10 @@
-package org.eclipse.team.ui.mapping;
+package org.eclipse.team.ui.operations;
-import org.eclipse.compare.IStreamMerger;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.team.ui.mapping.IMergeStatus;
/**
* A special status that is returned when the return code
@@ -26,7 +26,7 @@ import org.eclipse.core.runtime.Status;
*
* @since 3.2
*/
-public final class MergeStatus extends Status {
+public final class MergeStatus extends Status implements IMergeStatus {
private ResourceMapping[] conflictingMappings;
private IFile[] conflictingFiles;
@@ -55,33 +55,16 @@ public final class MergeStatus extends Status {
this.conflictingFiles = files;
}
- /**
- * Indicates that a change conflict prevented some or all of the resource
- * mappings to be merged (value <code>1</code>). When this code is
- * returned, the status must be of type
- * <code>MergeStatus</code> and must contain the list of all
- * resource mappings for which a manual merge is required.
- */
- public static final int CONFLICTS = IStreamMerger.CONFLICT;
-
- /**
- * Status code describing an internal error (value <code>2</code>).
- * The status return is not required to be of type <code>MergeStatus</code>
- * for internal errors.
- */
- public static final int INTERNAL_ERROR= IStreamMerger.INTERNAL_ERROR;
-
- /**
- * Returns the set of resource mappings for which an auto-merge was
- * not performed. The client should present the mappings to the user
- * in a manner that will allow the user to perform a manual merges.
- * @return the set of resource mappings for which an auto-merge was
- * not performed.
- */
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.IMergeStatus#getConflictingMappings()
+ */
public ResourceMapping[] getConflictingMappings() {
return conflictingMappings;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.IMergeStatus#getConflictingFiles()
+ */
public IFile[] getConflictingFiles() {
return conflictingFiles;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ResourceMappingMergeOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/ResourceMappingMergeOperation.java
index 12e601e19..d49d90c58 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ResourceMappingMergeOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/ResourceMappingMergeOperation.java
@@ -8,16 +8,17 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.mapping;
+package org.eclipse.team.ui.operations;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.resources.mapping.ModelProvider;
+import org.eclipse.core.resources.mapping.*;
import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.ui.mapping.*;
import org.eclipse.ui.IWorkbenchPart;
/**
@@ -80,11 +81,6 @@ import org.eclipse.ui.IWorkbenchPart;
* <li>Allow use to choose order of evaluation?
* <li>Support tabbed sync view
* </ul>
- * <p>
- * TODO: What about support for down grading a merge. That is, the user wants
- * to perform the merge at the file level even though a higher level model owns
- * the files. We could provide a preference that the user can set to perform
- * the merge at the level selected and not involve participants.
*
* <p>
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as
@@ -97,8 +93,8 @@ import org.eclipse.ui.IWorkbenchPart;
*/
public abstract class ResourceMappingMergeOperation extends ResourceMappingOperation {
- protected ResourceMappingMergeOperation(IWorkbenchPart part, IResourceMappingOperationInput input) {
- super(part, input);
+ protected ResourceMappingMergeOperation(IWorkbenchPart part, ResourceMapping[] selectedMappings, ResourceMappingContext context) {
+ super(part, selectedMappings, context);
}
/* (non-Javadoc)
@@ -107,7 +103,7 @@ public abstract class ResourceMappingMergeOperation extends ResourceMappingOpera
protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
IMergeContext context = buildMergeContext(monitor);
- ModelProvider[] providers = getInput().getModelProviders();
+ ModelProvider[] providers = getScope().getModelProviders();
List failedMerges = new ArrayList();
for (int i = 0; i < providers.length; i++) {
ModelProvider provider = providers[i];
@@ -156,7 +152,7 @@ public abstract class ResourceMappingMergeOperation extends ResourceMappingOpera
monitor.beginTask(null, 100);
IStatus status = performAutoMerge(provider, mergeContext, Policy.subMonitorFor(monitor, 95));
if (!status.isOK()) {
- if (status.getCode() == MergeStatus.CONFLICTS) {
+ if (status.getCode() == IMergeStatus.CONFLICTS) {
return false;
} else {
throw new TeamException(status);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ResourceMappingOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/ResourceMappingOperation.java
index 7fc5db662..124b75816 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/ResourceMappingOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/ResourceMappingOperation.java
@@ -8,17 +8,18 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.ui.mapping;
+package org.eclipse.team.ui.operations;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.resources.mapping.ModelProvider;
-import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.resources.mapping.*;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.team.internal.ui.dialogs.AdditionalMappingsDialog;
import org.eclipse.team.internal.ui.mapping.DefaultResourceMappingMerger;
import org.eclipse.team.ui.TeamOperation;
+import org.eclipse.team.ui.mapping.IResourceMappingMerger;
+import org.eclipse.team.ui.mapping.IResourceMappingOperationScope;
import org.eclipse.ui.IWorkbenchPart;
/**
@@ -62,7 +63,13 @@ import org.eclipse.ui.IWorkbenchPart;
*/
public abstract class ResourceMappingOperation extends TeamOperation {
- private final IResourceMappingOperationInput input;
+ /**
+ *
+ */
+ private static final ResourceMappingOperationScopeBuilder DEFAULT_SCOPE_BUILDER = new ResourceMappingOperationScopeBuilder();
+ private final ResourceMapping[] selectedMappings;
+ private final ResourceMappingContext context;
+ private IResourceMappingOperationScope scope;
/**
* Create a resource mapping based operation
@@ -70,14 +77,15 @@ public abstract class ResourceMappingOperation extends TeamOperation {
* @param input the input to the operation (which must have already been built by
* invoking <code>buildInput</code>.
*/
- protected ResourceMappingOperation(IWorkbenchPart part, IResourceMappingOperationInput input) {
+ protected ResourceMappingOperation(IWorkbenchPart part, ResourceMapping[] selectedMappings, ResourceMappingContext context) {
super(part);
- this.input = input;
+ this.selectedMappings = selectedMappings;
+ this.context = context;
}
public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
- buildInput(monitor);
+ buildScope(monitor);
execute(monitor);
}
@@ -86,10 +94,10 @@ public abstract class ResourceMappingOperation extends TeamOperation {
* resource mappings and the set of interested participants
* @param monitor
*/
- protected void buildInput(IProgressMonitor monitor) throws InvocationTargetException {
+ protected void buildScope(IProgressMonitor monitor) throws InvocationTargetException {
try {
- input.buildInput(monitor);
- if (input.hasAdditionalMappings()) {
+ scope = getScopeBuilder().buildScope(selectedMappings, context, monitor);
+ if (scope.hasAdditionalMappings()) {
promptForInputChange(monitor);
}
} catch (CoreException e) {
@@ -98,20 +106,31 @@ public abstract class ResourceMappingOperation extends TeamOperation {
}
/**
+ * Return the scope builder used to build the scope of this
+ * operation from the input mappings. This method can be
+ * overridden by subclasses.
+ * @return the scope builder used to build the scope of this
+ * operation from the input mappings.
+ */
+ protected ResourceMappingOperationScopeBuilder getScopeBuilder() {
+ return DEFAULT_SCOPE_BUILDER;
+ }
+
+ /**
* Prompt the user to inform them that additional resource mappings
* have been included in the operations.
* @param monitor a progress monitor
* @throws OperationCanceledException if the user choose to cancel
*/
protected void promptForInputChange(IProgressMonitor monitor) {
- showAllMappings(input.getSeedMappings(), input.getInputMappings());
+ showAllMappings(scope.getInputMappings(), scope.getMappings());
}
private void showAllMappings(final ResourceMapping[] selectedMappings, final ResourceMapping[] allMappings) {
final boolean[] canceled = new boolean[] { false };
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
- AdditionalMappingsDialog dialog = new AdditionalMappingsDialog(getShell(), "Participating Elements", getInput());
+ AdditionalMappingsDialog dialog = new AdditionalMappingsDialog(getShell(), "Participating Elements", getScope());
int result = dialog.open();
canceled[0] = result != Dialog.OK;
}
@@ -140,11 +159,11 @@ public abstract class ResourceMappingOperation extends TeamOperation {
if (o instanceof IResourceMappingMerger) {
return (IResourceMappingMerger) o;
}
- return new DefaultResourceMappingMerger(provider, getInput());
+ return new DefaultResourceMappingMerger(provider, getScope());
}
- public IResourceMappingOperationInput getInput() {
- return input;
+ public IResourceMappingOperationScope getScope() {
+ return scope;
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/ResourceMappingOperationScopeBuilder.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/ResourceMappingOperationScopeBuilder.java
new file mode 100644
index 000000000..3062f5bf6
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/ResourceMappingOperationScopeBuilder.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.operations;
+
+import java.util.*;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.mapping.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.mapping.ResourceMappingOperationScope;
+import org.eclipse.team.ui.mapping.IResourceMappingOperationScope;
+
+/**
+ * Class 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 class is can be subclasses by clients.
+ *
+ * <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
+ *
+ * @since 3.2
+ */
+public class ResourceMappingOperationScopeBuilder {
+
+ /**
+ * Build the scope that is used to determine the complete set of resource
+ * mappings, and hence resources, that an operation should be performed on.
+ *
+ * @param selectedMappings the selected set of resource mappings
+ * @param context the resource mapping context used to determine the
+ * resources to be oeprated on
+ * @param monitor a progress monitor
+ * @return a scope that defines the complete set of resources to be operated
+ * on
+ * @throws CoreException
+ */
+ public IResourceMappingOperationScope buildScope(
+ ResourceMapping[] selectedMappings, ResourceMappingContext context,
+ IProgressMonitor monitor) throws CoreException {
+
+ monitor.beginTask(null, IProgressMonitor.UNKNOWN);
+
+ // Create the scope
+ ResourceMappingOperationScope scope = createScope(selectedMappings);
+
+ // Accumulate the initial set of mappings we need traversals for
+ Set targetMappings = new HashSet();
+ for (int i = 0; i < selectedMappings.length; i++) {
+ ResourceMapping mapping = selectedMappings[i];
+ targetMappings.add(mapping);
+ }
+ Set handledResources = new HashSet();
+ Set newResources;
+ do {
+ newResources = addMappingsToScope(scope, targetMappings, context,
+ Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
+ IResource[] adjusted = adjustNewResources(newResources);
+ targetMappings = internalGetMappingsFromProviders(adjusted,
+ getAffectedNatures(targetMappings), context, Policy
+ .subMonitorFor(monitor, IProgressMonitor.UNKNOWN));
+
+ // TODO: The new resources aren't really just the new ones so reduce
+ // the set if needed
+ if (!handledResources.isEmpty()) {
+ for (Iterator iter = newResources.iterator(); iter.hasNext();) {
+ IResource resource = (IResource) iter.next();
+ if (handledResources.contains(resource)) {
+ iter.remove();
+ }
+ }
+ }
+
+ handledResources.addAll(newResources);
+
+ } while (!newResources.isEmpty());
+ setHasAdditionalMappings(scope, hasAdditionalMappings(scope));
+ return scope;
+ }
+
+ /**
+ * set whether the scope has additional mappings. This method is not
+ * intended to be subclassed.
+ *
+ * @param scope the scope
+ * @param hasAdditionalMappings a bollean indicating if the scope has
+ * additonal mappings
+ */
+ protected void setHasAdditionalMappings(
+ ResourceMappingOperationScope scope, boolean hasAdditionalMappings) {
+ scope.setHasAdditionalMappings(hasAdditionalMappings);
+ }
+
+ /**
+ * Create the scope that will be populated and returned by the builder. This
+ * method is not intended to be overridden by clients.
+ *
+ * @param inputMappings the input mappings
+ * @return a newly created scope that will be populated and returned by the
+ * builder
+ */
+ protected ResourceMappingOperationScope createScope(
+ ResourceMapping[] inputMappings) {
+ return new ResourceMappingOperationScope(inputMappings);
+ }
+
+ /**
+ * Adjust the given set of input resources to include any additional
+ * resources required by a particular repository provider for the current
+ * operation. By default the original set is returned but subclasses may
+ * override. Overriding methods should return a set of resources that
+ * include the original resource either explicitly or implicitly as a child
+ * of a returned resource.
+ *
+ * @param resources the input resources
+ * @return the input resources adjusted to include any additional resources
+ * required for the current operation
+ */
+ protected IResource[] adjustInputResources(IResource[] resources) {
+ return resources;
+ }
+
+ private Set addMappingsToScope(ResourceMappingOperationScope scope,
+ Set targetMappings, ResourceMappingContext context,
+ IProgressMonitor monitor) throws CoreException {
+ Set newResources = new HashSet();
+ for (Iterator iter = targetMappings.iterator(); iter.hasNext();) {
+ ResourceMapping mapping = (ResourceMapping) iter.next();
+ if (scope.getTraversals(mapping) == null) {
+ ResourceTraversal[] traversals = mapping.getTraversals(context,
+ Policy.subMonitorFor(monitor, 100));
+ addMappingToScope(scope, mapping, traversals);
+ newResources.addAll(internalGetResources(traversals));
+ }
+ }
+ return newResources;
+ }
+
+ /**
+ * Add the mapping and its caclulated traversals to the scope. This method
+ * is not intended to be subclassed by clients.
+ *
+ * @param scope the scope
+ * @param mapping the resource mapping
+ * @param traversals the resource mapping's traversals
+ */
+ protected void addMappingToScope(ResourceMappingOperationScope scope,
+ ResourceMapping mapping, ResourceTraversal[] traversals) {
+ scope.addMapping(mapping, traversals);
+ }
+
+ private Collection internalGetResources(ResourceTraversal[] traversals) {
+ Set result = new HashSet();
+ for (int i = 0; i < traversals.length; i++) {
+ ResourceTraversal traversal = traversals[i];
+ IResource[] resources = traversal.getResources();
+ for (int j = 0; j < resources.length; j++) {
+ IResource resource = resources[j];
+ // TODO: should we check for parent/child relationships?
+ result.add(resource);
+ }
+ }
+ return result;
+ }
+
+ /*
+ * Give the subclass a chance to add resources to the set of affected
+ * resources
+ */
+ private IResource[] adjustNewResources(Set newResources) {
+ IResource[] resources = (IResource[]) newResources
+ .toArray(new IResource[newResources.size()]);
+ IResource[] adjusted = adjustInputResources(resources);
+ return adjusted;
+ }
+
+ private String[] getAffectedNatures(Set targetMappings) {
+ Set result = new HashSet();
+ for (Iterator iter = targetMappings.iterator(); iter.hasNext();) {
+ ResourceMapping mapping = (ResourceMapping) iter.next();
+ IProject[] projects = mapping.getProjects();
+ for (int j = 0; j < projects.length; j++) {
+ IProject project = projects[j];
+ try {
+ result.addAll(Arrays.asList(project.getDescription()
+ .getNatureIds()));
+ } catch (CoreException e) {
+ TeamUIPlugin.log(e);
+ }
+ }
+ }
+ return (String[]) result.toArray(new String[result.size()]);
+ }
+
+ private Set internalGetMappingsFromProviders(IResource[] resources,
+ String[] affectedNatures, ResourceMappingContext context,
+ IProgressMonitor monitor) throws CoreException {
+ Set result = new HashSet();
+ IModelProviderDescriptor[] descriptors = ModelProvider
+ .getModelProviderDescriptors();
+ for (int i = 0; i < descriptors.length; i++) {
+ IModelProviderDescriptor descriptor = descriptors[i];
+ ResourceMapping[] mappings = getMappings(descriptor, resources,
+ affectedNatures, context, monitor);
+ result.addAll(Arrays.asList(mappings));
+ }
+ return result;
+ }
+
+ private ResourceMapping[] getMappings(IModelProviderDescriptor descriptor,
+ IResource[] resources, String[] affectedNatures,
+ ResourceMappingContext context, IProgressMonitor monitor)
+ throws CoreException {
+ IResource[] matchingResources = descriptor.getMatchingResources(
+ resources, affectedNatures);
+ return descriptor.getModelProvider().getMappings(matchingResources,
+ context, monitor);
+ }
+
+ private boolean hasAdditionalMappings(ResourceMappingOperationScope scope) {
+ ResourceMapping[] inputMappings = scope.getInputMappings();
+ ResourceMapping[] mappings = scope.getMappings();
+ if (inputMappings.length == mappings.length) {
+ Set testSet = new HashSet();
+ for (int i = 0; i < mappings.length; i++) {
+ ResourceMapping mapping = mappings[i];
+ testSet.add(mapping);
+ }
+ for (int i = 0; i < inputMappings.length; i++) {
+ ResourceMapping mapping = inputMappings[i];
+ if (!testSet.contains(mapping)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/SynchronizationContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/SynchronizationContext.java
new file mode 100644
index 000000000..a592801b8
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/operations/SynchronizationContext.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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 Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui.operations;
+
+import org.eclipse.team.core.synchronize.ISyncInfoTree;
+import org.eclipse.team.core.synchronize.SyncInfoTree;
+import org.eclipse.team.internal.ui.mapping.ISynchronizationCache;
+import org.eclipse.team.internal.ui.mapping.SynchronizationCache;
+import org.eclipse.team.ui.mapping.IResourceMappingOperationScope;
+import org.eclipse.team.ui.mapping.ISynchronizationContext;
+
+/**
+ * Abstract implementation of the {@link ISynchronizationContext} interface.
+ * This class can be subclassed by clients.
+ *
+ * <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 ISynchronizationContext
+ * @since 3.2
+ */
+public abstract class SynchronizationContext implements ISynchronizationContext {
+
+ private IResourceMappingOperationScope input;
+ private final String type;
+ private final SyncInfoTree tree;
+ private SynchronizationCache cache;
+
+ /**
+ * Create a synchronization context
+ * @param input the input that defines the scope of the synchronization
+ * @param type the type of synchronization (ONE_WAY or TWO_WAY)
+ * @param tree the sync info tree that contains all out-of-sync resources
+ */
+ protected SynchronizationContext(IResourceMappingOperationScope input, String type, SyncInfoTree tree) {
+ this.input = input;
+ this.type = type;
+ this.tree = tree;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.ISynchronizationContext#getInput()
+ */
+ public IResourceMappingOperationScope getScope() {
+ return input;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.ISynchronizationContext#getSyncInfoTree()
+ */
+ public ISyncInfoTree getSyncInfoTree() {
+ return tree;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.ISynchronizationContext#getType()
+ */
+ public String getType() {
+ return type;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.ISynchronizationContext#dispose()
+ */
+ public void dispose() {
+ if (cache != null) {
+ cache.dispose();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.mapping.ISynchronizationContext#getCache()
+ */
+ public synchronized ISynchronizationCache getCache() {
+ if (cache == null) {
+ cache = new SynchronizationCache();
+ }
+ return cache;
+ }
+
+}

Back to the top