Running code when tool window opens

I have a tool window. Is there a way to register a function to be run everytime that window is opened? It displays some data that might be stale everytime the window is opened, I would like to refresh the data everytime the window is opened.

2 comments
Comment actions Permalink

Also, I would like it to be the case that whenever someone presses esc/clicks away from the tool window it dissapears. What is the best way to do this? I found the ToolWindow.setDefaultState method where you can set the ToolWindowType, but i'm not sure which type I should set it to, or if that's even the right way of going about this

0
Comment actions Permalink

see com.intellij.openapi.wm.ex.ToolWindowManagerListener, example can be found in org.jetbrains.idea.maven.navigator.MavenProjectsNavigator#initToolWindow


0

Please sign in to leave a comment.