The CommonViewerSorter has been deprecated in favor of CommonViewerComparator in #3621.
The above PR added additional cases for TreePathViewerComparator in most locations, but here, the existing check for TreePathViewerSorter was replaced with TreePathViewerComparator.
|
@Override |
|
protected Object[] getSortedChildren(Object parentElementOrTreePath) { |
|
Object[] result = null; |
|
ViewerComparator comparator = getComparator(); |
|
if (parentElementOrTreePath != null |
|
&& comparator instanceof TreePathViewerComparator tpvs) { |
|
result = getFilteredChildren(parentElementOrTreePath); |
|
// be sure we're not modifying the original array from the model |
|
result = result.clone(); |
|
|
|
TreePath path = null; |
|
if (parentElementOrTreePath instanceof TreePath) { |
|
path = (TreePath) parentElementOrTreePath; |
|
} else { |
|
Object parent = parentElementOrTreePath; |
|
Widget w = internalGetWidgetToSelect(parent); |
|
if (w != null) { |
|
path = internalGetSorterParentPath(w, comparator); |
|
} |
|
} |
|
tpvs.sort(this, path, result); |
|
result = applyItemsLimit(parentElementOrTreePath, result); |
|
} else { |
|
return super.getSortedChildren(parentElementOrTreePath); |
|
} |
|
return result; |
|
} |
So when using CommonViewerSorter, the above code falls trough to the else case where some default sorting is applied. I think instead of replacing the case for TreePathViewerSorter, the case should have been duplicated for TreePathViewerComparator.
This surfaced as a test-failure in LSP4E (see eclipse-lsp4e/lsp4e#1512), where it was solved by using the new CommonViewerComparator. However, other Plugins still using CommonViewerSorter will be broken on 2026-03+
FYI: @iloveeclipse @akurtakov
Edit: Sorry, meant to post this with my work account (@FlorianKroiss)
The CommonViewerSorter has been deprecated in favor of CommonViewerComparator in #3621.
The above PR added additional cases for TreePathViewerComparator in most locations, but here, the existing check for TreePathViewerSorter was replaced with TreePathViewerComparator.
eclipse.platform.ui/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
Lines 665 to 691 in 9b991c8
So when using CommonViewerSorter, the above code falls trough to the else case where some default sorting is applied. I think instead of replacing the case for TreePathViewerSorter, the case should have been duplicated for TreePathViewerComparator.
This surfaced as a test-failure in LSP4E (see eclipse-lsp4e/lsp4e#1512), where it was solved by using the new CommonViewerComparator. However, other Plugins still using CommonViewerSorter will be broken on 2026-03+
FYI: @iloveeclipse @akurtakov
Edit: Sorry, meant to post this with my work account (@FlorianKroiss)