- remove invokeLater from TerrainEditor
- add isOgl() and isAwt() for asserting threading to SceneApplication

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8622 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 10ce82f423
commit 818a8bdaab
  1. 13
      sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
  2. 27
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java

@ -75,8 +75,7 @@ import org.openide.util.NbPreferences;
import org.openide.util.lookup.Lookups; import org.openide.util.lookup.Lookups;
/** /**
* <p/> <p/> <p/> <p/> *
* <p/>
* @author normenhansen * @author normenhansen
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -115,6 +114,7 @@ public class SceneApplication extends Application implements LookupProvider {
private ViewPort overlayView; private ViewPort overlayView;
boolean useCanvas = false; boolean useCanvas = false;
private BulletAppState physicsState; private BulletAppState physicsState;
private Thread thread;
public SceneApplication() { public SceneApplication() {
progressHandle.start(7); progressHandle.start(7);
@ -200,6 +200,7 @@ public class SceneApplication extends Application implements LookupProvider {
@Override @Override
public void initialize() { public void initialize() {
thread = Thread.currentThread();
try { try {
super.initialize(); super.initialize();
{ {
@ -600,4 +601,12 @@ public class SceneApplication extends Application implements LookupProvider {
public void setActiveCameraController(AbstractCameraController activeCamController) { public void setActiveCameraController(AbstractCameraController activeCamController) {
this.activeCamController = activeCamController; this.activeCamController = activeCamController;
} }
public boolean isOgl() {
return Thread.currentThread() == thread;
}
public boolean isAwt() {
return java.awt.EventQueue.isDispatchThread();
}
} }

@ -1087,32 +1087,25 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
private void setSceneInfo(final JmeNode jmeNode, final boolean active) { private void setSceneInfo(final JmeNode jmeNode, final boolean active) {
final TerrainEditorTopComponent inst = this; final TerrainEditorTopComponent inst = this;
java.awt.EventQueue.invokeLater(new Runnable() { if (jmeNode != null) {
} else {
public void run() { }
if (jmeNode != null) {
} else {
}
if (!active) { if (!active) {
result.removeLookupListener(inst); result.removeLookupListener(inst);
close(); close();
} else { } else {
open(); open();
requestActive(); requestActive();
} }
}
});
} }
public void sceneClosed(SceneRequest request) { public void sceneClosed(SceneRequest request) {
if (request.equals(currentRequest)) { if (request.equals(currentRequest)) {
// if (checkSaved()) {
SceneApplication.getApplication().removeSceneListener(this); SceneApplication.getApplication().removeSceneListener(this);
setSceneInfo(null, false); setSceneInfo(null, false);
currentRequest = null; currentRequest = null;
cleanupControllers(); cleanupControllers();
// }
} }
} }

Loading…
Cancel
Save