Search code examples
javadebuggingintellij-plugin

Where is IntelliJ IDEA's File Structure action implemented?


I'm writing an IntelliJ plugin, and I've somehow broken the file structure navigation (Ctrl+F12). I want to debug the navigation action, but I can't find where it's implemented.

More generally, how do I step through the code that runs when I choose a command from the menu in IntelliJ?


Solution

  • After a lot of searching and debugging, I found the code that runs when you select an item from the file structure. It's in PyStructureViewElement.navigate().

    Once I found that, I was able to walk up the stack to ActionUtil.performActionDumbAware(). That's a good place to put a breakpoint when you want to find the code for some other menu item or command. Then you can either look at the class of the action object or step into action.actionPerformed(). I found that sometimes, I had to set a pass count on the breakpoint so it didn't break until I got the action I was interested in.