Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Repl view: fix exception that was occurring when closing the view.
  • Loading branch information
lindydonna committed Jun 21, 2011
1 parent f76a3ff commit 226bf80
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -26,14 +26,13 @@ object EclipseRepl {
}

/** Stop the execution of the repl associated with the project. The repl is expected to be in `projectToReplMap` */
def stopRepl(project: ScalaProject) {
def stopRepl(project: ScalaProject, flush: Boolean = true) {
val repl = projectToReplMap.remove(project).get
repl.close
if (flush) repl.close
}

def relaunchRepl(project: ScalaProject) {
val repl = projectToReplMap.get(project).get
repl.close
repl.resetCompiler
repl.replay
}
Expand All @@ -48,10 +47,12 @@ class EclipseRepl(project: ScalaProject, settings: Settings, replView: ReplConso

import Actor._

private val eventQueue = Actor.actor {
private val eventQueue = actor {
loop { receive {
case code: String =>
Console.withOut(ViewOutputStream) { intp interpret code }
Console.withOut(ViewOutputStream) {
intp interpret code
}
ViewOutputStream.flush
}}
}
Expand All @@ -65,7 +66,10 @@ class EclipseRepl(project: ScalaProject, settings: Settings, replView: ReplConso
var intp = createCompiler()

private def createCompiler(): IMain = new IMain(settings, new PrintWriter(ViewOutputStream))
private def resetCompiler = { intp = createCompiler() }
private def resetCompiler = {
intp.close
intp = createCompiler()
}

def interpret(code: String) {
replayList += code
Expand Down

0 comments on commit 226bf80

Please sign in to comment.