- improve scene error checking on start
- send user to troubleshooting webpage when app initialization fails

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10249 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent adccdd425d
commit 6c5b79cbab
  1. 16
      sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
  2. 43
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java

@ -153,17 +153,17 @@ public class SceneApplication extends Application implements LookupProvider {
nodeSync = new NodeSyncAppState(); nodeSync = new NodeSyncAppState();
stateManager.attach(nodeSync); stateManager.attach(nodeSync);
progressHandle.progress("initialize Base Application", 1); progressHandle.progress("initialize Base Application", 1);
if (!useCanvas) {
start();
}
} catch (Exception e) { } catch (Exception e) {
getProgressHandle().finish();
SceneViewerTopComponent.showOpenGLError(e.toString()); SceneViewerTopComponent.showOpenGLError(e.toString());
Exceptions.printStackTrace(e); Exceptions.printStackTrace(e);
} catch (Error e) { } catch (Error e) {
getProgressHandle().finish();
SceneViewerTopComponent.showOpenGLError(e.toString()); SceneViewerTopComponent.showOpenGLError(e.toString());
Exceptions.printStackTrace(e); Exceptions.printStackTrace(e);
} } finally {
if (!useCanvas) { getProgressHandle().finish();
start();
} }
} }
@ -261,13 +261,13 @@ public class SceneApplication extends Application implements LookupProvider {
inputManager.addMapping("MouseButtonRight", new MouseButtonTrigger(1)); inputManager.addMapping("MouseButtonRight", new MouseButtonTrigger(1));
started = true; started = true;
} catch (Exception e) { } catch (Exception e) {
getProgressHandle().finish();
Exceptions.printStackTrace(e); Exceptions.printStackTrace(e);
SceneViewerTopComponent.showOpenGLError(e.toString()); SceneViewerTopComponent.showOpenGLError(e.toString());
} catch (Error e) { } catch (Error e) {
getProgressHandle().finish();
Exceptions.printStackTrace(e); Exceptions.printStackTrace(e);
SceneViewerTopComponent.showOpenGLError(e.toString()); SceneViewerTopComponent.showOpenGLError(e.toString());
} finally {
getProgressHandle().finish();
} }
} }
@ -279,7 +279,7 @@ public class SceneApplication extends Application implements LookupProvider {
@Override @Override
public void update() { public void update() {
if(!started) { if (!started) {
return; return;
} }
try { try {

@ -35,12 +35,16 @@ import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener; import java.awt.event.MouseWheelListener;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.netbeans.api.settings.ConvertAsProperties; import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.DialogDisplayer; import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor; import org.openide.NotifyDescriptor;
import org.openide.NotifyDescriptor.Message; import org.openide.NotifyDescriptor.Message;
import org.openide.awt.HtmlBrowser;
import org.openide.awt.UndoRedo; import org.openide.awt.UndoRedo;
import org.openide.util.Exceptions; import org.openide.util.Exceptions;
import org.openide.util.HelpCtx; import org.openide.util.HelpCtx;
@ -58,6 +62,8 @@ autostore = false)
public final class SceneViewerTopComponent extends TopComponent { public final class SceneViewerTopComponent extends TopComponent {
private static SceneViewerTopComponent instance; private static SceneViewerTopComponent instance;
private static boolean browserOpened = false;
// private AtomicBoolean errorMessageOpen = new AtomicBoolean(false);
/** /**
* path to the icon used by the component and its open action * path to the icon used by the component and its open action
*/ */
@ -100,10 +106,8 @@ public final class SceneViewerTopComponent extends TopComponent {
//the oGLPanel may naver have the focus. //the oGLPanel may naver have the focus.
// if ("true".equals(NbPreferences.forModule(Installer.class).get("use_lwjgl_canvas", "false"))) { // if ("true".equals(NbPreferences.forModule(Installer.class).get("use_lwjgl_canvas", "false"))) {
addMouseWheelListener(new MouseWheelListener() { addMouseWheelListener(new MouseWheelListener() {
public void mouseWheelMoved(final MouseWheelEvent e) { public void mouseWheelMoved(final MouseWheelEvent e) {
SceneApplication.getApplication().enqueue(new Callable<Void>() { SceneApplication.getApplication().enqueue(new Callable<Void>() {
public Void call() throws Exception { public Void call() throws Exception {
String action = "MouseWheel-"; String action = "MouseWheel-";
if (e.getWheelRotation() < 0) { if (e.getWheelRotation() < 0) {
@ -118,13 +122,11 @@ public final class SceneViewerTopComponent extends TopComponent {
} }
}); });
addKeyListener(new KeyListener() { addKeyListener(new KeyListener() {
public void keyTyped(KeyEvent evt) { public void keyTyped(KeyEvent evt) {
} }
public void keyPressed(final KeyEvent evt) { public void keyPressed(final KeyEvent evt) {
SceneApplication.getApplication().enqueue(new Callable<Void>() { SceneApplication.getApplication().enqueue(new Callable<Void>() {
public Void call() throws Exception { public Void call() throws Exception {
int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); int code = AwtKeyInput.convertAwtKey(evt.getKeyCode());
KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, false); KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, false);
@ -139,7 +141,6 @@ public final class SceneViewerTopComponent extends TopComponent {
public void keyReleased(final KeyEvent evt) { public void keyReleased(final KeyEvent evt) {
SceneApplication.getApplication().enqueue(new Callable<Void>() { SceneApplication.getApplication().enqueue(new Callable<Void>() {
public Void call() throws Exception { public Void call() throws Exception {
int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); int code = AwtKeyInput.convertAwtKey(evt.getKeyCode());
KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), false, false); KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), false, false);
@ -156,10 +157,10 @@ public final class SceneViewerTopComponent extends TopComponent {
} }
/** This method is called from within the constructor to /**
* initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is always
* always regenerated by the Form Editor. * regenerated by the Form Editor.
*/ */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
@ -267,9 +268,10 @@ public final class SceneViewerTopComponent extends TopComponent {
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
/** /**
* Gets default instance. Do not use directly: reserved for *.settings files only, * Gets default instance. Do not use directly: reserved for *.settings files
* i.e. deserialization routines; otherwise you could get a non-deserialized instance. * only, i.e. deserialization routines; otherwise you could get a
* To obtain the singleton instance, use {@link #findInstance}. * non-deserialized instance. To obtain the singleton instance, use
* {@link #findInstance}.
*/ */
public static synchronized SceneViewerTopComponent getDefault() { public static synchronized SceneViewerTopComponent getDefault() {
if (instance == null) { if (instance == null) {
@ -279,7 +281,8 @@ public final class SceneViewerTopComponent extends TopComponent {
} }
/** /**
* Obtain the SceneViewerTopComponent instance. Never call {@link #getDefault} directly! * Obtain the SceneViewerTopComponent instance. Never call
* {@link #getDefault} directly!
*/ */
public static synchronized SceneViewerTopComponent findInstance() { public static synchronized SceneViewerTopComponent findInstance() {
TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
@ -300,9 +303,19 @@ public final class SceneViewerTopComponent extends TopComponent {
public static void showOpenGLError(String e) { public static void showOpenGLError(String e) {
Message msg = new NotifyDescriptor.Message( Message msg = new NotifyDescriptor.Message(
"Error opening OpenGL window!\n" "Error opening OpenGL window!\n"
+ "Error: " + e, + "Error: " + e + "\n"
NotifyDescriptor.ERROR_MESSAGE); + "See http://jmonkeyengine.org/wiki/doku.php/sdk:troubleshooting \n"
+ "for more info."
+ NotifyDescriptor.ERROR_MESSAGE);
DialogDisplayer.getDefault().notifyLater(msg); DialogDisplayer.getDefault().notifyLater(msg);
if (!browserOpened) {
browserOpened = true;
try {
HtmlBrowser.URLDisplayer.getDefault().showURL(new URL("http://jmonkeyengine.org/wiki/doku.php/sdk:troubleshooting"));
} catch (MalformedURLException ex) {
Exceptions.printStackTrace(ex);
}
}
} }
@Override @Override

Loading…
Cancel
Save