- 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. 14
      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();
stateManager.attach(nodeSync);
progressHandle.progress("initialize Base Application", 1);
if (!useCanvas) {
start();
}
} catch (Exception e) {
getProgressHandle().finish();
SceneViewerTopComponent.showOpenGLError(e.toString());
Exceptions.printStackTrace(e);
} catch (Error e) {
getProgressHandle().finish();
SceneViewerTopComponent.showOpenGLError(e.toString());
Exceptions.printStackTrace(e);
}
if (!useCanvas) {
start();
} finally {
getProgressHandle().finish();
}
}
@ -261,13 +261,13 @@ public class SceneApplication extends Application implements LookupProvider {
inputManager.addMapping("MouseButtonRight", new MouseButtonTrigger(1));
started = true;
} catch (Exception e) {
getProgressHandle().finish();
Exceptions.printStackTrace(e);
SceneViewerTopComponent.showOpenGLError(e.toString());
} catch (Error e) {
getProgressHandle().finish();
Exceptions.printStackTrace(e);
SceneViewerTopComponent.showOpenGLError(e.toString());
} finally {
getProgressHandle().finish();
}
}

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

Loading…
Cancel
Save