JAL-2797 added simple check for parent desktop to closing event
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Wed, 29 Nov 2017 02:06:44 +0000 (02:06 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Wed, 29 Nov 2017 02:06:44 +0000 (02:06 +0000)
forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java

index ab6e57f..dc93063 100644 (file)
@@ -304,10 +304,12 @@ public final class MainFrameApplication extends MainFrame {
         //        } );
         // The window listener
         setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
         addInternalFrameListener( new InternalFrameAdapter() {
 
             @Override
             public void internalFrameClosing( final InternalFrameEvent e ) {
+                if (MainFrameApplication.this.getParent() == null) {
                 if ( isUnsavedDataPresent() ) {
                     final int r = JOptionPane.showConfirmDialog( _mainpanel,
                                                                  "Close Archaeopteryx despite potentially unsaved changes?",
@@ -323,10 +325,10 @@ public final class MainFrameApplication extends MainFrame {
                     if ( r != JOptionPane.YES_OPTION ) {
                         return;
                     }
-                }
+                }}
                 exit();
-            }
-        } );
+            
+        } });
         // The component listener
         addComponentListener( new ComponentAdapter() {