How to automatically open a 'Tool Window' used as a custom console view when launching a action

Answered

Hello,

I created a custom "ToolWindow" registered in plugin.xml:

<toolWindow id="My Console"
anchor="bottom"
factoryClass="com.user.intellij.utils.CustomToolWindowFactory">
</toolWindow>

This custom 'ToolWindow' acts as a console view used to display the result (in live) of a non blocking action.

It works perfectly (info, error, warning logs are well displayed), but only if the custom "Window Tool" was opened manually.

Once this view is open, I can manually close it or remove it from slide bar, and programmatically open it again once my action is launched using the following code:

CustomToolWindowFactory.aToolWindow?.let {
if (!it.isActive) {
it.activate(null, false)
} else if (!it.isVisible) {
it.show(null)
}
}

My issue is that I've not found how to automatically open it:

- the first time Intellij is open after this extension has been created

- when Intellij starts again and this "Window Tool" was closed in previous session

I always needs to open it manually.

Can you please help me on this topic?

Thanks a lot in advance.

4 comments
Comment actions Permalink

Did you try using ProjectManagerListener?? I haven't tried it before but, you can try using its projectOpened() method.

0
Comment actions Permalink

Hello Safeuq,

Thanks a lot for this solution, which works for me :-)

0
Comment actions Permalink

Thanks a lot Yann. I'll have a look to this other solution.

0

Please sign in to leave a comment.