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?

1 comment

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).


Please sign in to leave a comment.