From adaf34ad7ac007d44b5905a969de86cf554e1db6 Mon Sep 17 00:00:00 2001 From: fedejeanne Date: Tue, 14 Jan 2025 09:18:31 +0100 Subject: [PATCH] Only evaluate expand condition once in AnstractTreeViewer No need to evaluate for every child since the condition applies to the parent item. --- .../src/org/eclipse/jface/viewers/AbstractTreeViewer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java index 0bdc435dea4..585bcc1b7f7 100644 --- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java +++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java @@ -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); } } }