Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/IComparisonCriteria.java32
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberResource.java14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/MutableSyncInfoSet.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java15
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java23
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/LogicalViewActionGroup.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java21
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java50
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/views/LogicalViewProvider.java32
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java25
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSubscriber.java5
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java7
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java2
14 files changed, 192 insertions, 66 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/IComparisonCriteria.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/IComparisonCriteria.java
index a4a03f0ae..4441bbd38 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/IComparisonCriteria.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/IComparisonCriteria.java
@@ -10,12 +10,14 @@
*******************************************************************************/
package org.eclipse.team.core.subscribers;
+import org.eclipse.core.resources.IResource;
/**
- * A ComparisonCriteria used by a <code>TeamSubscriber</code> to calculate the sync
- * state of the workspace resources. Subscribers are free to use the criteria
+ * An <code>IComparisonCriteria</code> is provided by a <code>TeamSubscriber</code>
+ * and used by a <code>SyncInfo</code> to calculate the sync
+ * state of the workspace resources. Subscribers should provide a criteria
* best suited for their environment. For example, an FTP subscriber could choose to use file
- * size or file timestamps as compasison criterias whereas a CVS workspace subscriber would
+ * size or file timestamps as comparison criterias whereas a CVS workspace subscriber would
* use file revision numbers.
*
* @see SyncInfo
@@ -23,14 +25,28 @@ package org.eclipse.team.core.subscribers;
* @since 3.0
*/
public interface IComparisonCriteria {
+
/**
- * Returns <code>true</code> if e1 and e2 are equal based on this criteria and <code>false</code>
+ * Returns <code>true</code> if the local resource
+ * matches the remote resource based on this criteria and <code>false</code>
* otherwise. Comparing should be fast and based on cached information.
*
- * @param e1 object to be compared
- * @param e2 object to be compared
- * @return <code>true</code> if e1 and e2 are equal based on this criteria and <code>false</code>
+ * @param resource the local resource to be compared
+ * @param remote the remote resources to be compared
+ * @return <code>true</code> if local and remote are equal based on this criteria and <code>false</code>
* otherwise.
*/
- public boolean compare(Object e1, Object e2);
+ public boolean compare(IResource local, ISubscriberResource remote);
+
+ /**
+ * Returns <code>true</code> if the base resource
+ * matches the remote resource based on this criteria and <code>false</code>
+ * otherwise. Comparing should be fast and based on cached information.
+ *
+ * @param base the base resource to be compared
+ * @param remote the remote resources to be compared
+ * @return <code>true</code> if base and remote are equal based on this criteria and <code>false</code>
+ * otherwise.
+ */
+ public boolean compare(ISubscriberResource base, ISubscriberResource remote);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberResource.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberResource.java
index 915788ac9..b477c02bb 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberResource.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/ISubscriberResource.java
@@ -15,15 +15,18 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
/**
- * This interface provides access to a resource that is controlled
- * by a particular subscriber. The resource may be local or remote.
+ * This interface provides access to a remote resource that is controlled
+ * by a particular subscriber. It is used by <code>SyncInfo</code> instances
+ * to provide access to the base and remote resources that correspond to
+ * a locla resource.
*
+ * @see SyncInfo
* @since 3.0
*/
public interface ISubscriberResource {
/**
- * Answers a string that describes the name of the subscriber resource. The name may be
+ * Answers the name of the subscriber resource. The name may be
* displayed to the user.
*
* @return name of the subscriber resource.
@@ -42,9 +45,8 @@ public interface ISubscriberResource {
* Return an instance of IStorage or <code>null</code> if the subscriber resource
* does not have contents (i.e. is a folder). Since the <code>ISorage#getContents()</code>
* method does not accept an IProgressMonitor, this method must ensure that the contents
- * access by the resulting IStorage is cahced locally (hence the IProgressMonitor
- * argument to this method). If the subscriber resource is local, this is not an issue
- * but if the subscriber resource is remote, then implementations of this method should
+ * access by the resulting IStorage is cached locally (hence the IProgressMonitor
+ * argument to this method). Implementations of this method should
* ensure that the resulting IStorage is accessing locally cached contents and is not
* contacting the server.
* @return
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/MutableSyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/MutableSyncInfoSet.java
index b67b5e848..1c60f4d37 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/MutableSyncInfoSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/MutableSyncInfoSet.java
@@ -33,7 +33,11 @@ public class MutableSyncInfoSet extends SyncInfoSet {
SyncInfo info = (SyncInfo)resources.remove(path);
changes.removed(local);
statistics.remove(info);
- removeFromParents(local, local);
+ if (local.getType() == IResource.FILE
+ || members(local).length == 0) {
+ removeFromParents(local, local);
+ }
+
}
public void removeAll(IResource[] resources) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java
index 6898416c9..feb24d383 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java
@@ -13,6 +13,7 @@ package org.eclipse.team.internal.ccvs.core;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.subscribers.IComparisonCriteria;
+import org.eclipse.team.core.subscribers.ISubscriberResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
@@ -72,4 +73,18 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
return false;
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.IComparisonCriteria#compare(org.eclipse.core.resources.IResource, org.eclipse.team.core.subscribers.ISubscriberResource)
+ */
+ public boolean compare(IResource local, ISubscriberResource remote) {
+ return compare(local, (ICVSRemoteResource)remote);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.IComparisonCriteria#compare(org.eclipse.team.core.subscribers.ISubscriberResource, org.eclipse.team.core.subscribers.ISubscriberResource)
+ */
+ public boolean compare(ISubscriberResource base, ISubscriberResource remote) {
+ return compare((ICVSRemoteResource)base, (ICVSRemoteResource)remote);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
index b8d5b3869..e5c4083ee 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeManager.java
@@ -17,10 +17,10 @@ import org.eclipse.core.runtime.*;
import org.eclipse.jface.util.ListenerList;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor;
-import org.eclipse.team.internal.ui.registry.SynchronizeParticipantRegistry;
+import org.eclipse.team.internal.ui.registry.*;
import org.eclipse.team.ui.ITeamUIConstants;
import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.views.ILogicalView;
import org.eclipse.ui.*;
/**
@@ -30,6 +30,7 @@ import org.eclipse.ui.*;
*
* @see ISynchronizeView
* @see ISynchronizeParticipant
+ * @see ILogicalView
* @since 3.0
*/
public class SynchronizeManager implements ISynchronizeManager {
@@ -56,6 +57,8 @@ public class SynchronizeManager implements ISynchronizeManager {
private final static String CTX_PARTICIPANT_DATA = "data"; //$NON-NLS-1$
private final static String FILENAME = "syncParticipants.xml"; //$NON-NLS-1$
+ private LogicalViewRegistry logicalViewRegistry;
+
/**
* Notifies a participant listeners of additions or removals
*/
@@ -502,4 +505,20 @@ public class SynchronizeManager implements ISynchronizeManager {
private void fireUpdate(ISynchronizeParticipant[] participants, int type) {
new SynchronizeViewPageNotifier().notify(participants, type);
}
+
+ private synchronized LogicalViewRegistry getLogicalViewRegistry() {
+ if (logicalViewRegistry == null) {
+ logicalViewRegistry = new LogicalViewRegistry();
+ logicalViewRegistry.readRegistry(Platform.getPluginRegistry(), TeamUIPlugin.ID, ITeamUIConstants.PT_LOGICAL_VIEWS);
+ }
+ return logicalViewRegistry;
+ }
+
+ public ILogicalView[] getLogicalViews() {
+ return getLogicalViewRegistry().getLogicalViews();
+ }
+
+ public ILogicalView getLogicalView(String id) {
+ return getLogicalViewRegistry().getLogicalView(id);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/LogicalViewActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/LogicalViewActionGroup.java
index 0bcf217d9..67d88b024 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/LogicalViewActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/LogicalViewActionGroup.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.SyncInfoSetCompareConfiguration;
+import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.views.ILogicalView;
import org.eclipse.ui.actions.ActionGroup;
@@ -26,7 +26,7 @@ import org.eclipse.ui.actions.ActionGroup;
*/
public class LogicalViewActionGroup extends ActionGroup {
- public static final String SELECTED_VIEW = "selected-view";
+ public static final String SELECTED_VIEW = "selected-view"; //$NON-NLS-1$
Action noLogicalView;
List actions = new ArrayList();
@@ -44,7 +44,7 @@ public class LogicalViewActionGroup extends ActionGroup {
}
};
Utils.initAction(noLogicalView, "action.noLogicalView.", Policy.getBundle());
- ILogicalView[] views = SyncInfoSetCompareConfiguration.getLogicalViews();
+ ILogicalView[] views = TeamUI.getSynchronizeManager().getLogicalViews();
for (int i = 0; i < views.length; i++) {
ILogicalView view = views[i];
actions.add(new LogicalViewAction(view, this));
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java
index 0973d7a5f..1a3abed17 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/CompressedFolderContentProvider.java
@@ -118,7 +118,7 @@ public class CompressedFolderContentProvider extends SyncInfoSetTreeContentProvi
if (roots.length > 0) {
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- if (isChildOfRoot(resource, roots)) {
+ if (isChildOfRoot(resource, roots) || isCompressedParentEmpty(resource)) {
// A root of the resource has also been removed.
// However, the resource's model parent would be a
// compressed folder on the resource's parent folder.
@@ -138,6 +138,25 @@ public class CompressedFolderContentProvider extends SyncInfoSetTreeContentProvi
}
}
+ private boolean isCompressedParentEmpty(IResource resource) {
+ IContainer parent = resource.getParent();
+ if (parent == null
+ || parent.getType() == IResource.ROOT
+ || parent.getType() == IResource.PROJECT) {
+ return false;
+ }
+ // Check if the sync set has any file children of the parent
+ IResource[] members = getSyncInfoSet().members(parent);
+ for (int i = 0; i < members.length; i++) {
+ IResource member = members[i];
+ if (member.getType() == IResource.FILE) {
+ return false;
+ }
+ }
+ // The parent does not contain any files
+ return true;
+ }
+
private boolean isChildOfRoot(IResource resource, IResource[] roots) {
for (int i = 0; i < roots.length; i++) {
IResource root = roots[i];
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
index 2d710f149..d4691e421 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/ISynchronizeManager.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.team.ui.synchronize;
+import org.eclipse.team.ui.synchronize.views.ILogicalView;
import org.eclipse.ui.IWorkbenchPage;
/**
@@ -87,4 +88,23 @@ public interface ISynchronizeManager {
* <code>null</code> if a descriptor is not found for that id.
*/
public ISynchronizeParticipantDescriptor getParticipantDescriptor(String id);
+
+ /**
+ * Return all the logical views that have been registered with Team.
+ * The providers associated with the views will not be instantiated until
+ * they are accessed so this list can be retrieved without fear of loading
+ * client plugins.
+ * @return the regisitered logical views
+ */
+ public ILogicalView[] getLogicalViews();
+
+ /**
+ * Return the registered view with the given id or <code>null</code> if no view
+ * exists for the given id. The provider associated with the view will not be instantiated until
+ * it is accessed so the logical view can be retrieved without fear of loading
+ * client plugins.
+ * @param id the id of the logical view
+ * @return the logical view with the given id or <code>null</code>
+ */
+ public ILogicalView getLogicalView(String id);
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
index 76b23f636..a5bfc0f12 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoSetCompareConfiguration.java
@@ -12,11 +12,13 @@ package org.eclipse.team.ui.synchronize;
import java.util.ArrayList;
-import org.eclipse.compare.*;
+import org.eclipse.compare.CompareEditorInput;
+import org.eclipse.compare.CompareViewerPane;
import org.eclipse.compare.internal.INavigatable;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.*;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -30,10 +32,9 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfoSet;
import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.ui.registry.LogicalViewRegistry;
import org.eclipse.team.internal.ui.synchronize.actions.LogicalViewActionGroup;
-import org.eclipse.team.internal.ui.synchronize.views.*;
-import org.eclipse.team.ui.ITeamUIConstants;
+import org.eclipse.team.internal.ui.synchronize.views.CompressFolderView;
+import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.actions.INavigableTree;
import org.eclipse.team.ui.synchronize.actions.SyncInfoDiffTreeNavigator;
import org.eclipse.team.ui.synchronize.views.*;
@@ -56,7 +57,11 @@ import org.eclipse.ui.views.navigator.ResourceSorter;
*/
public class SyncInfoSetCompareConfiguration {
- private static LogicalViewRegistry logicalViewRegistry;
+ /**
+ * Id of the compressed folder <code>ILogicalVieww</code> that can be used to
+ * access the view using <code>ISynchronizeManager#getLogicalView(String)</code>.
+ */
+ public static final String COMPRESSED_FOLDER_LOGICAL_VIEW_ID = CompressFolderView.ID;
private SyncInfoSet set;
private String menuId;
@@ -69,37 +74,6 @@ public class SyncInfoSetCompareConfiguration {
private LogicalViewActionGroup logicalViews;
- private static synchronized LogicalViewRegistry getLogicalViewRegistry() {
- if (logicalViewRegistry == null) {
- logicalViewRegistry = new LogicalViewRegistry();
- logicalViewRegistry.readRegistry(Platform.getPluginRegistry(), TeamUIPlugin.ID, ITeamUIConstants.PT_LOGICAL_VIEWS);
- }
- return logicalViewRegistry;
- }
-
- /**
- * Return all the logical views that have been registered with Team.
- * The providers associated with the views will not be instantiated until
- * they are accessed so this list can be retrieved without fear of loading
- * client plugins.
- * @return the regisitered logical views
- */
- public static ILogicalView[] getLogicalViews() {
- return getLogicalViewRegistry().getLogicalViews();
- }
-
- /**
- * Return the registered view with the given id or <code>null</code> if no view
- * exists for the given id. The provider associated with the view will not be instantiated until
- * it is accessed so the logical view can be retrieved without fear of loading
- * client plugins.
- * @param id the id of the logical view
- * @return the logical view with the given id or <code>null</code>
- */
- public static ILogicalView getLogicalView(String id) {
- return getLogicalViewRegistry().getLogicalView(id);
- }
-
/**
* Create a <code>SyncInfoSetCompareConfiguration</code> for the given sync set
* and menuId. If the menuId is <code>null</code>, then no contributed menus will be shown
@@ -256,7 +230,7 @@ public class SyncInfoSetCompareConfiguration {
*/
protected ILogicalView getDefaultLogicalView() {
if (getStore().getBoolean(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS)) {
- return getLogicalView(CompressFolderView.ID);
+ return TeamUI.getSynchronizeManager().getLogicalView(COMPRESSED_FOLDER_LOGICAL_VIEW_ID);
} else {
return null;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/views/LogicalViewProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/views/LogicalViewProvider.java
index 0071f61f4..bfdf7db1d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/views/LogicalViewProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/views/LogicalViewProvider.java
@@ -10,6 +10,10 @@
*******************************************************************************/
package org.eclipse.team.ui.synchronize.views;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.subscribers.TeamSubscriber;
@@ -17,6 +21,10 @@ import org.eclipse.ui.views.navigator.ResourceSorter;
/**
* Implementations can be contributed via extension point and used by team participants.
+ *
+ * TODO: Add project nature filter to extension point
+ *
+ * @since 3.0
*/
public abstract class LogicalViewProvider {
@@ -59,11 +67,31 @@ public abstract class LogicalViewProvider {
* by the subscriber (e.g. ignored from version contgrol). The significance of this is that the
* logical view provider can prepare a team operation input that includes resources that need to
* be created locally or deleted remotely and excludes unnecessay resources.
- *
+ * <p>
+ * By default, this method returns a deep (<code>IResource.DEPTH_INFINITE</code>) operations
+ * on any resources that can be obtained from he given elements. Subclasses should override
+ * to provide the proper mapping from their logical elements to a set of
+ * <code>TeamOperationInput</code>.
* @param elements the logical elements
* @param subscriber the team subscriber for which the input is being prepared
* @param monitor a progress monitor
* @return the input to a team operation
*/
- public abstract TeamOperationInput[] getTeamOperationInput(Object[] elements, TeamSubscriber subscriber, IProgressMonitor monitor) throws CoreException;
+ public TeamOperationInput[] getTeamOperationInput(Object[] elements, TeamSubscriber subscriber, IProgressMonitor monitor) throws CoreException {
+ Set resources = new HashSet();
+ for (int i = 0; i < elements.length; i++) {
+ Object object = elements[i];
+ IResource resource = SyncInfoSetContentProvider.getResource(object);
+ if (resource != null) {
+ resources.add(resource);
+ }
+ }
+ if (resources.isEmpty()) {
+ return new TeamOperationInput[0];
+ }
+ return new TeamOperationInput[] {
+ new TeamOperationInput(
+ (IResource[]) resources.toArray(new IResource[resources.size()]),
+ IResource.DEPTH_INFINITE) };
+ }
}
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java
index 2be5ca192..4e8de8caf 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java
@@ -207,7 +207,7 @@ public class SyncInfoSetContentProviderTest extends TeamTest {
fail("Project " + project.getName() + " should not be visible but is.");
}
- public void testSimple() throws CoreException {
+ public void testNestedCompressedFolder() throws CoreException {
IProject project = createProject(new String[] { "file.txt", "folder1/file2.txt", "folder1/folder2/file3.txt"});
adjustSet(
set,
@@ -232,8 +232,27 @@ public class SyncInfoSetContentProviderTest extends TeamTest {
new int[] {
SyncInfo.IN_SYNC,
});
- assertProperVisibleItems();
-
+ assertProperVisibleItems();
}
+ public void testParentRemovalWithChildRemaining() throws CoreException {
+ IProject project = createProject(new String[] { "file.txt", "folder1/file2.txt", "folder1/folder2/file3.txt"});
+ adjustSet(
+ set,
+ project,
+ new String[] { "folder1/folder2/", "folder1/folder2/file3.txt" },
+ new int[] {
+ SyncInfo.CONFLICTING | SyncInfo.CHANGE,
+ SyncInfo.CONFLICTING | SyncInfo.CHANGE});
+ assertProperVisibleItems();
+
+ adjustSet(
+ set,
+ project,
+ new String[] { "folder1/folder2/", "folder1/folder2/file3.txt" },
+ new int[] {
+ SyncInfo.IN_SYNC,
+ SyncInfo.OUTGOING | SyncInfo.CHANGE});
+ assertProperVisibleItems();
+ }
}
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSubscriber.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSubscriber.java
index 0f1129ca7..cda04350e 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSubscriber.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSubscriber.java
@@ -76,7 +76,10 @@ public class TestSubscriber extends TeamSubscriber {
*/
public IComparisonCriteria getDefaultComparisonCriteria() {
return new IComparisonCriteria() {
- public boolean compare(Object e1, Object e2) {
+ public boolean compare(IResource local, ISubscriberResource remote) {
+ return false;
+ }
+ public boolean compare(ISubscriberResource base, ISubscriberResource remote) {
return false;
}
};
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java
index 75812e94c..fa427612b 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java
@@ -29,4 +29,11 @@ public class TestSyncInfo extends SyncInfo {
protected int calculateKind() throws TeamException {
return this.kind;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.SyncInfo#getKind()
+ */
+ public int getKind() {
+ return kind;
+ }
}
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java
index d34ea2fa6..12ef4f43f 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java
@@ -18,7 +18,7 @@ import org.eclipse.team.core.subscribers.SyncInfoSet;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.synchronize.views.CompressedFolderContentProvider;
import org.eclipse.team.ui.synchronize.SyncInfoDiffNode;
-import org.eclipse.team.ui.synchronize.content.SyncInfoDecoratingLabelProvider;
+import org.eclipse.team.ui.synchronize.views.SyncInfoDecoratingLabelProvider;
import org.eclipse.ui.*;
import org.eclipse.ui.part.ViewPart;

Back to the top