public void LoadFile(AlignViewport viewport, Object file,
DataSourceType protocol, FileFormatI format)
{
+ LoadFile(viewport, file, protocol, format, true);
+ }
+
+ public void LoadFile(AlignViewport viewport, Object file,
+ DataSourceType protocol, FileFormatI format, boolean async)
+ {
this.viewport = viewport;
if (file instanceof File)
{
this.selectedFile = (File) file;
file = selectedFile.getPath();
}
- LoadFile(file.toString(), protocol, format);
+ LoadFile(file.toString(), protocol, format, async);
}
public void LoadFile(String file, DataSourceType protocol,
FileFormatI format)
{
+ LoadFile(file, protocol, format, true);
+ }
+
+ public void LoadFile(String file, DataSourceType protocol,
+ FileFormatI format, boolean async)
+ {
this.file = file;
this.protocol = protocol;
this.format = format;
- final Thread loader = new Thread(this);
-
- SwingUtilities.invokeLater(new Runnable()
+ if (async)
{
- @Override
- public void run()
+ final Thread loader = new Thread(this);
+
+ SwingUtilities.invokeLater(new Runnable()
{
- loader.start();
- }
- });
+ @Override
+ public void run()
+ {
+ loader.start();
+ }
+ });
+ }
+ else
+ {
+ this.run();
+ }
}
/**
? "Copied From Clipboard"
: file;
Runtime rt = Runtime.getRuntime();
+
try
{
if (Desktop.instance != null)
MessageManager.getString("label.couldnt_read_data"),
JvOptionPane.WARNING_MESSAGE);
}
- this.setShouldBeSaved();
+ // don't set shouldBeSaved if didn't load anything
+ // this.setShouldBeSaved();
return;
}
// TODO: cache any stream datasources as a temporary file (eg. PDBs
{
if (selectedFile == null)
{
- al = fa.readFile(file, protocol, format);
+ al = fa.readFile(null, file, protocol, format);
}
else
{
- al = fa.readFile(selectedFile, protocol, format);
+ al = fa.readFile(selectedFile, null, protocol, format);
}
source = fa.getAlignFile(); // keep reference for later if