How to run code before plugin is used?

Answered

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 

0
2 comments

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.

<extensions defaultExtensionNs="com.intellij">
<postStartupActivity implementation="com.MyStartupActivity"/>
</extensions>

 

0
Avatar
Permanently deleted user

Excellent, thanks

0

Please sign in to leave a comment.