How can i run some code when a ToolWindow activates

I'd like to initialize the content of a toolwindow when toolwindowmanager activates it but can't find a way to do it....

Does anyone can help please ?

3 comments
Comment actions Permalink

� wrote:

I'd like to initialize the content of a toolwindow when toolwindowmanager activates it but can't find a way to do it....

Does anyone can help please ?


It doesn't look like there's an OpenAPI available for that. However there's the
ToolWindowManagerEx interface in idea.jar that can register ToolWindowManagerListeners.
Maybe this could help.

It might also be possible by attaching a ComponentListener to the ToolWindow's Component
and listening to the componentXXXX() events. Good luck ;)

Sascha

0
Comment actions Permalink

�

>I'd like to initialize the content of a toolwindow when toolwindowmanager activates it but can't find a way to do it....

>

I've used this with success to ensure that the toolwindow contents is
initialized:

mainPanel.addAncestorListener (new AncestorListener()
{
public final void ancestorAdded (AncestorEvent event) {
doWhenPanelShowsUp ();
}
void doWhenPanelShowsUp () {
if ( ! __isLogin) {
...
__isLogin = true;
}
}
public final void ancestorRemoved (AncestorEvent event) { }
public final void ancestorMoved (AncestorEvent event) { }
});


0
Comment actions Permalink

Thank you Sascha and Alain.

I'll try Alain's way since it won't force me to use something not in openapi...

0

Please sign in to leave a comment.