From b8121ed04b4ec52eeb0361dd7417717a4c455d25 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Wed, 29 Nov 2017 02:06:44 +0000 Subject: [PATCH] JAL-2797 added simple check for parent desktop to closing event --- .../src/org/forester/archaeopteryx/MainFrameApplication.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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() { -- 1.7.10.2