2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import jalview.ext.so.SequenceOntology;
24 import jalview.gui.AlignFrame;
25 import jalview.gui.Desktop;
26 import jalview.gui.PromptUserConfig;
27 import jalview.io.AppletFormatAdapter;
28 import jalview.io.BioJsHTMLOutput;
29 import jalview.io.DataSourceType;
30 import jalview.io.FileFormat;
31 import jalview.io.FileFormatException;
32 import jalview.io.FileFormatI;
33 import jalview.io.FileLoader;
34 import jalview.io.HtmlSvgOutput;
35 import jalview.io.IdentifyFile;
36 import jalview.io.NewickFile;
37 import jalview.io.gff.SequenceOntologyFactory;
38 import jalview.schemes.ColourSchemeI;
39 import jalview.schemes.ColourSchemeProperty;
40 import jalview.util.MessageManager;
41 import jalview.util.Platform;
42 import jalview.ws.jws2.Jws2Discoverer;
44 import java.io.BufferedReader;
46 import java.io.FileOutputStream;
47 import java.io.IOException;
48 import java.io.InputStreamReader;
49 import java.io.OutputStreamWriter;
50 import java.io.PrintWriter;
51 import java.net.MalformedURLException;
53 import java.net.URISyntaxException;
55 import java.security.AllPermission;
56 import java.security.CodeSource;
57 import java.security.PermissionCollection;
58 import java.security.Permissions;
59 import java.security.Policy;
60 import java.util.HashMap;
62 import java.util.Vector;
63 import java.util.logging.ConsoleHandler;
64 import java.util.logging.Level;
65 import java.util.logging.Logger;
67 import javax.swing.LookAndFeel;
68 import javax.swing.UIManager;
70 import com.threerings.getdown.util.LaunchUtil;
72 import groovy.lang.Binding;
73 import groovy.util.GroovyScriptEngine;
76 * Main class for Jalview Application <br>
78 * start with: java -classpath "$PATH_TO_LIB$/*:$PATH_TO_CLASSES$" \
81 * or on Windows: java -classpath "$PATH_TO_LIB$/*;$PATH_TO_CLASSES$" \
82 * jalview.bin.Jalview jalview.bin.Jalview
84 * (ensure -classpath arg is quoted to avoid shell expansion of '*' and do not
85 * embellish '*' to e.g. '*.jar')
94 Platform.getURLCommandArguments();
97 // singleton instance of this class
99 private static Jalview instance;
101 private Desktop desktop;
103 public static AlignFrame currentAlignFrame;
107 if (!Platform.isJS())
114 // grab all the rights we can for the JVM
115 Policy.setPolicy(new Policy()
118 public PermissionCollection getPermissions(CodeSource codesource)
120 Permissions perms = new Permissions();
121 perms.add(new AllPermission());
126 public void refresh()
134 * keep track of feature fetching tasks.
142 * TODO: generalise to track all jalview events to orchestrate batch
146 private int queued = 0;
148 private int running = 0;
150 public FeatureFetcher()
155 public void addFetcher(final AlignFrame af,
156 final Vector<String> dasSources)
158 final long id = System.currentTimeMillis();
160 final FeatureFetcher us = this;
161 new Thread(new Runnable()
173 af.setProgressBar(MessageManager
174 .getString("status.das_features_being_retrived"), id);
175 af.featureSettings_actionPerformed(null);
176 af.setProgressBar(null, id);
185 public synchronized boolean allFinished()
187 return queued == 0 && running == 0;
192 public static Jalview getInstance()
198 * main class for Jalview application
201 * open <em>filename</em>
203 public static void main(String[] args)
205 // setLogging(); // BH - for event debugging in JavaScript
206 instance = new Jalview();
207 instance.doMain(args);
210 private static void logClass(String name)
212 // BH - for event debugging in JavaScript
213 ConsoleHandler consoleHandler = new ConsoleHandler();
214 consoleHandler.setLevel(Level.ALL);
215 Logger logger = Logger.getLogger(name);
216 logger.setLevel(Level.ALL);
217 logger.addHandler(consoleHandler);
220 @SuppressWarnings("unused")
221 private static void setLogging()
229 System.out.println("not in js");
232 // BH - for event debugging in JavaScript (Java mode only)
233 if (!Platform.isJS())
240 Logger.getLogger("").setLevel(Level.ALL);
241 logClass("java.awt.EventDispatchThread");
242 logClass("java.awt.EventQueue");
243 logClass("java.awt.Component");
244 logClass("java.awt.focus.Component");
245 logClass("java.awt.focus.DefaultKeyboardFocusManager");
256 void doMain(String[] args)
259 if (!Platform.isJS())
261 System.setSecurityManager(null);
265 .println("Java version: "
266 + System.getProperty("java.version"));
267 System.out.println("Java Home: " + System.getProperty("java.home"));
268 System.out.println(System.getProperty("os.arch") + " "
269 + System.getProperty("os.name") + " "
270 + System.getProperty("os.version"));
271 String val = System.getProperty("sys.install4jVersion");
273 System.out.println("Install4j version: " + val);
275 val = System.getProperty("installer_template_version");
277 System.out.println("Install4j template version: " + val);
279 val = System.getProperty("launcher_version");
281 System.out.println("Launcher version: " + val);
284 // report Jalview version
285 Cache.loadBuildProperties(true);
287 ArgsParser aparser = new ArgsParser(args);
288 boolean headless = false;
290 String usrPropsFile = aparser.getValue("props");
291 Cache.loadProperties(usrPropsFile); // must do this before
292 if (usrPropsFile != null)
295 "CMD [-props " + usrPropsFile + "] executed successfully!");
298 if (!Platform.isJS())
305 if (aparser.contains("help") || aparser.contains("h"))
310 if (aparser.contains("nodisplay") || aparser.contains("nogui")
311 || aparser.contains("headless"))
313 System.setProperty("java.awt.headless", "true");
318 final String jabawsUrl = aparser.getValue("jabaws");
319 if (jabawsUrl != null)
323 Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
325 "CMD [-jabaws " + jabawsUrl + "] executed successfully!");
326 } catch (MalformedURLException e)
329 "Invalid jabaws parameter: " + jabawsUrl + " ignored");
334 String defs = aparser.getValue("setprop");
337 int p = defs.indexOf('=');
340 System.err.println("Ignoring invalid setprop argument : " + defs);
344 System.out.println("Executing setprop argument: " + defs);
347 Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
350 defs = aparser.getValue("setprop");
352 if (System.getProperty("java.awt.headless") != null
353 && System.getProperty("java.awt.headless").equals("true"))
357 System.setProperty("http.agent",
358 "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
362 } catch (NoClassDefFoundError error)
364 error.printStackTrace();
365 System.out.println("\nEssential logging libraries not found."
366 + "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview");
374 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
375 } catch (Exception ex)
377 System.err.println("Unexpected Look and Feel Exception");
378 ex.printStackTrace();
380 if (Platform.isAMacAndNotJS())
383 LookAndFeel lookAndFeel = ch.randelshofer.quaqua.QuaquaManager
385 System.setProperty("com.apple.mrj.application.apple.menu.about.name",
387 System.setProperty("apple.laf.useScreenMenuBar", "true");
388 if (lookAndFeel != null)
392 UIManager.setLookAndFeel(lookAndFeel);
393 } catch (Throwable e)
396 "Failed to set QuaQua look and feel: " + e.toString());
399 if (lookAndFeel == null
400 || !(lookAndFeel.getClass().isAssignableFrom(
401 UIManager.getLookAndFeel().getClass()))
402 || !UIManager.getLookAndFeel().getClass().toString()
403 .toLowerCase().contains("quaqua"))
408 "Quaqua LaF not available on this plaform. Using VAqua(4).\nSee https://issues.jalview.org/browse/JAL-2976");
409 UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel");
410 } catch (Throwable e)
413 "Failed to reset look and feel: " + e.toString());
419 * configure 'full' SO model if preferences say to, else use the default (full SO)
420 * - as JS currently doesn't have OBO parsing, it must use 'Lite' version
422 boolean soDefault = !Platform.isJS();
423 if (Cache.getDefault("USE_FULL_SO", soDefault))
425 SequenceOntologyFactory.setInstance(new SequenceOntology());
430 desktop = new Desktop();
431 desktop.setInBatchMode(true); // indicate we are starting up
435 JalviewTaskbar.setTaskbar(this);
436 } catch (Throwable t)
438 System.out.println("Error setting Taskbar: " + t.getMessage());
441 desktop.setVisible(true);
443 desktop.startServiceDiscovery();
445 if (!Platform.isJS())
453 if (!aparser.contains("nousagestats"))
455 startUsageStats(desktop);
459 System.err.println("CMD [-nousagestats] executed successfully!");
462 if (!aparser.contains("noquestionnaire"))
464 String url = aparser.getValue("questionnaire");
467 // Start the desktop questionnaire prompter with the specified
469 Cache.log.debug("Starting questionnaire url at " + url);
470 desktop.checkForQuestionnaire(url);
471 System.out.println("CMD questionnaire[-" + url
472 + "] executed successfully!");
476 if (Cache.getProperty("NOQUESTIONNAIRES") == null)
478 // Start the desktop questionnaire prompter with the specified
481 // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
483 String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
485 "Starting questionnaire with default url: " + defurl);
486 desktop.checkForQuestionnaire(defurl);
493 .println("CMD [-noquestionnaire] executed successfully!");
496 if (!aparser.contains("nonews"))
498 desktop.checkForNews();
501 BioJsHTMLOutput.updateBioJS();
505 // Move any new getdown-launcher-new.jar into place over old
506 // getdown-launcher.jar
507 String appdirString = System.getProperty("getdownappdir");
508 if (appdirString != null && appdirString.length() > 0)
510 final File appdir = new File(appdirString);
516 LaunchUtil.upgradeGetdown(
517 new File(appdir, "getdown-launcher-old.jar"),
518 new File(appdir, "getdown-launcher.jar"),
519 new File(appdir, "getdown-launcher-new.jar"));
524 String file = null, data = null;
525 FileFormatI format = null;
526 DataSourceType protocol = null;
527 FileLoader fileLoader = new FileLoader(!headless);
529 String groovyscript = null; // script to execute after all loading is
530 // completed one way or another
531 // extract groovy argument and execute if necessary
532 groovyscript = aparser.getValue("groovy", true);
533 file = aparser.getValue("open", true);
535 if (file == null && desktop == null)
537 System.out.println("No files to open!");
541 // Finally, deal with the remaining input data.
546 desktop.setProgressBar(
548 .getString("status.processing_commandline_args"),
549 progress = System.currentTimeMillis());
551 System.out.println("CMD [-open " + file + "] executed successfully!");
553 if (!Platform.isJS())
555 * ignore in JavaScript -- can't just file existence - could load it?
560 if (!file.startsWith("http://") && !file.startsWith("https://"))
561 // BH 2019 added https check for Java
563 if (!(new File(file)).exists())
565 System.out.println("Can't find " + file);
574 protocol = AppletFormatAdapter.checkProtocol(file);
578 format = new IdentifyFile().identify(file, protocol);
579 } catch (FileFormatException e1)
584 AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
588 System.out.println("error");
592 setCurrentAlignFrame(af);
593 data = aparser.getValue("colour", true);
596 data.replaceAll("%20", " ");
598 ColourSchemeI cs = ColourSchemeProperty.getColourScheme(
599 af.getViewport(), af.getViewport().getAlignment(), data);
604 "CMD [-color " + data + "] executed successfully!");
609 // Must maintain ability to use the groups flag
610 data = aparser.getValue("groups", true);
613 af.parseFeaturesFile(data,
614 AppletFormatAdapter.checkProtocol(data));
615 // System.out.println("Added " + data);
617 "CMD groups[-" + data + "] executed successfully!");
619 data = aparser.getValue("features", true);
622 af.parseFeaturesFile(data,
623 AppletFormatAdapter.checkProtocol(data));
624 // System.out.println("Added " + data);
626 "CMD [-features " + data + "] executed successfully!");
629 data = aparser.getValue("annotations", true);
632 af.loadJalviewDataFile(data, null, null, null);
633 // System.out.println("Added " + data);
635 "CMD [-annotations " + data + "] executed successfully!");
637 // set or clear the sortbytree flag.
638 if (aparser.contains("sortbytree"))
640 af.getViewport().setSortByTree(true);
641 if (af.getViewport().getSortByTree())
643 System.out.println("CMD [-sortbytree] executed successfully!");
646 if (aparser.contains("no-annotation"))
648 af.getViewport().setShowAnnotation(false);
649 if (!af.getViewport().isShowAnnotation())
651 System.out.println("CMD no-annotation executed successfully!");
654 if (aparser.contains("nosortbytree"))
656 af.getViewport().setSortByTree(false);
657 if (!af.getViewport().getSortByTree())
660 .println("CMD [-nosortbytree] executed successfully!");
663 data = aparser.getValue("tree", true);
669 "CMD [-tree " + data + "] executed successfully!");
670 NewickFile nf = new NewickFile(data,
671 AppletFormatAdapter.checkProtocol(data));
673 .setCurrentTree(af.showNewickTree(nf, data).getTree());
674 } catch (IOException ex)
676 System.err.println("Couldn't add tree " + data);
677 ex.printStackTrace(System.err);
680 // TODO - load PDB structure(s) to alignment JAL-629
681 // (associate with identical sequence in alignment, or a specified
683 if (groovyscript != null)
685 // Execute the groovy script after we've done all the rendering stuff
686 // and before any images or figures are generated.
687 System.out.println("Executing script " + groovyscript);
688 executeGroovyScript(groovyscript, af);
689 System.out.println("CMD groovy[" + groovyscript
690 + "] executed successfully!");
693 String imageName = "unnamed.png";
694 while (aparser.getSize() > 1)
696 String outputFormat = aparser.nextValue();
697 file = aparser.nextValue();
699 if (outputFormat.equalsIgnoreCase("png"))
701 af.createPNG(new File(file));
702 imageName = (new File(file)).getName();
703 System.out.println("Creating PNG image: " + file);
706 else if (outputFormat.equalsIgnoreCase("svg"))
708 File imageFile = new File(file);
709 imageName = imageFile.getName();
710 af.createSVG(imageFile);
711 System.out.println("Creating SVG image: " + file);
714 else if (outputFormat.equalsIgnoreCase("html"))
716 File imageFile = new File(file);
717 imageName = imageFile.getName();
718 HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
719 htmlSVG.exportHTML(file);
721 System.out.println("Creating HTML image: " + file);
724 else if (outputFormat.equalsIgnoreCase("biojsmsa"))
728 System.err.println("The output html file must not be null");
733 BioJsHTMLOutput.refreshVersionInfo(
734 BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY);
735 } catch (URISyntaxException e)
739 BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel);
740 bjs.exportHTML(file);
742 .println("Creating BioJS MSA Viwer HTML file: " + file);
745 else if (outputFormat.equalsIgnoreCase("imgMap"))
747 af.createImageMap(new File(file), imageName);
748 System.out.println("Creating image map: " + file);
751 else if (outputFormat.equalsIgnoreCase("eps"))
753 File outputFile = new File(file);
755 "Creating EPS file: " + outputFile.getAbsolutePath());
756 af.createEPS(outputFile);
760 af.saveAlignment(file, format);
761 if (af.isSaveAlignmentSuccessful())
763 System.out.println("Written alignment in " + format
764 + " format to " + file);
768 System.out.println("Error writing file " + file + " in "
769 + format + " format!!");
774 while (aparser.getSize() > 0)
776 System.out.println("Unknown arg: " + aparser.nextValue());
781 af.getViewport().getCalcManager().shutdown();
784 AlignFrame startUpAlframe = null;
785 // We'll only open the default file if the desktop is visible.
787 // ////////////////////
789 if (!Platform.isJS() && !headless && file == null
790 && Cache.getDefault("SHOW_STARTUP_FILE", true))
797 file = Cache.getDefault("STARTUP_FILE",
798 Cache.getDefault("www.jalview.org",
799 "http://www.jalview.org")
800 + "/examples/exampleFile_2_7.jar");
802 "http://www.jalview.org/examples/exampleFile_2_3.jar"))
804 // hardwire upgrade of the startup file
805 file.replace("_2_3.jar", "_2_7.jar");
806 // and remove the stale setting
807 Cache.removeProperty("STARTUP_FILE");
810 protocol = DataSourceType.FILE;
812 if (file.indexOf("http:") > -1)
814 protocol = DataSourceType.URL;
817 if (file.endsWith(".jar"))
819 format = FileFormat.Jalview;
825 format = new IdentifyFile().identify(file, protocol);
826 } catch (FileFormatException e)
832 startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
834 // extract groovy arguments before anything else.
837 // Once all other stuff is done, execute any groovy scripts (in order)
838 if (groovyscript != null)
840 if (Cache.groovyJarsPresent())
842 System.out.println("Executing script " + groovyscript);
843 executeGroovyScript(groovyscript, startUpAlframe);
848 "Sorry. Groovy Support is not available, so ignoring the provided groovy script "
852 // and finally, turn off batch mode indicator - if the desktop still exists
857 desktop.setProgressBar(null, progress);
859 desktop.setInBatchMode(false);
863 private static void showUsage()
866 "Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
867 + "-nodisplay\tRun Jalview without User Interface.\n"
868 + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
869 + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
870 + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
871 + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
872 + "-features FILE\tUse the given file to mark features on the alignment.\n"
873 + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
874 + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
875 + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
876 + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
877 + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
878 + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
879 + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
880 + "-json FILE\tCreate alignment file FILE in JSON format.\n"
881 + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
882 + "-png FILE\tCreate PNG image FILE from alignment.\n"
883 + "-svg FILE\tCreate SVG image FILE from alignment.\n"
884 + "-html FILE\tCreate HTML file from alignment.\n"
885 + "-biojsMSA FILE\tCreate BioJS MSA Viewer HTML file from alignment.\n"
886 + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
887 + "-eps FILE\tCreate EPS file FILE from alignment.\n"
888 + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
889 + "-noquestionnaire\tTurn off questionnaire check.\n"
890 + "-nonews\tTurn off check for Jalview news.\n"
891 + "-nousagestats\tTurn off google analytics tracking for this session.\n"
892 + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
894 // "-setprop PROPERTY=VALUE\tSet the given Jalview property,
895 // after all other properties files have been read\n\t
896 // (quote the 'PROPERTY=VALUE' pair to ensure spaces are
897 // passed in correctly)"
898 + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
899 + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
900 + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n"
901 + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
904 private static void startUsageStats(final Desktop desktop)
907 * start a User Config prompt asking if we can log usage statistics.
909 PromptUserConfig prompter = new PromptUserConfig(Desktop.desktop,
910 "USAGESTATS", "Jalview Usage Statistics",
911 "Do you want to help make Jalview better by enabling "
912 + "the collection of usage statistics with Google Analytics ?"
913 + "\n\n(you can enable or disable usage tracking in the preferences)",
920 "Initialising googletracker for usage stats.");
921 Cache.initGoogleTracker();
922 Cache.log.debug("Tracking enabled.");
929 Cache.log.debug("Not enabling Google Tracking.");
932 desktop.addDialogThread(prompter);
936 * Locate the given string as a file and pass it to the groovy interpreter.
938 * @param groovyscript
939 * the script to execute
940 * @param jalviewContext
941 * the Jalview Desktop object passed in to the groovy
942 * binding as the 'Jalview' object.
944 private void executeGroovyScript(String groovyscript, AlignFrame af)
947 * for scripts contained in files
954 if (groovyscript.trim().equals("STDIN"))
956 // read from stdin into a tempfile and execute it
959 tfile = File.createTempFile("jalview", "groovy");
960 PrintWriter outfile = new PrintWriter(
961 new OutputStreamWriter(new FileOutputStream(tfile)));
962 BufferedReader br = new BufferedReader(
963 new InputStreamReader(System.in));
965 while ((line = br.readLine()) != null)
967 outfile.write(line + "\n");
973 } catch (Exception ex)
975 System.err.println("Failed to read from STDIN into tempfile "
976 + ((tfile == null) ? "(tempfile wasn't created)"
977 : tfile.toString()));
978 ex.printStackTrace();
983 sfile = tfile.toURI().toURL();
984 } catch (Exception x)
987 "Unexpected Malformed URL Exception for temporary file created from STDIN: "
997 sfile = new URI(groovyscript).toURL();
998 } catch (Exception x)
1000 tfile = new File(groovyscript);
1001 if (!tfile.exists())
1003 System.err.println("File '" + groovyscript + "' does not exist.");
1006 if (!tfile.canRead())
1008 System.err.println("File '" + groovyscript + "' cannot be read.");
1011 if (tfile.length() < 1)
1013 System.err.println("File '" + groovyscript + "' is empty.");
1018 sfile = tfile.getAbsoluteFile().toURI().toURL();
1019 } catch (Exception ex)
1021 System.err.println("Failed to create a file URL for "
1022 + tfile.getAbsoluteFile());
1029 Map<String, java.lang.Object> vbinding = new HashMap<>();
1030 vbinding.put("Jalview", this);
1033 vbinding.put("currentAlFrame", af);
1035 Binding gbinding = new Binding(vbinding);
1036 GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
1037 gse.run(sfile.toString(), gbinding);
1038 if ("STDIN".equals(groovyscript))
1040 // delete temp file that we made -
1041 // only if it was successfully executed
1044 } catch (Exception e)
1046 System.err.println("Exception Whilst trying to execute file " + sfile
1047 + " as a groovy script.");
1048 e.printStackTrace(System.err);
1053 public static boolean isHeadlessMode()
1055 String isheadless = System.getProperty("java.awt.headless");
1056 if (isheadless != null && isheadless.equalsIgnoreCase("true"))
1063 public AlignFrame[] getAlignFrames()
1065 return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
1066 : Desktop.getAlignFrames();
1071 * Quit method delegates to Desktop.quit - unless running in headless mode when
1072 * it just ends the JVM
1076 if (desktop != null)
1086 public static AlignFrame getCurrentAlignFrame()
1088 return Jalview.currentAlignFrame;
1091 public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
1093 Jalview.currentAlignFrame = currentAlignFrame;