X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=e890cb85bd00a5cfc35c166152a4b05c74b92004;hb=2cbf9d005db462396fa1dc0750aa63a2e6cd0735;hp=287096d00e96ad838a45e642c5a2ce99b7bfd770;hpb=b4f18a095a262cc7c0b53cb07e712d06afab723f;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 287096d..e890cb8 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -61,6 +61,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Vector; +import javax.swing.LookAndFeel; import javax.swing.UIManager; import groovy.lang.Binding; @@ -76,6 +77,9 @@ import groovy.util.GroovyScriptEngine; */ public class Jalview { + + // BH 6/19/2018 starting to work on JS version - just discovering issues + /* * singleton instance of this class */ @@ -85,8 +89,14 @@ public class Jalview public static AlignFrame currentAlignFrame; + public static boolean isJS = /** @j2sNative true || */ // BH 2018 + false; + static { + + if (!isJS) + { // BH 2018 // grab all the rights we can the JVM Policy.setPolicy(new Policy() { @@ -103,6 +113,8 @@ public class Jalview { } }); + + } } /** @@ -148,7 +160,6 @@ public class Jalview af.setProgressBar(MessageManager .getString("status.das_features_being_retrived"), id); af.featureSettings_actionPerformed(null); - af.featureSettings.fetchDasFeatures(dasSources, true); af.setProgressBar(null, id); synchronized (us) { @@ -187,7 +198,12 @@ public class Jalview */ void doMain(String[] args) { - System.setSecurityManager(null); + + if (!isJS) + { + System.setSecurityManager(null); + } + System.out .println("Java version: " + System.getProperty("java.version")); System.out.println(System.getProperty("os.arch") + " " @@ -197,17 +213,6 @@ public class Jalview ArgsParser aparser = new ArgsParser(args); boolean headless = false; - if (aparser.contains("help") || aparser.contains("h")) - { - showUsage(); - System.exit(0); - } - if (aparser.contains("nodisplay") || aparser.contains("nogui") - || aparser.contains("headless")) - { - System.setProperty("java.awt.headless", "true"); - headless = true; - } String usrPropsFile = aparser.getValue("props"); Cache.loadProperties(usrPropsFile); // must do this before if (usrPropsFile != null) @@ -216,23 +221,41 @@ public class Jalview "CMD [-props " + usrPropsFile + "] executed successfully!"); } - // anything else! - - final String jabawsUrl = aparser.getValue("jabaws"); - if (jabawsUrl != null) + /** + * BH 2018 ignoring this section for JS + * + * @j2sNative + */ { - try + if (aparser.contains("help") || aparser.contains("h")) { - Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl); - System.out.println( - "CMD [-jabaws " + jabawsUrl + "] executed successfully!"); - } catch (MalformedURLException e) + showUsage(); + System.exit(0); + } + if (aparser.contains("nodisplay") || aparser.contains("nogui") + || aparser.contains("headless")) { - System.err.println( - "Invalid jabaws parameter: " + jabawsUrl + " ignored"); + System.setProperty("java.awt.headless", "true"); + headless = true; } - } + // anything else! + final String jabawsUrl = aparser.getValue("jabaws"); + if (jabawsUrl != null) + { + try + { + Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl); + System.out.println( + "CMD [-jabaws " + jabawsUrl + "] executed successfully!"); + } catch (MalformedURLException e) + { + System.err.println( + "Invalid jabaws parameter: " + jabawsUrl + " ignored"); + } + } + + } String defs = aparser.getValue("setprop"); while (defs != null) { @@ -280,25 +303,32 @@ public class Jalview } if (Platform.isAMac()) { + + LookAndFeel lookAndFeel = ch.randelshofer.quaqua.QuaquaManager + .getLookAndFeel(); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Jalview"); System.setProperty("apple.laf.useScreenMenuBar", "true"); - try - { - UIManager.setLookAndFeel( - ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel()); - } catch (Throwable e) + if (lookAndFeel != null) { - System.err.println( - "Failed to set QuaQua look and feel: " + e.toString()); + try + { + UIManager.setLookAndFeel(lookAndFeel); + } catch (Throwable e) + { + System.err.println( + "Failed to set QuaQua look and feel: " + e.toString()); + } } - if (!ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel() - .equals(UIManager.getLookAndFeel())) + if (lookAndFeel == null || !(lookAndFeel.getClass() + .isAssignableFrom(UIManager.getLookAndFeel().getClass())) + || !UIManager.getLookAndFeel().getClass().toString() + .toLowerCase().contains("quaqua")) { try { System.err.println( - "Quaqua LaF not available. Using VAqua(4)."); + "Quaqua LaF not available on this plaform. Using VAqua(4).\nSee https://issues.jalview.org/browse/JAL-2976"); UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel"); } catch (Throwable e) { @@ -322,55 +352,65 @@ public class Jalview desktop = new Desktop(); desktop.setInBatchMode(true); // indicate we are starting up desktop.setVisible(true); - desktop.startServiceDiscovery(); - if (!aparser.contains("nousagestats")) - { - startUsageStats(desktop); - } - else - { - System.err.println("CMD [-nousagestats] executed successfully!"); - } - if (!aparser.contains("noquestionnaire")) + /** + * BH 2018 JS bypass this section + * + * @j2sNative + * + */ { - String url = aparser.getValue("questionnaire"); - if (url != null) + desktop.startServiceDiscovery(); + if (!aparser.contains("nousagestats")) { - // Start the desktop questionnaire prompter with the specified - // questionnaire - Cache.log.debug("Starting questionnaire url at " + url); - desktop.checkForQuestionnaire(url); - System.out.println( - "CMD questionnaire[-" + url + "] executed successfully!"); + startUsageStats(desktop); } else { - if (Cache.getProperty("NOQUESTIONNAIRES") == null) + System.err.println("CMD [-nousagestats] executed successfully!"); + } + + if (!aparser.contains("noquestionnaire")) + { + String url = aparser.getValue("questionnaire"); + if (url != null) { // Start the desktop questionnaire prompter with the specified // questionnaire - // String defurl = - // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl"; - // // - String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl"; - Cache.log.debug( - "Starting questionnaire with default url: " + defurl); - desktop.checkForQuestionnaire(defurl); + Cache.log.debug("Starting questionnaire url at " + url); + desktop.checkForQuestionnaire(url); + System.out.println("CMD questionnaire[-" + url + + "] executed successfully!"); + } + else + { + if (Cache.getProperty("NOQUESTIONNAIRES") == null) + { + // Start the desktop questionnaire prompter with the specified + // questionnaire + // String defurl = + // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl"; + // // + String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl"; + Cache.log.debug( + "Starting questionnaire with default url: " + defurl); + desktop.checkForQuestionnaire(defurl); + } } } - } - else - { - System.err.println("CMD [-noquestionnaire] executed successfully!"); - } + else + { + System.err + .println("CMD [-noquestionnaire] executed successfully!"); + } - if (!aparser.contains("nonews")) - { - desktop.checkForNews(); - } + if (!aparser.contains("nonews")) + { + desktop.checkForNews(); + } - BioJsHTMLOutput.updateBioJS(); + BioJsHTMLOutput.updateBioJS(); + } } String file = null, data = null; @@ -490,7 +530,7 @@ public class Jalview } System.out.println("CMD [-open " + file + "] executed successfully!"); - if (!file.startsWith("http://")) + if (!isJS && !file.startsWith("http://")) { if (!(new File(file)).exists()) { @@ -502,7 +542,7 @@ public class Jalview } } - protocol = AppletFormatAdapter.checkProtocol(file); + protocol = AppletFormatAdapter.checkProtocol(file); try { @@ -709,7 +749,8 @@ public class Jalview continue; } - if (af.saveAlignment(file, format)) + af.saveAlignment(file, format); + if (af.isSaveAlignmentSuccessful()) { System.out.println("Written alignment in " + format + " format to " + file); @@ -733,7 +774,8 @@ public class Jalview // And the user // //////////////////// - if (!headless && file == null && vamsasImport == null + if (/** @j2sNative false && */ // BH 2018 + !headless && file == null && vamsasImport == null && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true)) { file = jalview.bin.Cache.getDefault("STARTUP_FILE",