mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
3.1 KiB
3.1 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 is some project opened or not).
See PreloadingActivity.
To register:
<extensions defaultExtensionNs="com.intellij">
<preloadingActivity implementation="com.example.CatPreloadingActivity"/>
</extensions>
Startup Activity
An activity to be executed after project opening.
Executed after project is opened on a background thread with no visible progress indicator and regardless of the current indexing mode. DumbAware is respected currently, but it maybe changed soon.
- 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.
See StartupActivity. Do not forget to implement DumbAware to indicate that activity can be performed not in EDT and during indexing.
There are two extension points:
postStartupActivitybackgroundPostStartupActivityActs aspostStartupActivitybut executed not immediately after project opening, but with 5 seconds delay.
To register:
<extensions defaultExtensionNs="com.intellij">
<postStartupActivity implementation="com.example.CatColoringStartupActivity"/>
</extensions>