Skip to content

Commit 5c09859

Browse files
committed
Overload method AbstractTreeViewer::internalConditionalExpandToLevel
1 parent 323f82d commit 5c09859

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

bundles/org.eclipse.jface/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.jface;singleton:=true
5-
Bundle-Version: 3.36.0.qualifier
5+
Bundle-Version: 3.37.0.qualifier
66
Bundle-Vendor: %providerName
77
Bundle-Localization: plugin
88
Export-Package: org.eclipse.jface,

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,6 +1850,19 @@ protected Widget internalGetWidgetToSelect(Object elementOrTreePath) {
18501850
*/
18511851
private void internalConditionalExpandToLevel(Widget widget, int level,
18521852
Function<Widget, Boolean> shouldChildrenExpand) {
1853+
internalConditionalExpandToLevel(widget, level, __ -> Boolean.TRUE, shouldChildrenExpand);
1854+
}
1855+
1856+
/**
1857+
* Same as
1858+
* {@link #internalConditionalExpandToLevel(Widget, int, Function, Function)}i
1859+
*
1860+
* @param shouldWidgetExpand evaluates if the widget itself needs to be
1861+
* expanded.
1862+
* @since 3.37
1863+
*/
1864+
protected void internalConditionalExpandToLevel(Widget widget, int level,
1865+
Function<Widget, Boolean> shouldWidgetExpand, Function<Widget, Boolean> shouldChildrenExpand) {
18531866
if (level == ALL_LEVELS || level > 0) {
18541867
Object data = widget.getData();
18551868
if (widget instanceof Item it && data != null && !isExpandable(it, null, data)) {
@@ -1858,6 +1871,10 @@ private void internalConditionalExpandToLevel(Widget widget, int level,
18581871
createChildren(widget, false);
18591872
// XXX for performance widget should be expanded after expanding children:
18601873
if (widget instanceof Item it) {
1874+
if (!shouldWidgetExpand.apply(widget).booleanValue()) {
1875+
return;
1876+
}
1877+
18611878
setExpanded(it, true);
18621879
}
18631880
if (level == ALL_LEVELS || level > 1) {

0 commit comments

Comments
 (0)