Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-10-04 13:06:33 +0000
committerMichael Valenta2002-10-04 13:06:33 +0000
commit2510a7861195ae5a0fd91c78569f0218c6530a01 (patch)
tree4c267a3a5536417d90bc697538cb6e5e000c013f
parent9c83cc15ef71434a22fff751a89c6c0a0740c5a1 (diff)
downloadeclipse.platform.team-2510a7861195ae5a0fd91c78569f0218c6530a01.tar.gz
eclipse.platform.team-2510a7861195ae5a0fd91c78569f0218c6530a01.tar.xz
eclipse.platform.team-2510a7861195ae5a0fd91c78569f0218c6530a01.zip
19966: [CVS Repo View] Order of versions is inconsistent in Repositories view and Compare/Replace With
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositorySorter.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java43
2 files changed, 31 insertions, 23 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositorySorter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositorySorter.java
index 936419430..e98b8363d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositorySorter.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositorySorter.java
@@ -22,6 +22,9 @@ public class RepositorySorter extends ViewerSorter {
if (element instanceof ICVSRemoteFile) {
return 2;
}
+ if (element instanceof BranchTag) {
+ return 3;
+ }
return 0;
}
@@ -38,6 +41,14 @@ public class RepositorySorter extends ViewerSorter {
if (o1 instanceof ICVSRepositoryLocation && o2 instanceof ICVSRepositoryLocation) {
return ((ICVSRepositoryLocation)o1).getLocation().compareTo(((ICVSRepositoryLocation)o2).getLocation());
}
+ // Sort versions in reverse alphabetical order
+ if (o1 instanceof ICVSRemoteFolder && o2 instanceof ICVSRemoteFolder) {
+ ICVSRemoteFolder f1 = (ICVSRemoteFolder)o1;
+ ICVSRemoteFolder f2 = (ICVSRemoteFolder)o2;
+ if (f1.getName().equals(f2.getName())) {
+ return f2.getTag().compareTo(f1.getTag());
+ }
+ }
return super.compare(viewer, o1, o2);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java
index 3a1848d60..53bf3acc3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java
@@ -28,32 +28,29 @@ public class ProjectElement implements IAdaptable, IWorkbenchAdapter {
public static final int INCLUDE_ALL_TAGS = INCLUDE_HEAD_TAG | INCLUDE_BASE_TAG | INCLUDE_BRANCHES | INCLUDE_VERSIONS;
public static class ProjectElementSorter extends ViewerSorter {
- public boolean isOfInterest(Object o) {
- return (o instanceof TagRootElement) || (o instanceof TagElement);
+ /*
+ * The order in the diaog should be HEAD, Branches, Versions, BASE */
+ public int category(Object element) {
+ if (element instanceof TagElement) {
+ CVSTag tag = ((TagElement)element).getTag();
+ if (tag == CVSTag.DEFAULT) return 1;
+ if (tag == CVSTag.BASE) return 4;
+ if (tag.getType() == CVSTag.BRANCH) return 2;
+ if (tag.getType() == CVSTag.VERSION) return 3;
+ } else if (element instanceof TagRootElement) {
+ return ((TagRootElement)element).getTypeOfTagRoot() == CVSTag.BRANCH ? 2 : 3;
+ }
+ return 0;
}
public int compare(Viewer viewer, Object e1, Object e2) {
- boolean oneIsOfInterest = isOfInterest(e1);
- boolean twoIsOfInterest = isOfInterest(e2);
- if (oneIsOfInterest != twoIsOfInterest) {
- return oneIsOfInterest ? -1 : 1;
- }
- if (!oneIsOfInterest) {
- return super.compare(viewer, e1, e2);
- }
- // Tag elements can occur under branches and versions as well as HEAD and BASE
- if (e1 instanceof TagElement) {
- if (((TagElement)e1).getTag() == CVSTag.DEFAULT) return -1;
- if (((TagElement)e1).getTag() == CVSTag.BASE) return 1;
- }
- if (e2 instanceof TagElement) {
- if (((TagElement)e2).getTag() == CVSTag.DEFAULT) return 1;
- if (((TagElement)e2).getTag() == CVSTag.BASE) return -1;
- }
- if (e1 instanceof TagRootElement && e2 instanceof TagRootElement) {
- return ((TagRootElement)e1).getTypeOfTagRoot() == CVSTag.BRANCH ? -1 : 1;
+ int cat1 = category(e1);
+ int cat2 = category(e2);
+ if (cat1 != cat2) return cat1 - cat2;
+ // Sort version tags in reverse order
+ if (e1 instanceof TagElement && ((TagElement)e1).getTag().getType() == CVSTag.VERSION) {
+ return -1 * super.compare(viewer, e1, e2);
}
- // Sort in reverse order so larger numbered versions are at the top
- return -1 * super.compare(viewer, e1, e2);
+ return super.compare(viewer, e1, e2);
}
}

Back to the top