Alternative to StartupManager.runAfterOpened()
After creating a new project via its Project Wizard, my plugin needs to run some initialization tasks related to the Framework the plugin supports. These tasks however need to wait until the initial import of the project is done and project open has completed. As such, I have been using the `StartupManager.runAfterOpened()` method. However, in v2023.1 this was marked as `@ApiStatus.Internal`.
Similarly, if a user opens an existing project (containing the supported framework), I need to run some initialization tasks, but again, not until the project opening has completed.
What is the alternative/proper way for a plugin to run a task after the opening of the project has completed now that this method is marked for internal use only?
Please sign in to leave a comment.
As per javadoc, use `com.intellij.openapi.startup.StartupActivity` instead
Yann, I forgot to mention in my original post, the recommended `com.intellij.openapi.startup.StartupActivity` is marked as `@Obsolete`. That in turns tells you to use `com.intellij.openapi.startup.ProjectActivity`. That in turn says to reference the docs at https://youtrack.jetbrains.com/articles/IJPL-A-34/Startup-Activity which shows "Article not Found". So it's not clear if the `ProjectActivity` will wait until the project is fully opened before running, or if it runs during the opening activity.
Obsolete API ref: https://plugins.jetbrains.com/docs/intellij/verifying-plugin-compatibility.html#obsolete-api
So it’s still possible to use it if needed.
Regarding
com.intellij.openapi.startup.ProjectActivity
docs: it means "after project is opened". We'll clarify and expand documentation around this soon.