public void handle(org.nlogo.window.Events.CompileMoreSourceEvent e) { JobOwner owner = e.owner; if (isLoading) { widgets.add(owner); return; } if (owner.isCommandCenter()) { try { CompilerResults results = workspace .compiler() .compileMoreCode( owner.source(), scala.Some.apply(owner.classDisplayName()), workspace.world.program(), workspace.getProcedures(), workspace.getExtensionManager()); results.head().init(workspace); results.head().setOwner(owner); new org.nlogo.window.Events.CompiledEvent( owner, workspace.world.program(), results.head(), null) .raise(this); } catch (CompilerException error) { new org.nlogo.window.Events.CompiledEvent(owner, workspace.world.program(), null, error) .raise(this); } } else { compileWidgets(); } }
private void compileSource( org.nlogo.api.JobOwner owner, List<org.nlogo.window.Events.CompiledEvent> errorEvents) { try { CompilerResults results = workspace .compiler() .compileMoreCode( owner.source(), scala.Some.apply(owner.classDisplayName() + " '" + owner.displayName() + "'"), workspace.world.program(), workspace.getProcedures(), workspace.getExtensionManager()); if (!results.procedures().isEmpty()) { results.head().init(workspace); results.head().setOwner(owner); new org.nlogo.window.Events.CompiledEvent( owner, workspace.world.program(), results.head(), null) .raise(this); } } catch (CompilerException error) { errorEvents.add( new org.nlogo.window.Events.CompiledEvent(owner, workspace.world.program(), null, error)); } }