JAL-2287 treat Escape like Cancel in dialog box
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 27 Oct 2016 08:03:05 +0000 (09:03 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 27 Oct 2016 08:03:05 +0000 (09:03 +0100)
src/jalview/gui/ChimeraViewFrame.java

index bccbda8..ce719d0 100644 (file)
@@ -59,9 +59,7 @@ import java.io.InputStream;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 import java.util.Random;
-import java.util.Set;
 import java.util.Vector;
 
 import javax.swing.JCheckBoxMenuItem;
@@ -535,7 +533,11 @@ public class ChimeraViewFrame extends StructureViewerBase
         int confirm = JOptionPane.showConfirmDialog(this, prompt,
                 MessageManager.getString("label.close_viewer"),
                 JOptionPane.YES_NO_CANCEL_OPTION);
-        if (confirm == JOptionPane.CANCEL_OPTION)
+        /*
+         * abort closure if user hits escape or Cancel
+         */
+        if (confirm == JOptionPane.CANCEL_OPTION
+                || confirm == JOptionPane.CLOSED_OPTION)
         {
           return;
         }