- 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
This commit is contained in:
nor..67 2011-11-09 22:41:12 +00:00
parent 10ce82f423
commit 818a8bdaab
2 changed files with 21 additions and 19 deletions

View File

@ -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();
}
} }

View File

@ -1087,9 +1087,6 @@ 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() {
public void run() {
if (jmeNode != null) { if (jmeNode != null) {
} else { } else {
} }
@ -1102,17 +1099,13 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
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();
// }
} }
} }