X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=cdd8cc16a50a003fbade1d25d184ae9f4dbf3bda;hb=9c127c47a7bf73c3e538815635f525fe59f7faba;hp=226888f4af9da244bcbc7f737b6c8091b95ebb9c;hpb=577b0bf651763fe609eb6d6343754662023b3eac;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 226888f..cdd8cc1 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -67,6 +67,8 @@ import java.util.logging.Logger; import javax.swing.LookAndFeel; import javax.swing.UIManager; +import com.threerings.getdown.util.LaunchUtil; + import groovy.lang.Binding; import groovy.util.GroovyScriptEngine; @@ -87,34 +89,13 @@ import groovy.util.GroovyScriptEngine; */ public class Jalview { - // @formatter:off - /** - * find first query parameter (if any) that doesn't start with j2s - * and set as space-delimited arguments to Jalview main - * - * @j2sNative - * var hr = decodeURI(document.location.href); - * var pos = hr.indexOf("?"); - * if (pos > 0) - * { - * q = hr.substring(pos+1); - * args = q.split("&"); - * for (i = 0 ; i < args.length; i++) - * { - * arg1 = args[i]; - * if (!arg1.startsWith("j2s")) - * { - * thisApplet.__Info.args = arg1.split(" "); - * break; - * } - * } - * } - */ - // @formatter:on + static + { + Platform.getURLCommandArguments(); + } + + // singleton instance of this class - /* - * singleton instance of this class - */ private static Jalview instance; private Desktop desktop; @@ -158,8 +139,8 @@ public class Jalview class FeatureFetcher { /* - * TODO: generalise to track all jalview events to orchestrate batch - * processing events. + * TODO: generalise to track all jalview events to orchestrate batch processing + * events. */ private int queued = 0; @@ -217,7 +198,7 @@ public class Jalview * main class for Jalview application * * @param args - * open filename + * open filename */ public static void main(String[] args) { @@ -281,10 +262,27 @@ public class Jalview } System.out - .println("Java version: " + System.getProperty("java.version")); + .println("Java version: " + + System.getProperty("java.version")); + System.out.println("Java Home: " + System.getProperty("java.home")); System.out.println(System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version")); + String val = System.getProperty("sys.install4jVersion"); + if (val != null) { + System.out.println("Install4j version: " + val); + } + val = System.getProperty("installer_template_version"); + if (val != null) { + System.out.println("Install4j template version: " + val); + } + val = System.getProperty("launcher_version"); + if (val != null) { + System.out.println("Launcher version: " + val); + } + + // report Jalview version + Cache.loadBuildProperties(true); ArgsParser aparser = new ArgsParser(args); boolean headless = false; @@ -398,8 +396,9 @@ public class Jalview "Failed to set QuaQua look and feel: " + e.toString()); } } - if (lookAndFeel == null || !(lookAndFeel.getClass() - .isAssignableFrom(UIManager.getLookAndFeel().getClass())) + if (lookAndFeel == null + || !(lookAndFeel.getClass().isAssignableFrom( + UIManager.getLookAndFeel().getClass())) || !UIManager.getLookAndFeel().getClass().toString() .toLowerCase().contains("quaqua")) { @@ -417,27 +416,28 @@ public class Jalview } /* - * configure 'full' SO model if preferences say to, - * else use the default (SO Lite) + * configure 'full' SO model if preferences say to, else use the default (full SO) + * - as JS currently doesn't have OBO parsing, it must use 'Lite' version */ - if (Cache.getDefault("USE_FULL_SO", false)) + boolean soDefault = !Platform.isJS(); + if (Cache.getDefault("USE_FULL_SO", soDefault)) { SequenceOntologyFactory.setInstance(new SequenceOntology()); } if (!headless) { - desktop = new Desktop() -// { -// // BH testing -// @Override -// protected void processEvent(AWTEvent e) { -// System.out.println("Jalview.java " + e); -// super.processEvent(e); -// } -// } - ; + desktop = new Desktop(); desktop.setInBatchMode(true); // indicate we are starting up + + try + { + JalviewTaskbar.setTaskbar(this); + } catch (Throwable t) + { + System.out.println("Error setting Taskbar: " + t.getMessage()); + } + desktop.setVisible(true); if (!Platform.isJS()) @@ -500,6 +500,25 @@ public class Jalview } } + // Move any new getdown-launcher-new.jar into place over old + // getdown-launcher.jar + String appdirString = System.getProperty("getdownappdir"); + if (appdirString != null && appdirString.length() > 0) + { + final File appdir = new File(appdirString); + new Thread() + { + @Override + public void run() + { + LaunchUtil.upgradeGetdown( + new File(appdir, "getdown-launcher-old.jar"), + new File(appdir, "getdown-launcher.jar"), + new File(appdir, "getdown-launcher-new.jar")); + } + }.start(); + } + String file = null, data = null; FileFormatI format = null; DataSourceType protocol = null; @@ -516,91 +535,6 @@ public class Jalview System.out.println("No files to open!"); System.exit(1); } - String vamsasImport = aparser.getValue("vdoc"); - String vamsasSession = aparser.getValue("vsess"); - if (vamsasImport != null || vamsasSession != null) - { - if (desktop == null || headless) - { - System.out.println( - "Headless vamsas sessions not yet supported. Sorry."); - System.exit(1); - } - // if we have a file, start a new session and import it. - boolean inSession = false; - if (vamsasImport != null) - { - try - { - DataSourceType viprotocol = AppletFormatAdapter - .checkProtocol(vamsasImport); - if (viprotocol == DataSourceType.FILE) - { - inSession = desktop.vamsasImport(new File(vamsasImport)); - } - else if (viprotocol == DataSourceType.URL) - { - inSession = desktop.vamsasImport(new URL(vamsasImport)); - } - - } catch (Exception e) - { - System.err.println("Exeption when importing " + vamsasImport - + " as a vamsas document."); - e.printStackTrace(); - } - if (!inSession) - { - System.err.println("Failed to import " + vamsasImport - + " as a vamsas document."); - } - else - { - System.out.println("Imported Successfully into new session " - + desktop.getVamsasApplication().getCurrentSession()); - } - } - if (vamsasSession != null) - { - if (vamsasImport != null) - { - // close the newly imported session and import the Jalview specific - // remnants into the new session later on. - desktop.vamsasStop_actionPerformed(null); - } - // now join the new session - try - { - if (desktop.joinVamsasSession(vamsasSession)) - { - System.out.println( - "Successfully joined vamsas session " + vamsasSession); - } - else - { - System.err.println("WARNING: Failed to join vamsas session " - + vamsasSession); - } - } catch (Exception e) - { - System.err.println( - "ERROR: Failed to join vamsas session " + vamsasSession); - e.printStackTrace(); - } - if (vamsasImport != null) - { - // the Jalview specific remnants can now be imported into the new - // session at the user's leisure. - Cache.log.info( - "Skipping Push for import of data into existing vamsas session."); // TODO: - // enable - // this - // when - // debugged - // desktop.getVamsasApplication().push_update(); - } - } - } long progress = -1; // Finally, deal with the remaining input data. if (file != null) @@ -659,9 +593,8 @@ public class Jalview { data.replaceAll("%20", " "); - ColourSchemeI cs = ColourSchemeProperty - .getColourScheme(af.getViewport(), - af.getViewport().getAlignment(), data); + ColourSchemeI cs = ColourSchemeProperty.getColourScheme( + af.getViewport(), af.getViewport().getAlignment(), data); if (cs != null) { @@ -848,16 +781,15 @@ public class Jalview // //////////////////// if (!Platform.isJS() && !headless && file == null - && vamsasImport == null - && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true)) + && Cache.getDefault("SHOW_STARTUP_FILE", true)) /** * Java only * * @j2sIgnore */ { - file = jalview.bin.Cache.getDefault("STARTUP_FILE", - jalview.bin.Cache.getDefault("www.jalview.org", + file = Cache.getDefault("STARTUP_FILE", + Cache.getDefault("www.jalview.org", "http://www.jalview.org") + "/examples/exampleFile_2_7.jar"); if (file.equals( @@ -866,7 +798,7 @@ public class Jalview // hardwire upgrade of the startup file file.replace("_2_3.jar", "_2_7.jar"); // and remove the stale setting - jalview.bin.Cache.removeProperty("STARTUP_FILE"); + Cache.removeProperty("STARTUP_FILE"); } protocol = DataSourceType.FILE; @@ -959,10 +891,6 @@ public class Jalview // passed in correctly)" + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n" + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n" - // + - // "-vdoc vamsas-document\tImport vamsas document into new - // session or join existing session with same URN\n" - // + "-vses vamsas-session\tJoin session with given URN\n" + "-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" + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n"); } @@ -1002,10 +930,10 @@ public class Jalview * Locate the given string as a file and pass it to the groovy interpreter. * * @param groovyscript - * the script to execute + * the script to execute * @param jalviewContext - * the Jalview Desktop object passed in to the groovy binding as the - * 'Jalview' object. + * the Jalview Desktop object passed in to the groovy + * binding as the 'Jalview' object. */ private void executeGroovyScript(String groovyscript, AlignFrame af) { @@ -1092,7 +1020,7 @@ public class Jalview } try { - Map vbinding = new HashMap<>(); + Map vbinding = new HashMap<>(); vbinding.put("Jalview", this); if (af != null) { @@ -1134,8 +1062,8 @@ public class Jalview } /** - * Quit method delegates to Desktop.quit - unless running in headless mode - * when it just ends the JVM + * Quit method delegates to Desktop.quit - unless running in headless mode when + * it just ends the JVM */ public void quit() {