Skip to content

Commit

Permalink
do not use obsolete runWriteAction coroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinVaadin committed Nov 5, 2024
1 parent f71563a commit 8f9d261
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/com/vaadin/plugin/copilot/CopilotPluginUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.intellij.ide.plugins.PluginManagerCore
import com.intellij.notification.Notification
import com.intellij.notification.NotificationType
import com.intellij.notification.Notifications
import com.intellij.openapi.application.WriteAction
import com.intellij.openapi.application.runInEdt
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.extensions.PluginId
import com.intellij.openapi.project.Project
Expand Down Expand Up @@ -94,7 +94,7 @@ class CopilotPluginUtil {
}
props.store(bufferedWriter, "Vaadin Copilot Integration Runtime Properties")
runInEdt {
runWriteAction {
WriteAction.run<Throwable> {
val dotFile = dotFileDirectory.findFile(DOTFILE)
dotFile?.let {
try {
Expand All @@ -108,7 +108,7 @@ class CopilotPluginUtil {
dotFileDirectory.createChildData(this, DOTFILE)
} catch (e: IOException) {
LOG.error("Failed to create $DOTFILE: ${e.message}")
return@runWriteAction
return@run
}

try {
Expand All @@ -124,7 +124,7 @@ class CopilotPluginUtil {

fun removeDotFile(project: Project) {
runInEdt {
runWriteAction {
WriteAction.run<Throwable> {
val dotFile = getDotFileDirectory(project)?.findFile(DOTFILE)
dotFile?.let {
try {
Expand All @@ -133,7 +133,7 @@ class CopilotPluginUtil {
} catch (e: IOException) {
LOG.error("Failed to delete $DOTFILE: ${e.message}")
}
return@runWriteAction
return@run
}
LOG.warn("Cannot remove $dotFile - file does not exist")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.vaadin.plugin.copilot.handler

import com.intellij.openapi.application.WriteAction
import com.intellij.openapi.application.runInEdt
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.command.impl.UndoManagerImpl
import com.intellij.openapi.command.undo.UndoManager
import com.intellij.openapi.fileEditor.FileEditor
Expand All @@ -26,7 +26,7 @@ open class UndoHandler(project: Project, data: Map<String, Any>) : AbstractHandl
} else {
// if we want to undo file removal we need to create empty virtual file to write
// content
runWriteAction {
WriteAction.run<Throwable> {
val parent = VfsUtil.createDirectories(file.parent)
vfsFile = parent.createChildData(this, file.name)
vfsFiles.add(vfsFile!!)
Expand All @@ -49,7 +49,7 @@ open class UndoHandler(project: Project, data: Map<String, Any>) : AbstractHandl
getEditorWrapper(vfsFile).use { wrapper ->
val undoManager = UndoManagerImpl.getInstance(project)
val editor = wrapper.getFileEditor()
runWriteAction {
WriteAction.run<Throwable> {
try {
before(vfsFile)
var i = 0
Expand Down

0 comments on commit 8f9d261

Please sign in to comment.