How to run code before plugin is used?
已回答
Hi,
I'm developing a plugin and I would like to run some code, before the IDE can be used, while it is launching or something. For example, I currently use the ToolWindowFactory class of one of my tool windows, however I understand that this code will not be executed until the tool window is opened. Therefore, my question is how can I ensure some code is executed before the user can use any of the IDE?
Any tips are appreciated.
Thanks,
Alex
请先登录再写评论。
You can register an application component and override `com.intellij.openapi.components.BaseComponent#initComponent`:
https://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_components.html
Or register `com.intellij.openapi.startup.StartupActivity` that will be executed for each Project opened.
Excellent, thanks