diff --git a/topics/basics/plugin_structure/plugin_components.md b/topics/basics/plugin_structure/plugin_components.md index bcad4b956..b8907c073 100644 --- a/topics/basics/plugin_structure/plugin_components.md +++ b/topics/basics/plugin_structure/plugin_components.md @@ -43,20 +43,34 @@ See also [Running Tasks Once](ide_infrastructure.md#running-tasks-once). ### Project Open + + + + +Using [Kotlin](using_kotlin.md), implement [`ProjectActivity`](%gh-ic%/platform/core-api/src/com/intellij/openapi/startup/StartupActivity.kt) and register in `com.intellij.postStartupActivity` extension point. + + + + + To execute code when a project is being opened, use one of these two [extensions](plugin_extensions.md): -#### `com.intellij.postStartupActivity` -[`StartupActivity`](%gh-ic%/platform/core-api/src/com/intellij/openapi/startup/StartupActivity.kt) for immediate execution on EDT. +`com.intellij.postStartupActivity` +: [`StartupActivity`](%gh-ic%/platform/core-api/src/com/intellij/openapi/startup/StartupActivity.kt) for immediate execution on EDT. Implement `DumbAware` to indicate activity can run in background thread (in parallel with other such tasks). -#### `com.intellij.backgroundPostStartupActivity` -[`StartupActivity.Background`](%gh-ic%/platform/core-api/src/com/intellij/openapi/startup/StartupActivity.kt) for execution with 5 seconds delay in background thread (2019.3 or later). +`com.intellij.backgroundPostStartupActivity` +: [`StartupActivity.Background`](%gh-ic%/platform/core-api/src/com/intellij/openapi/startup/StartupActivity.kt) for execution with 5 seconds delay in background thread (2019.3 or later). Any long-running or CPU intensive tasks should be made visible to users by using `ProgressManager.run(Task.Backgroundable)`. Access to indices must be wrapped with `DumbService`, see also [General Threading Rules](general_threading_rules.md). See also [](ide_infrastructure.md#running-tasks-once). + + + + ### Project and Application Close To execute code on project closing or application shutdown, implement the [`Disposable`](%gh-ic%/platform/util/src/com/intellij/openapi/Disposable.java) interface in a [Service](plugin_services.md) and place the code in the `dispose()` method.