Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply search results viewer limit to all levels of tree children. #2280

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.eclipse.search/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.search; singleton:=true
Bundle-Version: 3.16.300.qualifier
Bundle-Version: 3.16.400.qualifier
Bundle-Activator: org.eclipse.search.internal.ui.SearchPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ OpenSearchPreferencesAction_label=Preferences...
OpenSearchPreferencesAction_tooltip=Open Search Preference Page
MatchFilterSelectionDialog_filter_description=Select the &matches to exclude from the search results:
MatchFilterSelectionDialog_description_label=Filter description:
MatchFilterSelectionDialog_limit_description=&Limit number of top level elements to:
MatchFilterSelectionDialog_limit_description=&Limit number of elements per level to:
MatchFilterSelectionDialog_label=Search Filters
MatchFilterSelectionDialog_error_invalid_limit=Element limit must be a positive number.
MatchFilterSelectionAction_label=&Filters...
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();
raghucssit marked this conversation as resolved.
Show resolved Hide resolved
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
Loading