mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inject coroutine scope into RepositoryLibraryUtils
GitOrigin-RevId: 2f8082dda645638b007e9e7edafeaaaebf652c54
This commit is contained in:
committed by
intellij-monorepo-bot
parent
abcce88702
commit
2e91126d1d
@@ -8,7 +8,6 @@ import com.intellij.ide.actions.ShowStructureSettingsAction
|
||||
import com.intellij.jarRepository.RepositoryLibraryType.REPOSITORY_LIBRARY_KIND
|
||||
import com.intellij.notification.NotificationType
|
||||
import com.intellij.notification.Notifications
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.application.WriteAction
|
||||
@@ -53,7 +52,7 @@ import java.util.concurrent.atomic.AtomicInteger
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
@Service(Service.Level.PROJECT)
|
||||
class RepositoryLibraryUtils(private val project: Project) : Disposable {
|
||||
class RepositoryLibraryUtils(private val project: Project, private val cs: CoroutineScope) {
|
||||
companion object {
|
||||
private val logger = logger<RepositoryLibraryUtils>()
|
||||
|
||||
@@ -73,11 +72,8 @@ class RepositoryLibraryUtils(private val project: Project) : Disposable {
|
||||
private val CoroutineScope.progressSinkOrError: ProgressSink get() = requireNotNull(progressSink)
|
||||
}
|
||||
|
||||
private val defaultCoroutineScope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||
private var testCoroutineScope: CoroutineScope? = null
|
||||
private val myCoroutineScope: CoroutineScope get() = testCoroutineScope ?: defaultCoroutineScope
|
||||
|
||||
override fun dispose() = defaultCoroutineScope.cancel()
|
||||
private val myCoroutineScope: CoroutineScope get() = testCoroutineScope ?: cs
|
||||
|
||||
/**
|
||||
* Should be used only in tests. Required to promote errors to tests via [testScope].
|
||||
|
||||
Reference in New Issue
Block a user