mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[RUBY-4423] Rails view: Logical sorting in db/migrate folder
This commit is contained in:
@@ -165,11 +165,32 @@ public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* When nodes are sorted by type all objects with same weigh will be sorted using
|
||||
* some common algorithm (e.g alpha comparator). This method allows to perform custom
|
||||
* sorting for such objects. And default comparison will be applied only if nodes are equal
|
||||
* from custom comparator's point of view. Also comparison will be applied only if both objects
|
||||
* have not null comparable keys.
|
||||
* @return Comparable object.
|
||||
*/
|
||||
@Nullable
|
||||
public Comparable getTypeSortKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* When nodes aren't sorted by type all objects with same weigh will be sorted using
|
||||
* some common algorithm (e.g alpha comparator). This method allows to perform custom
|
||||
* sorting for such objects. And default comparison will be applied only if nodes are equal
|
||||
* from custom comparator's point of view. Also comparison will be applied only if both objects
|
||||
* have not null comparable keys.
|
||||
* @return Comparable object.
|
||||
*/
|
||||
@Nullable
|
||||
public Comparable getSortKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getQualifiedNameSortKey() {
|
||||
return null;
|
||||
|
||||
+10
-3
@@ -58,10 +58,17 @@ public class GroupByTypeComparator implements Comparator<NodeDescriptor> {
|
||||
}
|
||||
|
||||
if (isSortByType()) {
|
||||
Comparable typeSortKey1 = node1.getTypeSortKey();
|
||||
Comparable typeSortKey2 = node2.getTypeSortKey();
|
||||
final Comparable typeSortKey1 = node1.getTypeSortKey();
|
||||
final Comparable typeSortKey2 = node2.getTypeSortKey();
|
||||
if (typeSortKey1 != null && typeSortKey2 != null) {
|
||||
int result = typeSortKey1.compareTo(typeSortKey2);
|
||||
final int result = typeSortKey1.compareTo(typeSortKey2);
|
||||
if (result != 0) return result;
|
||||
}
|
||||
} else {
|
||||
final Comparable typeSortKey1 = node1.getSortKey();
|
||||
final Comparable typeSortKey2 = node2.getSortKey();
|
||||
if (typeSortKey1 != null && typeSortKey2 != null) {
|
||||
final int result = typeSortKey1.compareTo(typeSortKey2);
|
||||
if (result != 0) return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user