Text search by Tree component nodes

Answered

Hello JB team.

In my plugin I have a Tree component which has some nodes, and I'd like to implement search feature by text like when the Tree is focused and user press some key(letter/digits etc), nodes that starts from this text would be are highlited/selected and then user could navigate by them using arrows. It's already implemented in File Structure Intellij Idea component and I wanna get the same, but not sure that I can reuse it. If it's so - please let me know at least where I can find it(didn't find in community sources), if it doesn't, could u please explan at least how to highlight the node names?

1 comment
Comment actions Permalink

Hi,

Please take a look at com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane, especially the fragment:

new MySpeedSearch(myTree);

I recommend using UI Inspector to track down how the existing components are created:
https://plugins.jetbrains.com/docs/intellij/internal-ui-inspector.html

Especially "added-at" property is very helpful for this. I used this approach to track down this component and answer the question.

0

Please sign in to leave a comment.