ToolWindow listener
Hi, I'm developing plugin with using ToolWindowFactory and I would like to check if user was logged in or not by using settings, so depends on it if he is logged in show toolwindow with full content, if not show another content, something like - JPanel with text "You are not logged in yet, check your settings".
How can I do that ?
Thanks,
Aleksandr.
Please sign in to leave a comment.
You can do it just like with any other Swing component. For example, place a JPanel with a CardLayout inside your ToolWindow, add a listener to your settings and show the needed card as needed.
Thnaks @Peter
but, what kind of listener can use for it ? And I still can't get how in this case toolWindow now that need to rerender panel.
I was trying to use ComponentListener but it doesn't work in case when I click on toolwindow button on panel to hide and unhide it. It only works when I trying to resize toolwindow ( I mean Jcomponent in it)
Maybe somewhere exists listener that refreshes toolwindow like we have AnAction.update()
A listener for user's logged-in status, nothing to do with toolwindows or Swing or UI. The toolwindow content should be refreshed automatically if you perform Swing hierarchy changes inside in response to your listener's events.
Are you talking about custom listener or native provided by intellij idea openAPI ?
If you can post ab example here, this will be super )
Thx.
I was talking about a listener you fully write yourself for the user log-in process. Because I don't know what you mean by "if user was logged in or not". I presume it's something specific to your plugin, and IDEA platform has nothing to do with it. Am I mistaken?
You are right, thx
I am developing an Android Studio Plugin, I have added a new ToolWindowFactory at the right side of Android Studio. Now I want to listen for click events on this toolbar(listening to the Window show and hide),how can I do this?
Chentao Zhou see com.intellij.openapi.wm.ex.ToolWindowManagerListener topic