Skip to content

Commit

Permalink
Fixed withContext
Browse files Browse the repository at this point in the history
  • Loading branch information
ellizio committed Nov 14, 2024
1 parent 13e0011 commit c17390f
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.intellij.execution.ui.ConsoleView
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.application.EDT
import com.intellij.openapi.project.Project
import com.intellij.openapi.rd.util.*
import com.intellij.openapi.vfs.VirtualFileManager
Expand All @@ -19,6 +20,8 @@ import com.jetbrains.rider.projectView.actions.isProjectModelReady
import com.jetbrains.rider.projectView.solution
import com.jetbrains.rider.projectView.workspace.isProject
import com.jetbrains.rider.projectView.workspace.isWebReferenceFolder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import ru.ellizio.odatacliui.extensions.printCommandError
import ru.ellizio.odatacliui.models.ActionMetadata
import ru.ellizio.odatacliui.terminal.executors.CommandLineExecutor
Expand All @@ -33,7 +36,7 @@ class OpenCliDialogAction : AnAction() {
project.lifetime.launchOnUi {
val dialog = CliDialog(dialogModel)
if (dialog.showAndGet()) {
withBackgroundContext {
withContext(Dispatchers.IO) {
executeCommand(project, actionMetadata, dialogModel)
}
}
Expand All @@ -54,8 +57,8 @@ class OpenCliDialogAction : AnAction() {

private suspend fun executeCommand(project: Project, metadata: ActionMetadata, model: CliDialogModel)
{
var consoleView: ConsoleView? = null
withUiContext {
var consoleView: ConsoleView?
withContext(Dispatchers.EDT) {
consoleView = CliToolWindowManager.getInstance(project).instantiateConsole()
}

Expand Down

0 comments on commit c17390f

Please sign in to comment.