X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCommands.java;fp=src%2Fjalview%2Fbin%2FCommands.java;h=e02d132f255f2ec9641cd61a02d1f60644505eee;hb=5784154b972346e9a3718654d7f875da49b3c167;hp=5d3b50d69414d0721327d32ab3c52148929fe109;hpb=ca160187a050f6d4e50158cd5b51f75c83a7179e;p=jalview.git diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index 5d3b50d..e02d132 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -775,10 +775,11 @@ public class Commands // RESTORE SESSION AFTER EXPORT IF NEED BE if (sessionToRestore != null) { - Console.debug("Restoring session from " - + sessionToRestore); - - sview.getBinding().restoreSession(sessionToRestore.getAbsolutePath()); + Console.debug( + "Restoring session from " + sessionToRestore); + + sview.getBinding().restoreSession( + sessionToRestore.getAbsolutePath()); } } catch (ImageOutputException ioexec) @@ -789,11 +790,14 @@ public class Commands continue; } finally { - try { + try + { this.colourAlignFrame(af, originalColourScheme); } catch (Exception t) { - addError("Unexpected error when restoring colourscheme to alignment after temporary change for export.",t); + addError( + "Unexpected error when restoring colourscheme to alignment after temporary change for export.", + t); } } } @@ -838,21 +842,29 @@ public class Commands ArgValuesMap avm = argParser.getLinkedArgs(id); AlignFrame af = afMap.get(id); - if (af == null) + if (avm != null && !avm.containsArg(Arg.GROOVY)) { - addWarn("Did not have an alignment window for id=" + id); + // nothing to do return; } + if (af == null) + { + addWarn("Groovy script does not have an alignment window. Proceeding with caution!"); + } + if (avm.containsArg(Arg.GROOVY)) { - String groovyscript = avm.getValue(Arg.GROOVY); - if (groovyscript != null) + for (ArgValue groovyAv : avm.getArgValueList(Arg.GROOVY)) { - // Execute the groovy script after we've done all the rendering stuff - // and before any images or figures are generated. - Console.info("Executing script " + groovyscript); - Jalview.getInstance().executeGroovyScript(groovyscript, af); + String groovyscript = groovyAv.getValue(); + if (groovyscript != null) + { + // Execute the groovy script after we've done all the rendering stuff + // and before any images or figures are generated. + Console.info("Executing script " + groovyscript); + Jalview.getInstance().executeGroovyScript(groovyscript, af); + } } } } @@ -862,9 +874,16 @@ public class Commands ArgValuesMap avm = argParser.getLinkedArgs(id); AlignFrame af = afMap.get(id); + if (avm != null && !avm.containsArg(Arg.IMAGE)) + { + // nothing to do + return true; + } + if (af == null) { - addWarn("Did not have an alignment window for id=" + id); + addWarn("Do not have an alignment window to create image from (id=" + + id + "). Not proceeding."); return false; } @@ -991,9 +1010,16 @@ public class Commands ArgValuesMap avm = argParser.getLinkedArgs(id); AlignFrame af = afMap.get(id); + if (avm != null && !avm.containsArg(Arg.OUTPUT)) + { + // nothing to do + return true; + } + if (af == null) { - addWarn("Did not have an alignment window for id=" + id); + addWarn("Do not have an alignment window (id=" + id + + "). Not proceeding."); return false; }