mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
background_processes.md: Add a tip for running backgroundable tasks under a custom progress indicator
This commit is contained in:
parent
20cac10a3a
commit
429e9698b5
@ -43,7 +43,7 @@ The key classes are:
|
||||
|
||||
### Starting
|
||||
|
||||
Background processes encapsulated within `Task` should be run with queueing them.
|
||||
Background processes encapsulated within `Task` can be run with queueing them.
|
||||
Example:
|
||||
|
||||
<tabs group="languages">
|
||||
@ -73,6 +73,14 @@ new Task.Backgroundable(project, "Synchronizing data", true) {
|
||||
</tab>
|
||||
</tabs>
|
||||
|
||||
> To run a backgroundable task under a custom progress indicator, for example, `EmptyProgressIndicator` to hide progress, use:
|
||||
> ```kotlin
|
||||
> ProgressManager.getInstance()
|
||||
> .runProcessWithProgressAsynchronously(
|
||||
> backgroundableTask, EmptyProgressIndicator())
|
||||
> ```
|
||||
> Note that hiding progress from users should be avoided as it may break the UX.
|
||||
|
||||
`ProgressManager` also allows running `Runnable` and `Computable` instances not wrapped within `Task` with several `run*()` methods.
|
||||
Example:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user