Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-05-30 21:39:10 +0000
committerMichael Valenta2002-05-30 21:39:10 +0000
commitc878dd64952e4d271af636727218ab9bf11a382f (patch)
treed330b09b61ac12879b8a256301a74a13c0fddcfa
parenteddb5ed75de813164f2340e03fca5d709d7a9a1d (diff)
downloadeclipse.platform.team-c878dd64952e4d271af636727218ab9bf11a382f.tar.gz
eclipse.platform.team-c878dd64952e4d271af636727218ab9bf11a382f.tar.xz
eclipse.platform.team-c878dd64952e4d271af636727218ab9bf11a382f.zip
18273: Tag configuration's 'Browse files for tags' pane is unsorted
18275: Version sort order is inconsistent
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java27
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java3
2 files changed, 18 insertions, 12 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java
index 6c8d326d6..44e5698d2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java
@@ -60,6 +60,7 @@ import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.merge.ProjectElement;
import org.eclipse.team.internal.ccvs.ui.merge.TagElement;
+import org.eclipse.team.internal.ccvs.ui.merge.ProjectElement.ProjectElementSorter;
import org.eclipse.team.internal.ccvs.ui.model.CVSFileElement;
import org.eclipse.team.internal.ccvs.ui.model.CVSFolderElement;
import org.eclipse.team.internal.ccvs.ui.model.CVSRootFolderElement;
@@ -116,6 +117,17 @@ public class TagConfigurationDialog extends Dialog {
// dialogs settings that are persistent between workbench sessions
private IDialogSettings settings;
+ class FileSorter extends ViewerSorter {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ boolean oneIsFile = e1 instanceof CVSFileElement;
+ boolean twoIsFile = e2 instanceof CVSFileElement;
+ if (oneIsFile != twoIsFile) {
+ return oneIsFile ? 1 : -1;
+ }
+ return super.compare(viewer, e1, e2);
+ }
+ }
+
public TagConfigurationDialog(Shell shell, ICVSFolder[] roots) {
super(shell);
setShellStyle(SWT.CLOSE|SWT.RESIZE);
@@ -188,7 +200,7 @@ public class TagConfigurationDialog extends Dialog {
} else {
cvsResourceTree.setInput(new CVSRootFolderElement(roots));
}
-
+ cvsResourceTree.setSorter(new FileSorter());
cvsResourceTree.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
updateShownTags();
@@ -223,8 +235,9 @@ public class TagConfigurationDialog extends Dialog {
int type1 = tag1.getType();
int type2 = tag2.getType();
if (type1 != type2) {
- return type2 - type1;
+ return type1 - type2;
}
+ // Sort in reverse order so larger numbered versions are at the top
return -tag1.compareTo(tag2);
}
});
@@ -263,15 +276,7 @@ public class TagConfigurationDialog extends Dialog {
updateEnablements();
}
});
- cvsDefinedTagsTree.setSorter(new ViewerSorter() {
- public int compare(Viewer v, Object o1, Object o2) {
- int result = super.compare(v, o1, o2);
- if (o1 instanceof TagElement && o2 instanceof TagElement) {
- return -result;
- }
- return result;
- }
- });
+ cvsDefinedTagsTree.setSorter(new ProjectElementSorter());
Composite buttonComposite = new Composite(rememberedTags, SWT.NONE);
data = new GridData ();
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 bbdd16e8f..3a1848d60 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
@@ -52,7 +52,8 @@ public class ProjectElement implements IAdaptable, IWorkbenchAdapter {
if (e1 instanceof TagRootElement && e2 instanceof TagRootElement) {
return ((TagRootElement)e1).getTypeOfTagRoot() == CVSTag.BRANCH ? -1 : 1;
}
- return super.compare(viewer, e1, e2);
+ // Sort in reverse order so larger numbered versions are at the top
+ return -1 * super.compare(viewer, e1, e2);
}
}

Back to the top