+
+ }
+
+ while (aparser.getSize() > 0)
+ {
+ System.out.println("Unknown arg: " + aparser.nextValue());
+ }
+ }
+ }
+
+ AlignFrame startUpAlframe = null;
+ // We'll only open the default file if the desktop is visible.
+ // And the user
+ // ////////////////////
+
+ if (!Platform.isJS() && !headless && file == null
+ && Cache.getDefault("SHOW_STARTUP_FILE", true)
+ && !cmds.commandArgsProvided()
+ && !bootstrapArgs.getBoolean(Arg.NOSTARTUPFILE))
+ // don't open the startup file if command line args have been processed
+ // (&& !Commands.commandArgsProvided())
+ /**
+ * Java only
+ *
+ * @j2sIgnore
+ */
+ {
+ file = Cache.getDefault("STARTUP_FILE",
+ Cache.getDefault("www.jalview.org", "https://www.jalview.org")
+ + "/examples/exampleFile_2_7.jvp");
+ if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar")
+ || file.equals(
+ "http://www.jalview.org/examples/exampleFile_2_7.jar"))
+ {
+ file.replace("http:", "https:");
+ // hardwire upgrade of the startup file
+ file.replace("_2_3", "_2_7");
+ file.replace("2_7.jar", "2_7.jvp");
+ // and remove the stale setting
+ Cache.removeProperty("STARTUP_FILE");
+ }
+
+ protocol = AppletFormatAdapter.checkProtocol(file);
+
+ if (file.endsWith(".jar"))
+ {
+ format = FileFormat.Jalview;
+ }
+ else
+ {
+ try
+ {
+ format = new IdentifyFile().identify(file, protocol);
+ } catch (FileFormatException e)
+ {
+ // TODO what?
+ }
+ }
+
+ startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
+ format);
+ // don't ask to save when quitting if only the startup file has been
+ // opened
+ Console.debug("Resetting up-to-date flag for startup file");
+ startUpAlframe.getViewport().setSavedUpToDate(true);
+ // extract groovy arguments before anything else.
+ }
+
+ // Once all other stuff is done, execute any groovy scripts (in order)
+ if (groovyscript != null)
+ {
+ if (Cache.groovyJarsPresent())
+ {
+ System.out.println("Executing script " + groovyscript);
+ executeGroovyScript(groovyscript, startUpAlframe);
+ }
+ else
+ {
+ System.err.println(
+ "Sorry. Groovy Support is not available, so ignoring the provided groovy script "
+ + groovyscript);
+ }
+ }
+ // and finally, turn off batch mode indicator - if the desktop still exists
+ if (desktop != null)
+ {
+ if (progress != -1)
+ {
+ desktop.setProgressBar(null, progress);
+ }
+ desktop.setInBatchMode(false);
+ }
+ }
+
+ private static void setLookAndFeel()
+ {
+ if (!Platform.isJS())
+ /**
+ * Java only
+ *
+ * @j2sIgnore
+ */
+ {
+ // property laf = "crossplatform", "system", "gtk", "metal", "nimbus",
+ // "mac" or "flat"
+ // If not set (or chosen laf fails), use the normal SystemLaF and if on
+ // Mac,
+ // try Quaqua/Vaqua.
+ String lafProp = System.getProperty("laf");
+ String lafSetting = Cache.getDefault("PREFERRED_LAF", null);
+ String laf = "none";
+ if (lafProp != null)
+ {
+ laf = lafProp;
+ }
+ else if (lafSetting != null)
+ {
+ laf = lafSetting;
+ }
+ boolean lafSet = false;
+ switch (laf)
+ {
+ case "crossplatform":
+ lafSet = setCrossPlatformLookAndFeel();
+ if (!lafSet)
+ {
+ Console.error("Could not set requested laf=" + laf);
+ }
+ break;
+ case "system":
+ lafSet = setSystemLookAndFeel();
+ if (!lafSet)
+ {
+ Console.error("Could not set requested laf=" + laf);
+ }
+ break;
+ case "gtk":
+ lafSet = setGtkLookAndFeel();
+ if (!lafSet)
+ {
+ Console.error("Could not set requested laf=" + laf);
+ }
+ break;
+ case "metal":
+ lafSet = setMetalLookAndFeel();
+ if (!lafSet)
+ {
+ Console.error("Could not set requested laf=" + laf);
+ }
+ break;
+ case "nimbus":
+ lafSet = setNimbusLookAndFeel();
+ if (!lafSet)
+ {
+ Console.error("Could not set requested laf=" + laf);
+ }
+ break;
+ case "flat":
+ lafSet = setFlatLookAndFeel();
+ if (!lafSet)
+ {
+ Console.error("Could not set requested laf=" + laf);
+ }
+ break;
+ case "mac":
+ lafSet = setMacLookAndFeel();
+ if (!lafSet)
+ {
+ Console.error("Could not set requested laf=" + laf);