Minor: fixes after review

This commit is contained in:
Natalia Selezneva
2018-05-14 16:06:04 +03:00
parent 098e51d104
commit 54f9359195
@@ -56,12 +56,12 @@ class RunScratchAction(private val scratchPanel: ScratchTopPanel) : AnAction(
return return
} }
val runnable = r@{ fun executeScratch() {
val executor = if (isRepl) provider.createReplExecutor(scratchFile) else provider.createCompilingExecutor(scratchFile) val executor = if (isRepl) provider.createReplExecutor(scratchFile) else provider.createCompilingExecutor(scratchFile)
if (executor == null) { if (executor == null) {
handler.error(scratchFile, "Couldn't run ${psiFile.name}") handler.error(scratchFile, "Couldn't run ${psiFile.name}")
handler.onFinish(scratchFile) handler.onFinish(scratchFile)
return@r return
} }
e.presentation.isEnabled = false e.presentation.isEnabled = false
@@ -83,7 +83,6 @@ class RunScratchAction(private val scratchPanel: ScratchTopPanel) : AnAction(
e.presentation.isEnabled = true e.presentation.isEnabled = true
log.error(ex) log.error(ex)
return@r
} }
} }
@@ -92,15 +91,15 @@ class RunScratchAction(private val scratchPanel: ScratchTopPanel) : AnAction(
if (!aborted && errors == 0) { if (!aborted && errors == 0) {
if (DumbService.isDumb(project)) { if (DumbService.isDumb(project)) {
DumbService.getInstance(project).smartInvokeLater { DumbService.getInstance(project).smartInvokeLater {
runnable() executeScratch()
} }
} else { } else {
runnable() executeScratch()
} }
} }
} }
} else { } else {
runnable() executeScratch()
} }
} }
} }