From: James Procter Date: Wed, 20 Sep 2023 17:02:41 +0000 (+0100) Subject: JAL-4265 JAL-4286 reinstated explicit restoreSession method because Jmol’s LOAD files... X-Git-Tag: Release_2_11_4_0~176 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4b1bb2ab913cd40cea1c13f43d096c07f3cdeaf4;p=jalview.git JAL-4265 JAL-4286 reinstated explicit restoreSession method because Jmol’s LOAD files command does not behave the same way as restore STATE. Also added defensive check for unexpected exceptions if the state restore trashes the Jmol/Jalview binding --- diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index 65030a4..36d8e88 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -782,7 +782,11 @@ public class Commands // RESTORE SESSION AFTER EXPORT IF NEED BE if (sessionToRestore != null) { - sview.getBinding().openSession(sessionToRestore.getCanonicalPath()); + Console.debug("Restoring session from " + + sessionToRestore); + + sview.getBinding().restoreSession(sessionToRestore.getAbsolutePath()); + } } catch (ImageOutputException ioexc) { @@ -791,15 +795,14 @@ public class Commands isError = true; continue; } - catch (IOException ioexec) - { - addError("Unexpected error when restoring structure viewer session after custom view operations."); - isError = true; - continue; - } finally { - this.colourAlignFrame(af, originalColourScheme); + try { + this.colourAlignFrame(af, originalColourScheme); + } catch (Exception t) + { + addError("Unexpected error when restoring colourscheme to alignment after temporary change for export.",t); + } } } }