private static final String UTF_8 = "UTF-8";
/**
+ * used in decision if quit confirmation should be issued
+ */
+ private static boolean stateSavedUpToDate = false;
+
+ /**
* prefix for recovering datasets for alignments with multiple views where
* non-existent dataset IDs were written for some views
*/
{
AlignFrame[] frames = Desktop.getAlignFrames();
+ setStateSavedUpToDate(true);
+
if (Cache.getDefault("DEBUG_DELAY_SAVE", false))
{
int n = 20;
FileOutputStream fos = new FileOutputStream(
doBackup ? backupfiles.getTempFilePath() : jarFile);
+ if (Cache.getDefault("DEBUG_DELAY_SAVE", false))
+ {
+ int n = 20;
+ int i = 0;
+ while (i < n)
+ {
+ Console.debug("***** debugging save sleep " + i + "/" + n);
+ try
+ {
+ Thread.sleep(1000);
+ } catch (InterruptedException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ i++;
+ }
+ }
+
JarOutputStream jout = new JarOutputStream(fos);
List<AlignFrame> frames = new ArrayList<>();
return colour;
}
+
+ public static void setStateSavedUpToDate(boolean s)
+ {
+ Console.debug("Setting overall stateSavedUpToDate to " + s);
+ stateSavedUpToDate = s;
+ }
+
+ public static boolean stateSavedUpToDate()
+ {
+ Console.debug("Returning overall stateSavedUpToDate value: "
+ + stateSavedUpToDate);
+ return stateSavedUpToDate;
+ }
+
+ public static boolean allSavedUpToDate()
+ {
+ if (stateSavedUpToDate()) // nothing happened since last project save
+ return true;
+
+ AlignFrame[] frames = Desktop.getAlignFrames();
+ for (int i = 0; i < frames.length; i++)
+ {
+ if (frames[i] == null)
+ continue;
+ if (!frames[i].getViewport().savedUpToDate())
+ return false; // at least one alignment is not individually saved
+ }
+ return true;
+ }
}