How to run code once at project open
已回答
I want to add listener for message, code like
project.getMessageBus().connect().subscribe(Topic<L>, L)
But I want to do it once at project become opened.
Is there a simple way to do that, without singletons, etc?
请先登录再写评论。
See `com.intellij.openapi.startup.StartupActivity` interface.
Note, that activities for "com.intellij.postStartupActivity" ExtensionPoint will be called _during_ project opening. So some things might not be initialised yet (but it's safe to add listeners on message bus).