From: kjvdheide Date: Wed, 29 Nov 2017 02:06:44 +0000 (+0000) Subject: JAL-2797 added simple check for parent desktop to closing event X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b8121ed04b4ec52eeb0361dd7417717a4c455d25;p=jalview.git JAL-2797 added simple check for parent desktop to closing event --- diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index ab6e57f..dc93063 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -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() {