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.

6 comments
Official 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()

0

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.

0

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.

0

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?

0

Please sign in to leave a comment.