if (value == JalviewFileChooser.APPROVE_OPTION)
{
java.io.File choice = chooser.getSelectedFile();
- JProgressBar progpanel = addProgressPanel("Saving jalview project "
- + choice.getName());
+ setProgressBar("Saving jalview project "
+ + choice.getName(), choice.hashCode());
jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
// TODO catch and handle errors for savestate
- new Jalview2XML().SaveState(choice);
- removeProgressPanel(progpanel);
-
+ try {
+ new Jalview2XML().SaveState(choice);
+ } catch (OutOfMemoryError oom)
+ {
+ new OOMWarning("Whilst saving current state to "+choice.getName(), oom);
+ }
+ catch (Exception ex)
+ {
+ Cache.log.error("Problems whilst trying to save to "+choice.getName(),ex);
+ JOptionPane.showMessageDialog(this, "Error whilst saving current state to "+choice.getName(), "Couldn't save project", JOptionPane.WARNING_MESSAGE);
+ }
+ setProgressBar(null, choice.hashCode());
+
}
}
if (value == JalviewFileChooser.APPROVE_OPTION)
{
- String choice = chooser.getSelectedFile().getAbsolutePath();
- setProgressBar("loading jalview project "
- + chooser.getSelectedFile().getName(), choice.hashCode());
+ final String choice = chooser.getSelectedFile().getAbsolutePath();
jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
.getSelectedFile().getParent());
- new Jalview2XML().LoadJalviewAlign(choice);
+ new Thread(new Runnable() {
+ public void run() {
+ setProgressBar("loading jalview project "
+ + choice, choice.hashCode());
+ try {
+ new Jalview2XML().LoadJalviewAlign(choice); }
+ catch (OutOfMemoryError oom)
+ {
+ new OOMWarning("Whilst loading project from "+choice, oom);
+ }
+ catch (Exception ex)
+ {
+ Cache.log.error("Problems whilst loading project from "+choice,ex);
+ JOptionPane.showMessageDialog(Desktop.desktop, "Error whilst loading project from "+choice, "Couldn't load project", JOptionPane.WARNING_MESSAGE);
+ }
setProgressBar(null, choice.hashCode());
+ }
+ }).start();
}
}