Skip to content

Commit a1153d0

Browse files
committed
Expandable node is shown at wrong place, sorting broken after expand
If items limit is enabled, clicking on expandable element adds all elements **before** the node, so the sort order is totally wrong and "expandable node" appears "in the middle" of the siblings. However, "hidden and now expanded" elements (if exists) should always be appended **to the end** of the shown children. This is a regression from 5930a51 / #1331. The problem with the patch above is that it inserts all previously hidden elements at the zero index in the tree, but the tree **has already some children**, so instead of adding new elements below existing, the patch prepends them. Since #1331 consists of only two changes (changed tree item creation order on expand and updated javadoc), this is revert the former one. Fixes #1417
1 parent ac14157 commit a1153d0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1151,9 +1151,8 @@ void handleExpandableNodeClicked(Widget w) {
11511151
item.dispose();
11521152

11531153
// create children on parent
1154-
// For performance insert every item at index 0 (in reverse order):
1155-
for (int i = children.length - 1; i >= 0; i--) {
1156-
createTreeItem(parent, children[i], 0);
1154+
for (Object element : children) {
1155+
createTreeItem(parent, element, -1);
11571156
}
11581157

11591158
// reset the selection. client's selection listener should not be triggered.

0 commit comments

Comments
 (0)