Skip to content

Commit

Permalink
Only evaluate expand condition once in AnstractTreeViewer
Browse files Browse the repository at this point in the history
No need to evaluate for every child since the condition applies to the
parent item.
  • Loading branch information
fedejeanne committed Jan 14, 2025
1 parent 7308b62 commit 323f82d
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1862,13 +1862,11 @@ private void internalConditionalExpandToLevel(Widget widget, int level,
}
if (level == ALL_LEVELS || level > 1) {
Item[] children = getChildren(widget);
if (children != null) {
if (children != null && shouldChildrenExpand.apply(widget).booleanValue()) {
int newLevel = (level == ALL_LEVELS ? ALL_LEVELS
: level - 1);
for (Item element : children) {
if (shouldChildrenExpand.apply(widget).booleanValue()) {
internalConditionalExpandToLevel(element, newLevel, shouldChildrenExpand);
}
internalConditionalExpandToLevel(element, newLevel, shouldChildrenExpand);
}
}
}
Expand Down

0 comments on commit 323f82d

Please sign in to comment.