From 20dce97f5d05707d3e48ed48001c6b49877cf395 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Sat, 19 Jan 2013 00:45:38 +0000 Subject: [PATCH] SDK: - improve FakeApplication and SceneApplication cleanup git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10105 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/gde/core/scene/FakeApplication.java | 16 ++++++++-------- .../jme3/gde/core/scene/SceneApplication.java | 7 ++----- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java index d00383389..72cd0d1bf 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java @@ -394,14 +394,14 @@ public class FakeApplication extends SimpleApplication { private ScheduledThreadPoolExecutor fakeAppThread = new ScheduledThreadPoolExecutor(1); public void cleanupFakeApp() { - if (rootNode == null) { - return; - } - clearNode(rootNode); + runQueuedFake(); appStateManager = new FakeAppStateManager(this); + if (rootNode != null) { + clearNode(rootNode); + } } - - public void startFakeApp(){ + + public void startFakeApp() { fakeAppThread = new ScheduledThreadPoolExecutor(1); } @@ -409,8 +409,8 @@ public class FakeApplication extends SimpleApplication { cleanupFakeApp(); fakeAppThread.shutdown(); } - - public void newAssetManager(AssetManager manager){ + + public void newAssetManager(AssetManager manager) { this.assetManager = manager; } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java index 8b406437e..8bd888b94 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java @@ -275,7 +275,7 @@ public class SceneApplication extends Application implements LookupProvider { fakeApp.stopFakeApp(); super.destroy(); } - + @Override public void update() { if (speed == 0) { @@ -324,8 +324,6 @@ public class SceneApplication extends Application implements LookupProvider { handleError(e.getMessage(), e); } } - - //TODO: Lookup for Application public Lookup createAdditionalLookup(Lookup baseContext) { @@ -477,7 +475,7 @@ public class SceneApplication extends Application implements LookupProvider { } private void checkSave(SceneRequest request) { - if ((request != null) + if ((request != null) && request.getDataObject() != null && request.getDataObject().isModified()) { final DataObject req = request.getDataObject(); Confirmation mesg = new NotifyDescriptor.Confirmation("Scene has not been saved,\ndo you want to save it?", @@ -658,5 +656,4 @@ public class SceneApplication extends Application implements LookupProvider { public boolean isAwt() { return java.awt.EventQueue.isDispatchThread(); } - }