@ -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