mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-160390 Rename TaskSuspendable to TaskSuspension
GitOrigin-RevId: 9bedbfaf879f918db7d7dc88a722bd69e6ce258e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e77ad3acff
commit
ec3e5d135c
+4
-4
@@ -31,7 +31,7 @@ import com.intellij.openapi.wm.ex.WindowManagerEx
|
||||
import com.intellij.openapi.wm.impl.status.IdeStatusBarImpl
|
||||
import com.intellij.platform.diagnostic.telemetry.TelemetryManager
|
||||
import com.intellij.platform.ide.progress.*
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspendable
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspension
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspender
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspenderElementKey
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspenderImpl
|
||||
@@ -129,10 +129,10 @@ class PlatformTaskSupport(private val cs: CoroutineScope) : TaskSupport {
|
||||
}
|
||||
}
|
||||
|
||||
private fun TaskSuspender?.getSuspendableInfo(): TaskSuspendable {
|
||||
private fun TaskSuspender?.getSuspendableInfo(): TaskSuspension {
|
||||
return when (this) {
|
||||
is TaskSuspenderImpl -> TaskSuspendable.Suspendable(defaultSuspendedReason)
|
||||
else -> TaskSuspendable.NonSuspendable
|
||||
is TaskSuspenderImpl -> TaskSuspension.Suspendable(defaultSuspendedReason)
|
||||
else -> TaskSuspension.NonSuspendable
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.platform.ide.progress
|
||||
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspendable
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspension
|
||||
import com.intellij.platform.project.ProjectEntity
|
||||
import com.intellij.platform.project.asProject
|
||||
import com.intellij.platform.project.asProjectOrNull
|
||||
@@ -47,10 +47,10 @@ data class TaskInfoEntity(override val eid: EID) : Entity {
|
||||
*
|
||||
* Possible values are:
|
||||
*
|
||||
* - [TaskSuspendable.NonSuspendable]: The task cannot be suspended, and no pause button should be displayed in the UI.
|
||||
* - [TaskSuspendable.Suspendable]: The task can be suspended, and a pause button should be displayed
|
||||
* - [TaskSuspension.NonSuspendable]: The task cannot be suspended, and no pause button should be displayed in the UI.
|
||||
* - [TaskSuspension.Suspendable]: The task can be suspended, and a pause button should be displayed
|
||||
*/
|
||||
val suspendable: TaskSuspendable by TaskSuspendableType
|
||||
val suspendable: TaskSuspension by TaskSuspendableType
|
||||
|
||||
/**
|
||||
* Represents the current progress state of the task.
|
||||
@@ -90,7 +90,7 @@ data class TaskInfoEntity(override val eid: EID) : Entity {
|
||||
) {
|
||||
val TitleType: Required<String> = requiredValue("title", String.serializer())
|
||||
val TaskCancellationType: Required<TaskCancellation> = requiredValue("taskCancellation", TaskCancellation.serializer())
|
||||
val TaskSuspendableType: Required<TaskSuspendable> = requiredValue("isSuspendable", TaskSuspendable.serializer())
|
||||
val TaskSuspendableType: Required<TaskSuspension> = requiredValue("isSuspendable", TaskSuspension.serializer())
|
||||
val ProgressStateType: Optional<ProgressState> = optionalValue("progressState", ProgressState.serializer())
|
||||
val TaskStatusType: Required<TaskStatus> = requiredValue("taskStatus", TaskStatus.serializer())
|
||||
val ProjectEntityType: Optional<ProjectEntity> = optionalRef<ProjectEntity>("project", RefFlags.CASCADE_DELETE_BY)
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.platform.ide.progress
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.diagnostic.trace
|
||||
import com.intellij.openapi.util.NlsContexts.ProgressText
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspendable
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspension
|
||||
import com.intellij.platform.kernel.withKernel
|
||||
import fleet.kernel.*
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
@@ -45,7 +45,7 @@ object TaskManager {
|
||||
*/
|
||||
suspend fun pauseTask(taskInfoEntity: TaskInfoEntity, reason: @ProgressText String? = null, source: TaskStatus.Source): Unit = withKernel {
|
||||
tryWithEntities(taskInfoEntity) {
|
||||
if (taskInfoEntity.suspendable is TaskSuspendable.NonSuspendable) {
|
||||
if (taskInfoEntity.suspendable is TaskSuspension.NonSuspendable) {
|
||||
LOG.error("Task ${taskInfoEntity.eid} is not suspendable")
|
||||
return@tryWithEntities
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.platform.ide.progress
|
||||
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspendable
|
||||
import com.intellij.platform.ide.progress.suspender.TaskSuspension
|
||||
import com.intellij.platform.kernel.withKernel
|
||||
import com.intellij.platform.project.asEntity
|
||||
import com.intellij.platform.util.progress.ProgressState
|
||||
@@ -33,7 +33,7 @@ abstract class TaskStorage {
|
||||
project: Project,
|
||||
title: String,
|
||||
cancellation: TaskCancellation,
|
||||
suspendable: TaskSuspendable,
|
||||
suspendable: TaskSuspension,
|
||||
): TaskInfoEntity {
|
||||
var taskInfoEntity: TaskInfoEntity? = null
|
||||
try {
|
||||
|
||||
+3
-3
@@ -10,13 +10,13 @@ import org.jetbrains.annotations.ApiStatus
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
@Serializable
|
||||
sealed interface TaskSuspendable {
|
||||
sealed interface TaskSuspension {
|
||||
|
||||
/**
|
||||
* This object indicates that a task cannot be paused.
|
||||
*/
|
||||
@Serializable
|
||||
object NonSuspendable : TaskSuspendable
|
||||
object NonSuspendable : TaskSuspension
|
||||
|
||||
/**
|
||||
* Represents a suspendable task, which can be paused and resumed.
|
||||
@@ -25,5 +25,5 @@ sealed interface TaskSuspendable {
|
||||
* which is displayed in the progress bar.
|
||||
*/
|
||||
@Serializable
|
||||
data class Suspendable(@NlsContexts.ProgressText val suspendText: String) : TaskSuspendable
|
||||
data class Suspendable(@NlsContexts.ProgressText val suspendText: String) : TaskSuspension
|
||||
}
|
||||
Reference in New Issue
Block a user