- commit closeable sceneviewer

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7084 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent f6d070afe6
commit beeb32c9d4
  1. 63
      sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
  2. 14
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java
  3. 4
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/ComposerCameraController.java
  4. 2
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java

@ -58,9 +58,6 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory;
@ -110,7 +107,6 @@ public class SceneApplication extends Application implements LookupProvider, Loo
private ApplicationLogHandler logHandler = new ApplicationLogHandler();
private WireProcessor wireProcessor;
private ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Opening SceneViewer..");
private boolean sceneActive = true;
private String lastError = "";
private boolean started = false;
@ -246,42 +242,6 @@ public class SceneApplication extends Application implements LookupProvider, Loo
}
}
@Override
public <V> Future<V> enqueue(Callable<V> callable) {
if (sceneActive) {
return super.enqueue(callable);
} else {
try {
final V value = callable.call();
return new Future<V>() {
public boolean cancel(boolean mayInterruptIfRunning) {
return true;
}
public boolean isCancelled() {
return false;
}
public boolean isDone() {
return true;
}
public V get() throws InterruptedException, ExecutionException {
return value;
}
public V get(long timeout, TimeUnit unit) {
return value;
}
};
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
//TODO: Lookup for Application
public Lookup createAdditionalLookup(Lookup baseContext) {
return Lookups.fixed(getApplication());
@ -359,7 +319,7 @@ public class SceneApplication extends Application implements LookupProvider, Loo
}
currentSceneRequest = request;
if (request.getDataObject() != null) {
setSelectedNode(request.getDataObject().getNodeDelegate());
setCurrentFileNode(request.getDataObject().getNodeDelegate());
}
setHelpContext(request.getHelpCtx());
getCurrentSceneRequest().setDisplayed(true);
@ -393,6 +353,7 @@ public class SceneApplication extends Application implements LookupProvider, Loo
camController.disable();
}
currentSceneRequest = null;
setCurrentFileNode(null);
setWindowTitle("SceneViewer");
}
}
@ -416,7 +377,6 @@ public class SceneApplication extends Application implements LookupProvider, Loo
}
toolsNode.detachAllChildren();
rootNode.detachAllChildren();
setSelectedNode(null);
setHelpContext(null);
resetCam();
currentSceneRequest = null;
@ -443,12 +403,11 @@ public class SceneApplication extends Application implements LookupProvider, Loo
public void run() {
SceneViewerTopComponent.findInstance().setDisplayName(string);
SceneViewerTopComponent.findInstance().requestActive();
}
});
}
public void setSelectedNode(final org.openide.nodes.Node node) {
public void setCurrentFileNode(final org.openide.nodes.Node node) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
@ -456,6 +415,8 @@ public class SceneApplication extends Application implements LookupProvider, Loo
SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{});
} else {
SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{node});
SceneViewerTopComponent.findInstance().open();
SceneViewerTopComponent.findInstance().requestActive();
}
}
});
@ -524,20 +485,6 @@ public class SceneApplication extends Application implements LookupProvider, Loo
return currentSceneRequest;
}
/**
* @return the sceneActive
*/
public boolean isSceneActive() {
return sceneActive;
}
/**
* @param sceneActive the sceneActive to set
*/
public void setSceneActive(boolean sceneActive) {
this.sceneActive = sceneActive;
}
@Override
public void handleError(String msg, Throwable t) {
progressHandle.finish();

@ -43,7 +43,6 @@ import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.NotifyDescriptor.Message;
import org.openide.awt.UndoRedo;
import org.openide.util.Exceptions;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.lookup.InstanceContent;
@ -73,8 +72,15 @@ public final class SceneViewerTopComponent extends TopComponent {
setIcon(ImageUtilities.loadImage(ICON_PATH, true));
// lookup = new AbstractLookup(lookupContents);
// associateLookup(lookup);
putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
// putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
try {
app = SceneApplication.getApplication();
oGLPanel.add(((JmeCanvasContext) app.getContext()).getCanvas());
} catch (Exception e) {
showOpenGLError(e.toString());
} catch (Error err) {
showOpenGLError(err.toString());
}
}
/** This method is called from within the constructor to
@ -228,7 +234,6 @@ public final class SceneViewerTopComponent extends TopComponent {
super.componentOpened();
try {
oGLPanel.add(((JmeCanvasContext) app.getContext()).getCanvas());
app.setSceneActive(true);
} catch (Exception e) {
showOpenGLError(e.toString());
} catch (Error err) {
@ -249,8 +254,7 @@ public final class SceneViewerTopComponent extends TopComponent {
@Override
public void componentClosed() {
super.componentClosed();
app.setSceneActive(false);
oGLPanel.removeAll();
// oGLPanel.removeAll();
}
void writeProperties(java.util.Properties p) {

@ -75,9 +75,9 @@ public class ComposerCameraController extends AbstractCameraController {
public void run() {
if (result != null && result.getGeometry() != null) {
SceneApplication.getApplication().setSelectedNode(jmeRootNode.getChild(result.getGeometry()));
SceneApplication.getApplication().setCurrentFileNode(jmeRootNode.getChild(result.getGeometry()));
} else {
SceneApplication.getApplication().setSelectedNode(jmeRootNode);
SceneApplication.getApplication().setCurrentFileNode(jmeRootNode);
}
}
});

@ -749,7 +749,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
setSelectedObjectText(null);
setSelectionData(false);
}
SceneApplication.getApplication().setSelectedNode(spatial);
SceneApplication.getApplication().setCurrentFileNode(spatial);
setActivatedNodes(new org.openide.nodes.Node[]{spatial});
}

Loading…
Cancel
Save