Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-10-02 17:48:56 +0000
committerJean Michel-Lemieux2003-10-02 17:48:56 +0000
commita84da1c43333bea7219e60e0af392ba1b557e24e (patch)
tree6df41343032615990fb23c1528e0a656e8a6eac4
parent5a13e91660c6b044231a8c42f9d4f87874eb20e4 (diff)
downloadeclipse.platform.team-a84da1c43333bea7219e60e0af392ba1b557e24e.tar.gz
eclipse.platform.team-a84da1c43333bea7219e60e0af392ba1b557e24e.tar.xz
eclipse.platform.team-a84da1c43333bea7219e60e0af392ba1b557e24e.zip
Fixed the equals() method to consider local,base, and remote elements of the syncinfo
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java43
1 files changed, 42 insertions, 1 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java
index e35305332..7113f73ca 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SyncInfo.java
@@ -224,11 +224,52 @@ public class SyncInfo implements IAdaptable {
public boolean equals(Object other) {
if(other == this) return true;
if(other instanceof SyncInfo) {
- return getLocal().equals(((SyncInfo)other).getLocal());
+ return equalNodes(this, (SyncInfo)other);
}
return false;
}
+ private boolean equalNodes(SyncInfo node1, SyncInfo node2) {
+ if(node1 == null || node2 == null) {
+ return false;
+ }
+
+ // First, ensure the local resources are equals
+ IResource local1 = null;
+ if (node1.getLocal() != null)
+ local1 = node1.getLocal();
+ IResource local2 = null;
+ if (node2.getLocal() != null)
+ local2 = node2.getLocal();
+ if (!equalObjects(local1, local2)) return false;
+
+ // Next, ensure the base resources are equal
+ IRemoteResource base1 = null;
+ if (node1.getBase() != null)
+ base1 = node1.getBase();
+ IRemoteResource base2 = null;
+ if (node2.getBase() != null)
+ base2 = node2.getBase();
+ if (!equalObjects(base1, base2)) return false;
+
+ // Finally, ensure the remote resources are equal
+ IRemoteResource remote1 = null;
+ if (node1.getRemote() != null)
+ remote1 = node1.getRemote();
+ IRemoteResource remote2 = null;
+ if (node2.getRemote() != null)
+ remote2 = node2.getRemote();
+ if (!equalObjects(remote1, remote2)) return false;
+
+ return true;
+ }
+
+ private boolean equalObjects(Object o1, Object o2) {
+ if (o1 == null && o2 == null) return true;
+ if (o1 == null || o2 == null) return false;
+ return o1.equals(o2);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/

Back to the top