Skip to content

Commit

Permalink
Apply search results viewer limit to all levels of tree children.
Browse files Browse the repository at this point in the history
Currently viewer limit is applied to top level elements. Object[]
getChildren(Object parentElement) missing limit application.

see #2279
  • Loading branch information
raghucssit committed Sep 17, 2024
1 parent 8d8da43 commit a7a1e23
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,7 @@ public class FileTreeContentProvider implements ITreeContentProvider, IFileSearc

@Override
public Object[] getElements(Object inputElement) {
Object[] children= getChildren(inputElement);
int elementLimit= getElementLimit();
if (elementLimit != -1 && elementLimit < children.length) {
Object[] limitedChildren= new Object[elementLimit];
System.arraycopy(children, 0, limitedChildren, 0, elementLimit);
return limitedChildren;
}
return children;
return getChildren(inputElement);
}

private int getElementLimit() {
Expand Down Expand Up @@ -202,6 +195,14 @@ public Object[] getChildren(Object parentElement) {
Set<Object> children= fChildrenMap.get(parentElement);
if (children == null)
return EMPTY_ARR;

int elementLimit = getElementLimit();
if (elementLimit != -1 && elementLimit < children.size()) {
Object[] limitedChildren = new Object[elementLimit];
System.arraycopy(children.toArray(), 0, limitedChildren, 0, elementLimit);
return limitedChildren;
}

return children.toArray();
}

Expand Down

0 comments on commit a7a1e23

Please sign in to comment.