Skip to content

feat(ui): add class tree filter - #2941

Open
tim21-f0 wants to merge 1 commit into
skylot:masterfrom
tim21-f0:class-tree-filter
Open

feat(ui): add class tree filter#2941
tim21-f0 wants to merge 1 commit into
skylot:masterfrom
tim21-f0:class-tree-filter

Conversation

@tim21-f0

@tim21-f0 tim21-f0 commented Aug 26, 2026

Copy link
Copy Markdown

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:

  • Only top level classes are supported (no inner classes)
  • Filters matching a lot of results can affect UI performance so there is a new Preference in the Other section to cap the number of filtered results that will be expanded named Class tree filter expansion limit

Design

A new FilterableTreeModel class subclasses DefaultTreeModel which is used as the tree model in the MainWindow. 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 a nodeStructuredChanged event on the tree model. Subsequently, processing this event in the UI thread expands all of the filtered tree nodes. Access to the FilterableTreeModel nodes, filtered nodes and filter are protected by a ReentrantLock. Testing thus far has not shown any drastic performance hit with Class tree filter expansion limit set to 500 but this can be reduced.

@tim21-f0
tim21-f0 marked this pull request as ready for review August 26, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant