Skip to content

Commit

Permalink
Fixes issue dcaoyuan#176, puts the initialization of SBT console on t…
Browse files Browse the repository at this point in the history
…he EDT
  • Loading branch information
akochnev committed Dec 18, 2016
1 parent 7d39c65 commit ffddc2e
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit ffddc2e

Please sign in to comment.