feat(ui): add class tree filter - #2941
Conversation
|
I commit several changes to this PR:
@tim21-f0 and @jpstotz it will be nice if someone test and maybe review this PR, I may miss something 🙂 |
|
From a user perspective the tree filter is really nice. I think most users will use it instead of the Class filter from the search dialog. And searching for resources like I have tested it using a very large APK file with next to 40k entries and experienced no speed issues. I only see some minor improvements that could be implemented:
|
|
I commit a lazy expand only for visible nodes (updates on scroll).
Sure, nice suggestion 👍 |
|
@skylot The lazy implementation seem to work in general but if there are too many results I managed to freeze Jadx-gui UI for multiple minutes. I loaded an older Snapchat version which has 8 dex files and a lot of resources and then searched for May be this was caused by the classes below the defpackage node. According to the old search dialog there are ~67k classes that contains |
|
Another batch of changes:
@jpstotz thanks for help in testing 👍 |
Summary
This change augments the existing resource tree pane on the left with a filter box at the top. Typing a string into the box will restrict the display of the tree to classes that match the given string, and fully expand the tree to show all such classes. Additionally there is a 'clear filter button' to the right which when clicked clears the filter and resets the tree to have no expanded results.
There are some caveats:
Othersection to cap the number of filtered results that will be expanded namedClass tree filter expansion limitDesign
A new
FilterableTreeModelclass subclassesDefaultTreeModelwhich is used as the tree model in theMainWindow. When the user types or removes a character from the filter box a task delayed by 400ms is created. If a new task is created any previous created task will be cancelled to ensure that the filter logic only fires once the user has stopped typing for 400ms. This task computes the filtered tree nodes in a background task which then issues anodeStructuredChangedevent on the tree model. Subsequently, processing this event in the UI thread expands all of the filtered tree nodes. Access to theFilterableTreeModelnodes, filtered nodes and filter are protected by aReentrantLock. Testing thus far has not shown any drastic performance hit withClass tree filter expansion limitset to 500 but this can be reduced.