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.unknown = Unknown
label.quit_after_saving = Jalview will quit after saving.
label.quit_jalview = ¿Estás seguro de que quieres salir de Jalview?
label.wait_for_save = Esperar a guardar
label.unsaved_changes = Hay cambios sin guardar.
+label.unsaved_alignments = Hay alineamientos sin guardar.
label.save_in_progress = Algunos archivos aún se están guardando:
label.unknown = desconocido
label.quit_after_saving = Jalview se cerrará después de guardar.
* @j2sIgnore
*/
{
- boolean defaultStartupFile = Cache.getDefault("STARTUP_FILE",
- null) == null;
file = Cache.getDefault("STARTUP_FILE",
Cache.getDefault("www.jalview.org", "https://www.jalview.org")
+ "/examples/exampleFile_2_7.jvp");
file.replace("2_7.jar", "2_7.jvp");
// and remove the stale setting
Cache.removeProperty("STARTUP_FILE");
- defaultStartupFile = true;
}
protocol = AppletFormatAdapter.checkProtocol(file);
startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
format);
- if (defaultStartupFile)
- {
- Console.debug("Resetting up-to-date flag for startup file");
- startUpAlframe.getViewport().setSavedUpToDate(true);
- }
+ // don't ask to save when quitting if only the startup file has been
+ // opened
+ Console.debug("Resetting up-to-date flag for startup file");
+ startUpAlframe.getViewport().setSavedUpToDate(true);
// extract groovy arguments before anything else.
}
{
try
{
- UIManager.setLookAndFeel("com.formdev.flatlaf.FlatMacLightLaf");
+ UIManager.setLookAndFeel(
+ "com.formdev.flatlaf.themes.FlatMacLightLaf");
set = true;
Console.debug("Using FlatMacLightLaf");
} catch (ClassNotFoundException | InstantiationException
Console.debug("Using FlatMacLightLaf");
set = true;
}
- else if (SystemInfo.isWindows)
+ if (!set)
{
try
{
NULL, QUIT, CANCEL_QUIT, FORCE_QUIT
};
+ public static enum Message
+ {
+ UNSAVED_CHANGES, UNSAVED_ALIGNMENTS
+ };
+
+ protected static Message message = Message.UNSAVED_CHANGES;
+
+ public static void setMessage(Message m)
+ {
+ message = m;
+ }
+
private static ExecutorService executor = Executors.newFixedThreadPool(3);
public static QResponse setQuitHandler()
if (confirmQuit)
{
+ String messageString = MessageManager
+ .getString(message == Message.UNSAVED_ALIGNMENTS
+ ? "label.unsaved_alignments"
+ : "label.unsaved_changes");
JvOptionPane.newOptionDialog()
.setResponseHandler(JOptionPane.YES_OPTION, defaultOkQuit)
.setResponseHandler(JOptionPane.NO_OPTION, cancelQuit)
.showDialogOnTopAsync(
new StringBuilder(MessageManager
- .getString("label.quit_jalview"))
- .append("\n")
- .append(MessageManager
- .getString("label.unsaved_changes"))
- .toString(),
+ .getString("label.quit_jalview")).append("\n")
+ .append(messageString).toString(),
MessageManager.getString("action.quit"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null, new Object[]
public enum DataSourceType
{
FILE, URL, PASTE, CLASSLOADER, RELATIVE_URL;
+
+ public boolean isDynamic()
+ {
+ return this != FILE;
+ }
}
import jalview.gui.AlignViewport;
import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
+import jalview.gui.QuitHandler;
import jalview.json.binding.biojson.v1.ColourSchemeMapper;
import jalview.project.Jalview2XML;
import jalview.schemes.ColourSchemeI;
MessageManager.getString("label.couldnt_read_data"),
JvOptionPane.WARNING_MESSAGE);
}
+ this.setShouldBeSaved();
return;
}
// TODO: cache any stream datasources as a temporary file (eg. PDBs
{
alignFrame.setFileName(file, format);
alignFrame.setFileObject(selectedFile); // BH 2018 SwingJS
- alignFrame.getViewport().setSavedUpToDate(true);
}
if (proxyColourScheme != null)
{
Desktop.instance.stopLoading();
}
+ this.setShouldBeSaved();
}
/**
return tempStructFile.toString();
}
+ /*
+ * set whether quit should ask to save when just loaded this source
+ */
+ private void setShouldBeSaved()
+ {
+ if (protocol == null)
+ return;
+ AlignFrame af = this.alignFrame;
+ if (af == null)
+ return;
+ AlignViewport avp = af.getViewport();
+ if (avp == null)
+ return;
+ avp.setSavedUpToDate(!protocol.isDynamic(),
+ QuitHandler.Message.UNSAVED_ALIGNMENTS);
+ }
+
}
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.gui.QuitHandler;
import jalview.project.Jalview2XML;
import jalview.renderer.ResidueShader;
import jalview.renderer.ResidueShaderI;
public void setSavedUpToDate(boolean s)
{
+ setSavedUpToDate(s, QuitHandler.Message.UNSAVED_CHANGES);
+ }
+
+ public void setSavedUpToDate(boolean s, QuitHandler.Message m)
+ {
Console.debug(
"Setting " + this.getViewId() + " setSavedUpToDate to " + s);
savedUpToDate = s;
+ QuitHandler.setMessage(m);
}
public boolean savedUpToDate()