From: Ben Soares Date: Mon, 13 Feb 2023 20:18:00 +0000 (+0000) Subject: Merge branch 'merge/JAL-1988_JAL-3772+JAL-3416+JAL-4054+JAL-4064' into bug/JAL-4125_f... X-Git-Tag: Release_2_11_3_0~23^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5a166386ec498f9887de88dc3221fa48f9287d4c;p=jalview.git Merge branch 'merge/JAL-1988_JAL-3772+JAL-3416+JAL-4054+JAL-4064' into bug/JAL-4125_flatlaf_quithandler_warning_doesnt_display_properly --- 5a166386ec498f9887de88dc3221fa48f9287d4c diff --cc resources/lang/Messages.properties index 1ad60be,23bb966..60b19e6 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@@ -36,9 -36,8 +36,10 @@@ action.force_quit = Force qui label.quit_jalview = Are you sure you want to quit Jalview? label.wait_for_save = Wait for save label.unsaved_changes = There are unsaved changes. + label.unsaved_alignments = There are unsaved alignments. label.save_in_progress = Some files are still saving: +label.confirm_quit_viewer = An external viewer is still open. Close the external window as well? +label.confirm_quit_viewers = External viewers are still open. Close these external windows as well? label.unknown = Unknown label.quit_after_saving = Jalview will quit after saving. label.all_saved = All files saved. diff --cc src/jalview/gui/QuitHandler.java index f9110eb,bedddd1..9a44306 --- a/src/jalview/gui/QuitHandler.java +++ b/src/jalview/gui/QuitHandler.java @@@ -146,23 -157,23 +158,24 @@@ public class QuitHandle if (confirmQuit) { + String messageString = MessageManager + .getString(message == Message.UNSAVED_ALIGNMENTS + ? "label.unsaved_alignments" + : "label.unsaved_changes"); - JvOptionPane.newOptionDialog() + setQuitDialog(JvOptionPane.newOptionDialog() .setResponseHandler(JOptionPane.YES_OPTION, defaultOkQuit) - .setResponseHandler(JOptionPane.NO_OPTION, cancelQuit) - .showDialogOnTopAsync( - new StringBuilder(MessageManager - .getString("label.quit_jalview")).append("\n") - .append(messageString).toString(), - MessageManager.getString("action.quit"), - JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE, null, new Object[] - { MessageManager.getString("action.quit"), - MessageManager.getString("action.cancel") }, - MessageManager.getString("action.quit"), true); + .setResponseHandler(JOptionPane.NO_OPTION, cancelQuit)); + JvOptionPane qd = getQuitDialog(); + qd.showDialogOnTopAsync( + new StringBuilder( + MessageManager.getString("label.quit_jalview")) - .append("\n") - .append(MessageManager - .getString("label.unsaved_changes")) - .toString(), ++ .append("\n").append(messageString).toString(), + MessageManager.getString("action.quit"), + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, + new Object[] + { MessageManager.getString("action.quit"), + MessageManager.getString("action.cancel") }, + MessageManager.getString("action.quit"), true); } got = gotQuitResponse(); @@@ -455,31 -419,6 +468,31 @@@ public static void abortQuit() { - setResponse(QResponse.CANCEL_QUIT); + setResponse(QResponse.NULL); + // executor.shutdownNow(); + } + + private static JvOptionPane quitDialog = null; + + private static void setQuitDialog(JvOptionPane qd) + { + quitDialog = qd; + } + + private static JvOptionPane getQuitDialog() + { + return quitDialog; + } + + public static boolean quitCancelled() + { + return QuitHandler.gotQuitResponse() == QResponse.CANCEL_QUIT + || QuitHandler.gotQuitResponse() == QResponse.NULL; + } + + public static boolean quitting() + { + return QuitHandler.gotQuitResponse() == QResponse.QUIT + || QuitHandler.gotQuitResponse() == QResponse.FORCE_QUIT; } --} ++}