- improve FakeApplication and SceneApplication cleanup

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10105 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 733ad2fdbe
commit 20dce97f5d
  1. 16
      sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java
  2. 7
      sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java

@ -394,14 +394,14 @@ public class FakeApplication extends SimpleApplication {
private ScheduledThreadPoolExecutor fakeAppThread = new ScheduledThreadPoolExecutor(1); private ScheduledThreadPoolExecutor fakeAppThread = new ScheduledThreadPoolExecutor(1);
public void cleanupFakeApp() { public void cleanupFakeApp() {
if (rootNode == null) { runQueuedFake();
return;
}
clearNode(rootNode);
appStateManager = new FakeAppStateManager(this); appStateManager = new FakeAppStateManager(this);
if (rootNode != null) {
clearNode(rootNode);
}
} }
public void startFakeApp(){ public void startFakeApp() {
fakeAppThread = new ScheduledThreadPoolExecutor(1); fakeAppThread = new ScheduledThreadPoolExecutor(1);
} }
@ -409,8 +409,8 @@ public class FakeApplication extends SimpleApplication {
cleanupFakeApp(); cleanupFakeApp();
fakeAppThread.shutdown(); fakeAppThread.shutdown();
} }
public void newAssetManager(AssetManager manager){ public void newAssetManager(AssetManager manager) {
this.assetManager = manager; this.assetManager = manager;
} }

@ -275,7 +275,7 @@ public class SceneApplication extends Application implements LookupProvider {
fakeApp.stopFakeApp(); fakeApp.stopFakeApp();
super.destroy(); super.destroy();
} }
@Override @Override
public void update() { public void update() {
if (speed == 0) { if (speed == 0) {
@ -324,8 +324,6 @@ public class SceneApplication extends Application implements LookupProvider {
handleError(e.getMessage(), e); handleError(e.getMessage(), e);
} }
} }
//TODO: Lookup for Application //TODO: Lookup for Application
public Lookup createAdditionalLookup(Lookup baseContext) { public Lookup createAdditionalLookup(Lookup baseContext) {
@ -477,7 +475,7 @@ public class SceneApplication extends Application implements LookupProvider {
} }
private void checkSave(SceneRequest request) { private void checkSave(SceneRequest request) {
if ((request != null) if ((request != null) && request.getDataObject() != null
&& request.getDataObject().isModified()) { && request.getDataObject().isModified()) {
final DataObject req = request.getDataObject(); final DataObject req = request.getDataObject();
Confirmation mesg = new NotifyDescriptor.Confirmation("Scene has not been saved,\ndo you want to save it?", 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() { public boolean isAwt() {
return java.awt.EventQueue.isDispatchThread(); return java.awt.EventQueue.isDispatchThread();
} }
} }

Loading…
Cancel
Save