File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed
src/test/kotlin/com/intellij/plugin/powershell/testFramework Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change 1
1
package com.intellij.plugin.powershell.testFramework
2
2
3
3
import com.intellij.openapi.command.WriteCommandAction
4
+ import com.intellij.openapi.util.ThrowableComputable
4
5
import com.intellij.openapi.vfs.VfsUtil
5
- import com.intellij.openapi.vfs.VirtualFile
6
6
import com.intellij.psi.PsiFile
7
7
import com.intellij.psi.PsiManager
8
- import com.intellij.util.ThrowableRunnable
9
- import java.io.IOException
10
8
import kotlin.io.path.Path
11
9
import kotlin.io.path.createDirectories
12
10
@@ -26,14 +24,10 @@ abstract class DebuggerTestBase: PowerShellTestBase() {
26
24
val baseDir = VfsUtil .findFile(basePath, /* refreshIfNeeded = */ true )
27
25
? : error(" Cannot find the base directory for project $project ." )
28
26
29
- var result: VirtualFile ? = null
30
-
31
- WriteCommandAction .writeCommandAction(null ).run<IOException ?>(ThrowableRunnable {
32
- result = originalVirtual.copy(originalVirtual, baseDir, originalVirtual.name)
27
+ val result = WriteCommandAction .writeCommandAction(/* project = */ null ).compute(ThrowableComputable {
28
+ originalVirtual.copy(originalVirtual, baseDir, originalVirtual.name)
33
29
})
34
30
35
- if (result == null ) error(" Cannot copy the original file \" $originalVirtual \" ." )
36
-
37
31
return PsiManager .getInstance(project).findFile(result) ? : error(" Cannot find the PSI file for \" $result \" ." )
38
32
}
39
33
}
You can’t perform that action at this time.
0 commit comments