From ffddc2ee50e93dcfeb2264ce38838654c84e09f2 Mon Sep 17 00:00:00 2001 From: Alex Kochnev Date: Sat, 17 Dec 2016 19:54:25 -0500 Subject: [PATCH] Fixes issue #176, puts the initialization of SBT console on the EDT --- .../sbt/console/SBTConsoleTopComponent.scala | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/scala.sbt/src/main/scala/org/netbeans/modules/scala/sbt/console/SBTConsoleTopComponent.scala b/scala.sbt/src/main/scala/org/netbeans/modules/scala/sbt/console/SBTConsoleTopComponent.scala index b0fca47..d317d8c 100644 --- a/scala.sbt/src/main/scala/org/netbeans/modules/scala/sbt/console/SBTConsoleTopComponent.scala +++ b/scala.sbt/src/main/scala/org/netbeans/modules/scala/sbt/console/SBTConsoleTopComponent.scala @@ -307,27 +307,27 @@ object SBTConsoleTopComponent { * Obtain the SBTConsoleTopComponent instance by project */ private def openInstance(project: Project, commands: List[String], isForceNew: Boolean, isDebug: Boolean, background: Boolean)(postAction: String => Unit) { - val (tc, isNewCreated) = if (isDebug) { - (SBTConsoleTopComponent(project, isDebug), true) - } else { - projectToDefault.get(project) match { - case None => - val default = SBTConsoleTopComponent(project, isDebug) - projectToDefault.put(project, default) - (default, true) - case Some(tc) => - if (isForceNew || tc.isRunningCommand) { - (SBTConsoleTopComponent(project, isDebug), true) - } else { - (tc, false) - } - } - } - - tc.isRunningCommand = true val runnableTask = new Runnable() { def run { + val (tc, isNewCreated) = if (isDebug) { + (SBTConsoleTopComponent(project, isDebug), true) + } else { + projectToDefault.get(project) match { + case None => + val default = SBTConsoleTopComponent(project, isDebug) + projectToDefault.put(project, default) + (default, true) + case Some(tc) => + if (isForceNew || tc.isRunningCommand) { + (SBTConsoleTopComponent(project, isDebug), true) + } else { + (tc, false) + } + } + } + + tc.isRunningCommand = true val progressHandle = ProgressHandle.createHandle("Running sbt commnad...", new Cancellable() {