Initialize tool window on execution of project
Hey guys,
I'm developing a tool window plugin to display a log. My problem is, the tool window only initializes once I click on it. Instead, how can I have it initialize as soon as a user starts running the project? Pretty much like the built in Run tool window. I'm using the createToolWindowContent method to initialize the tool window.
I used this tutorial to start off on things.
http://www.jetbrains.org/intellij/sdk/docs/user_interface_components/tool_windows.html#how-to-create-a-tool-window
请先登录再写评论。
The current toolwindow initialization behavior is intentionally implemented to achieve optimum performance when the project is loaded. Why do you need to initialize the toolwindow before anyone looks at it?
I'm implementing a customized Log Viewer. Once a project is run, the log output is written to a text file which my log viewer is supposed to read from and display in real-time. Without the tool window being initialized, there's no way for the log viewer to display the output. So my problem is the user has to click on and open the tool window for it to be initialized. For example if the user never opens the log viewer but runs a project, the log viewer will not capture any of the output. So i'm wondering if there is a way to initialize the Tool Window when the user runs the project rather than depending on a them explicitly clicking on and opening it.
Why don't you create a separate component for capturing the log output, initialize it whenever you need to, and use the toolwindow just as the UI to display the output?
ATM when the `createToolWindowContent` is called, a JPanel is built which contains a JTable to display the output and a few other copmponents. The JPanel is then added to the Tool Window component. Then a new thread is created to monitor and update the log table as required. The code structure is shown below.
Is there a better way to tackle this issue? some help would be highly appreciated!
Any updates?