From: Ben Soares Date: Wed, 11 Oct 2023 11:12:28 +0000 (+0100) Subject: JAL-3772 Preference to NOT prompt to save remotely loaded alignments X-Git-Tag: Release_2_11_3_0~3^2~36^2~13 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=58735c979dbb573eb12d57e33ef7d6e3f3a82c8e;hp=d76c189f5d49526a39d03e291f84400b95c177b2;p=jalview.git JAL-3772 Preference to NOT prompt to save remotely loaded alignments --- diff --git a/src/jalview/io/DataSourceType.java b/src/jalview/io/DataSourceType.java index 6d00a7d..c983dfe 100644 --- a/src/jalview/io/DataSourceType.java +++ b/src/jalview/io/DataSourceType.java @@ -28,4 +28,9 @@ public enum DataSourceType { return this != FILE; } + + public boolean isUrl() + { + return this == URL || this == RELATIVE_URL; + } } diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index dc7adac..de88ce9 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -361,8 +361,9 @@ public class FileLoader implements Runnable // We read the data anyway - it might make sense. } // BH 2018 switch to File object here instead of filename - alignFrame = new Jalview2XML(raiseGUI && !Jalview.isBatchMode()).loadJalviewAlign( - selectedFile == null ? file : selectedFile); + alignFrame = new Jalview2XML(raiseGUI && !Jalview.isBatchMode()) + .loadJalviewAlign( + selectedFile == null ? file : selectedFile); } else { @@ -563,7 +564,8 @@ public class FileLoader implements Runnable } catch (Exception er) { - jalview.bin.Console.errPrintln("Exception whilst opening file '" + file); + jalview.bin.Console + .errPrintln("Exception whilst opening file '" + file); er.printStackTrace(); if (raiseGUI && !Jalview.isBatchMode()) { @@ -603,7 +605,8 @@ public class FileLoader implements Runnable } }); } - jalview.bin.Console.errPrintln("Out of memory loading file " + file + "!!"); + jalview.bin.Console + .errPrintln("Out of memory loading file " + file + "!!"); } loadtime += System.currentTimeMillis(); @@ -684,10 +687,18 @@ public class FileLoader implements Runnable AlignViewport avp = af.getViewport(); if (avp == null) return; - avp.setSavedUpToDate(!protocol.isDynamic(), - QuitHandler.Message.UNSAVED_ALIGNMENTS); + boolean upToDate = !protocol.isDynamic(); + if (protocol.isUrl() + && Cache.getDefault(PROMPT_SAVE_UNCHANGED_URL_ALIGNMENTS, true)) + { + upToDate = true; + } + avp.setSavedUpToDate(upToDate, + upToDate ? null : QuitHandler.Message.UNSAVED_ALIGNMENTS); } + public static final String PROMPT_SAVE_UNCHANGED_URL_ALIGNMENTS = "PROMPT_SAVE_UNCHANGED_URL_ALIGNMENTS"; + public static boolean getUseDefaultFileFormat() { return useDefaultFileFormat;