Hide empty packages from Project Tree
Hello.
I need to customize project view tree and create a class extended from com.intellij.ide.projectView.impl.ProjectViewPane and override
com.intellij.ide.projectView.impl.ProjectViewPane#createStructure.
All works fine, but the tree still contains packages without files that match the filter. How can I remove or hide them from the tree?
Please sign in to leave a comment.
You can register own `TreeStructureProvider` and implement the `modify` method.
It may process children and remove empty PsiDirectoryNode.
Note, that this approach is very incovenient, because you cannot create new folder to add new file.
See https://youtrack.jetbrains.com/issue/IDEA-25714
Thanks, I will try this method.
Is it possible to add action to hide/show empty directories to Options of ProjectView?
Only if you create and register own AbstractProjectViewPane:
and extend AbstractProjectViewPane#addToolbarActions