Merge branch 'merge/JAL-1988_JAL-3772+JAL-3416+JAL-4054+JAL-4064' into bug/JAL-4125_f...
authorBen Soares <b.soares@dundee.ac.uk>
Mon, 13 Feb 2023 20:18:00 +0000 (20:18 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Mon, 13 Feb 2023 20:18:00 +0000 (20:18 +0000)
1  2 
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/gui/Desktop.java
src/jalview/gui/QuitHandler.java
src/jalview/viewmodel/AlignmentViewport.java

@@@ -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.
Simple merge
Simple merge
@@@ -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();
  
    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;
    }
--}
++}