Appearance
Preloading Activity
An activity to be executed in background on startup (regardless if some project was opened or not).
See consulo.application.PreloadingActivity.
To register, annotate the implementation class with @ExtensionImpl:
java
@ExtensionImpl
public class CatPreloadingActivity extends PreloadingActivity {
// ...
}Startup Activity
An activity to be executed as part of project opening, under 'Loading Project' dialog. Can't be registered by plugins.
To register: StartupManager.registerStartupActivity or annotate the implementation class with @ExtensionImpl:
java
@ExtensionImpl
public class CatStartupActivity implements StartupActivity {
// ...
}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 annotate the implementation class with @ExtensionImpl:
java
@ExtensionImpl
public class CatStartupActivity implements PostStartupActivity {
// ...
}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 ofApplication.executeOnPooledThreadis not needed if you use theProgressManagerAPI. - To execute work in the UI thread, use the application's
invokeLatermethods with a project-alive condition. - Use
DumbServiceto execute work that requires access to indices.