DEA-CR-15513 FileDocumentManager.getInstance().saveAllDocuments() should be called...
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Tue, 8 Nov 2016 14:33:19 +0000 (15:33 +0100)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Tue, 8 Nov 2016 14:34:30 +0000 (15:34 +0100)
platform/lang-impl/src/com/intellij/execution/runners/DefaultProgramRunner.kt
platform/lang-impl/src/com/intellij/execution/runners/DefaultProgramRunnerImpl.kt

index a2fef20414d1c9e006062b2e22b98ab91ba8134a..2f84bf45c32bb4b0a81b3cf5bf01e988edf5c6ff 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.intellij.execution.runners
 
-import com.intellij.execution.ExecutionException
 import com.intellij.execution.ExecutionResult
 import com.intellij.execution.RunProfileStarter
 import com.intellij.execution.configurations.RunProfileState
@@ -24,7 +23,6 @@ import com.intellij.execution.ui.RunContentDescriptor
 import com.intellij.openapi.fileEditor.FileDocumentManager
 
 abstract class DefaultProgramRunner : GenericProgramRunner<RunnerSettings>() {
-  @Throws(ExecutionException::class)
   override fun doExecute(state: RunProfileState, env: ExecutionEnvironment): RunContentDescriptor? {
     return executeState(state, env, this)
   }
@@ -41,4 +39,4 @@ internal fun executeState(state: RunProfileState, env: ExecutionEnvironment, run
 
 fun showRunContent(executionResult: ExecutionResult?, environment: ExecutionEnvironment): RunContentDescriptor? {
   return executionResult?.let { RunContentBuilder(it, environment).showRunContent(environment.contentToReuse) }
-}
\ No newline at end of file
+}
index 5c242f79050010ea829611d083f90f4f25e73f8b..dcae4b26ee35e0d8e1d9c71d0c9b398791a67f16 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.execution.configurations.RunProfile
 import com.intellij.execution.configurations.RunProfileState
 import com.intellij.execution.configurations.RunnerSettings
 import com.intellij.execution.executors.DefaultRunExecutor
+import com.intellij.openapi.fileEditor.FileDocumentManager
 import org.jetbrains.concurrency.Promise
 import org.jetbrains.concurrency.resolvedPromise
 
@@ -27,6 +28,8 @@ private class DefaultProgramRunnerImpl : AsyncGenericProgramRunner<RunnerSetting
   override fun getRunnerId() = "defaultRunner"
 
   override fun prepare(environment: ExecutionEnvironment, state: RunProfileState): Promise<RunProfileStarter> {
+    FileDocumentManager.getInstance().saveAllDocuments()
+
     if (state is DebuggableRunProfileState) {
       return state.execute(-1)
         .then {
@@ -36,10 +39,10 @@ private class DefaultProgramRunnerImpl : AsyncGenericProgramRunner<RunnerSetting
         }
     }
 
-    return resolvedPromise(runProfileStarter { state, environment -> executeState(state, environment, this) })
+    return resolvedPromise(runProfileStarter { state, environment -> showRunContent(state.execute(environment.executor, this), environment) })
   }
 
   override fun canRun(executorId: String, profile: RunProfile): Boolean {
     return DefaultRunExecutor.EXECUTOR_ID == executorId && profile !is RunConfigurationWithSuppressedDefaultRunAction
   }
-}
\ No newline at end of file
+}