3.4 KiB
This document is a more like a draft, that will be finally moved to IntelliJ Platform SDK
Service
Please see Service.
To replace (mock) service in tests, use ServiceContainerUtil.
Preloading Activity
An activity to be executed in background on startup (regardless if some project was opened or not).
See PreloadingActivity.
To register:
<extensions defaultExtensionNs="com.intellij">
<preloadingActivity implementation="com.example.CatPreloadingActivity"/>
</extensions>
Startup Activity
An activity to be executed as part of project opening, on a pooled thread under Loading Project dialog,
after ProjectComponent initializations.
This extension point can be only used by IJ Platform itself.
To register: StartupManager.registerStartupActivity or
<extensions defaultExtensionNs="com.intellij">
<startupActivity implementation="com.example.CatStartupActivity"/>
</extensions>
Post Startup Activity
An activity to be executed after project opening.
If activity implements DumbAware, it is executed after project is opened on a background thread with no visible progress indicator and regardless of the current indexing mode. Otherwise, it is executed on EDT and when indexes are ready.
To register: StartupManager.registerPostStartupActivity or
<extensions defaultExtensionNs="com.intellij">
<postStartupActivity implementation="com.example.CatStartupActivity"/>
</extensions>
See also backgroundPostStartupActivity that acts as postStartupActivity but is executed with 5 seconds delay after project opening.
- Use ProgressManager.run(Task.Backgroundable) to execute work that needs to be visible to users. Including work that consumes CPU over a noticeable period. Using of
Application.executeOnPooledThreadis not needed if you use theProgressManagerAPI. - Use AppUiUtil.invokeLaterIfProjectAlive to execute work that needs to be performed in the UI thread.
- Use DumbService to execute work that requires access to indices.