@@ -25,9 +25,12 @@ public abstract class ChildModel {
2525 private Procedure reporterRunner ;
2626 private Procedure commandRunner ;
2727 private LoadingCache <String , Reporter > tasks ;
28+ private String name ;
29+ private int modelID ;
2830
29- public ChildModel (World parentWorld ) throws ExtensionException {
31+ public ChildModel (World parentWorld , int modelID ) throws ExtensionException {
3032 this .parentWorld = parentWorld ;
33+ this .modelID = modelID ;
3134
3235 tasks = CacheBuilder .newBuilder ().build (new CacheLoader <String , Reporter >() {
3336 @ Override
@@ -46,6 +49,7 @@ public Reporter load(String code) throws ExtensionException {
4649 * @throws ExtensionException
4750 */
4851 void init () throws ExtensionException {
52+ setName (workspace ().getModelFileName ());
4953 try {
5054 reporterRunner = workspace ().compileReporter ("runresult task [ 0 ]" );
5155 commandRunner = workspace ().compileCommands ("run task []" );
@@ -152,8 +156,19 @@ public String getPath() {
152156 return workspace ().getModelPath ();
153157 }
154158
159+ String getFrameTitle () {
160+ return name + " (LevelSpace model #" + modelID + ")" ;
161+ }
162+
155163 public String getName () {
156- return workspace ().modelNameForDisplay ();
164+ return name ;
165+ }
166+
167+ public void setName (String name ) {
168+ this .name = name ;
169+ if (this .frame () != null ) {
170+ this .frame ().setTitle (getFrameTitle ());
171+ }
157172 }
158173
159174 abstract public void setSpeed (double d );
0 commit comments