From bb5eefd18dca278d196ab504908adf2b8a9d1052 Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Wed, 9 Apr 2025 12:11:08 +0200 Subject: [PATCH] improve docs of `launchOnShow`/`launchOnceOnShow` GitOrigin-RevId: e6cb14dad9e37e02e93cb585591dfad24ec9fb30 --- platform/ide-core/src/com/intellij/util/ui/uiScope.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/platform/ide-core/src/com/intellij/util/ui/uiScope.kt b/platform/ide-core/src/com/intellij/util/ui/uiScope.kt index ef39dbc3fb66..cd7f73511909 100644 --- a/platform/ide-core/src/com/intellij/util/ui/uiScope.kt +++ b/platform/ide-core/src/com/intellij/util/ui/uiScope.kt @@ -27,13 +27,12 @@ import kotlin.coroutines.EmptyCoroutineContext * and cancels the coroutine when the UI component is hidden. * In particular, the component becomes hidden when it's removed from the hierarchy. * - * The [block] may be executed at most one time. * The [block] is executed with the modality state of the [component][this]. * This means that the [block] execution might happen in a different EDT event, * because it has to wait for the proper modality. * - * Cancellation of the returned Job brings back the state before calling this function, - * for instance, the Swing listener is removed. + * The [block] may be executed at most **one time**. + * It will not be restarted if canceled by the component becoming hidden. * * @param debugName name to use as [CoroutineName] * @param context additional context of the coroutine. @@ -77,12 +76,11 @@ fun C.launchOnceOnShow( * The [block] is executed with the modality state of the [component][this]. * This means that the [block] execution might happen in a different EDT event, * because it has to wait for the proper modality. + * * The [block] may be executed several times, and the next execution of [block] will start after the previous [block] completes. * This also means that the next [block] execution might happen in a different EDT event, - * because it has to [wait for the completion][Job.join] of a previously scheduled one. + * because it has to [wait for the completion][Job.join] of a previously scheduled [block]. * - * Cancellation of the returned Job brings back the state before calling this function, - * for instance, the Swing listener is removed. * Exceptions from the [block] don't cancel the returned Job. * If [block] throws an exception, it will be re-launched the next time the component becomes showing. *