NetLogo/Teletortoise — pull request #97 by SethTisue (2013-11-11 03:11:44+00:00)
Title: Tortoise: use new WidgetParser (no dependence on HeadlessWorkspace)

at the time you upgrade to the latest NetLogoHeadless to get the latest engine changes, you'll also get the new WidgetParser and need to do this:

```diff
diff --git a/app/models/local/NetLogoCompiler.scala b/app/models/local/NetLogoCompiler.scala
index e83b350..920937a 100644
--- a/app/models/local/NetLogoCompiler.scala
+++ b/app/models/local/NetLogoCompiler.scala
@@ -1,12 +1,13 @@
package models.local

import
- org.nlogo.{ api, headless, nvm, shape, tortoise },
+ org.nlogo.{ api, nvm, shape, tortoise, workspace },
api.{ AgentKind, CompilerException, ModelReader, ModelSection, Program, ShapeList, WorldDimensions },
- headless.WidgetParser,
+ workspace.WidgetParser,
nvm.FrontEndInterface.{ NoProcedures, ProceduresMap },
shape.{ LinkShape, VectorShape },
- tortoise.Compiler
+ tortoise.Compiler,
+ org.nlogo.util.Femto

import
play.api.Logger
@@ -92,7 +93,14 @@ object NetLogoCompiler {
val turtleShapes = new ShapeList(AgentKind.Turtle, VectorShape.parseShapes(modelMap(ModelSection.TurtleShapes).toArray, version))
val linkShapes = new ShapeList(AgentKind.Link, LinkShape. parseShapes(modelMap(ModelSection.LinkShapes). toArray, version))

- val (iGlobals, _, _, _, iGlobalCmds) = new WidgetParser(org.nlogo.headless.HeadlessWorkspace.newInstance).parseWidgets(interface)
+ val (iGlobals, _, _, _, iGlobalCmds) = {
+ val frontEnd: nvm.FrontEndInterface =
+ Femto.scalaSingleton("org.nlogo.compile.front.FrontEnd")
+ val widgetParser =
+ new workspace.WidgetParser(
+ new nvm.DefaultParserServices(frontEnd))
+ widgetParser.parseWidgets(interface)
+ }

val patchSize = interface(7).toDouble
val Seq(wrapX, wrapY, _, minX, maxX, minY, maxY) = 14 to 20 map { x => interface(x).toInt }
```