mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: unify ChangeLists ordering
* sort by name case-insensitive * sort list returned from `CLM.getChangeLists()`
This commit is contained in:
@@ -100,7 +100,7 @@ public abstract class ChangeListColumn<T extends ChangeList> {
|
||||
@Override
|
||||
@NotNull
|
||||
public Comparator<CommittedChangeList> getComparator() {
|
||||
return comparing(ChangeList::getName);
|
||||
return comparing(list -> list.getName(), String::compareToIgnoreCase);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -68,6 +68,10 @@ public class ChangesUtil {
|
||||
}
|
||||
};
|
||||
|
||||
public static final Comparator<LocalChangeList> CHANGELIST_COMPARATOR =
|
||||
Comparator.<LocalChangeList>comparingInt(list -> list.isDefault() ? -1 : 0)
|
||||
.thenComparing(list -> list.getName(), String::compareToIgnoreCase);
|
||||
|
||||
private ChangesUtil() {}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -246,7 +246,9 @@ public class ChangeListWorker {
|
||||
|
||||
@NotNull
|
||||
public List<LocalChangeList> getChangeLists() {
|
||||
return ContainerUtil.map(myLists, this::toChangeList);
|
||||
List<LocalChangeList> lists = ContainerUtil.map(myLists, this::toChangeList);
|
||||
ContainerUtil.sort(lists, ChangesUtil.CHANGELIST_COMPARATOR);
|
||||
return lists;
|
||||
}
|
||||
|
||||
public int getChangeListsNumber() {
|
||||
|
||||
@@ -489,8 +489,7 @@ class PartialLocalLineStatusTracker(project: Project,
|
||||
val group = DefaultActionGroup()
|
||||
if (changeLists.size > 1) {
|
||||
group.add(Separator("Changelists"))
|
||||
val comparator = compareBy<LocalChangeList> { if (it.isDefault) 0 else 1 }.thenBy { it.name }
|
||||
for (changeList in changeLists.sortedWith(comparator)) {
|
||||
for (changeList in changeLists) {
|
||||
group.add(MoveToChangeListAction(editor, range, mousePosition, changeList))
|
||||
}
|
||||
group.add(Separator.getInstance())
|
||||
|
||||
Reference in New Issue
Block a user