Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-02-26 22:11:28 +0000
committerJean Michel-Lemieux2004-02-26 22:11:28 +0000
commit0461d9139d4d407c119ef3d35a20a990a787dcf9 (patch)
treef72ec784170ff2eecec7d161ed271c2b2eefa0fc
parentb63e4ac2365b71a0bb896e7a814e4ab596af4457 (diff)
downloadeclipse.platform.team-0461d9139d4d407c119ef3d35a20a990a787dcf9.tar.gz
eclipse.platform.team-0461d9139d4d407c119ef3d35a20a990a787dcf9.tar.xz
eclipse.platform.team-0461d9139d4d407c119ef3d35a20a990a787dcf9.zip
Added equal() checks to compare and merge subscribers
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java11
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java40
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java8
3 files changed, 37 insertions, 22 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
index ae44bfb18..0304616c8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java
@@ -32,6 +32,7 @@ import org.eclipse.team.internal.core.subscribers.caches.SessionResourceVariantB
*/
public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubscriberChangeListener {
+ public static final String ID = "org.eclipse.team.cvs.ui.compare-participant";
public static final String QUALIFIED_NAME = CVSProviderPlugin.ID + ".compare"; //$NON-NLS-1$
private static final String UNIQUE_ID_PREFIX = "compare-"; //$NON-NLS-1$
@@ -182,4 +183,14 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs
protected boolean getCacheFileContentsHint() {
return true;
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object other) {
+ if(this == other) return true;
+ if(! (other instanceof CVSCompareSubscriber)) return false;
+ CVSCompareSubscriber s = (CVSCompareSubscriber)other;
+ return getRemoteTag().equals(s.getRemoteTag()) && rootsEqual(s);
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
index 6a38ff1c1..abac029de 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
@@ -10,36 +10,21 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.core;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ISubscriberChangeEvent;
-import org.eclipse.team.core.subscribers.ISubscriberChangeListener;
-import org.eclipse.team.core.subscribers.SubscriberChangeEvent;
-import org.eclipse.team.core.synchronize.IResourceVariant;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoFilter;
+import org.eclipse.team.core.subscribers.*;
+import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
-import org.eclipse.team.internal.ccvs.core.syncinfo.CVSResourceVariantTree;
+import org.eclipse.team.internal.ccvs.core.syncinfo.CVSSynchronizationCache;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.Util;
+import org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore;
import org.eclipse.team.internal.core.subscribers.caches.PersistantResourceVariantByteStore;
-import org.eclipse.team.internal.core.subscribers.caches.ResourceVariantTree;
/**
* A CVSMergeSubscriber is responsible for maintaining the remote trees for a merge into
@@ -364,4 +349,15 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
private PersistantResourceVariantByteStore getBaseByteStore() {
return (PersistantResourceVariantByteStore)((CVSResourceVariantTree)getBaseTree()).getByteStore();
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object other) {
+ if(this == other) return true;
+ if(! (other instanceof CVSMergeSubscriber)) return false;
+ CVSMergeSubscriber s = (CVSMergeSubscriber)other;
+ return getRemoteTag().equals(s.getRemoteTag()) &&
+ getBaseTag().equals(s.getBaseTag()) && rootsEqual(s);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java
index fe1865d48..9bcba4395 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncTreeSubscriber.java
@@ -28,6 +28,7 @@ import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.subscribers.SubscriberChangeEvent;
import org.eclipse.team.core.synchronize.IResourceVariant;
import org.eclipse.team.core.synchronize.IResourceVariantComparator;
@@ -295,4 +296,11 @@ public abstract class CVSSyncTreeSubscriber extends SyncTreeSubscriber {
}
return members;
}
+
+ protected boolean rootsEqual(Subscriber other) {
+ Set roots1 = new HashSet(Arrays.asList(other.roots()));
+ Set roots2 = new HashSet(Arrays.asList(roots()));
+ if(roots1.size() != roots2.size()) return false;
+ return roots2.containsAll(roots1);
+ }
}

Back to the top