From: BobHanson Date: Sat, 21 Mar 2020 23:39:59 +0000 (-0500) Subject: JAL-3560 Platform fixes. X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=8126d1deddd25b8bf138654bdebf153ad1693b19;p=jalview.git JAL-3560 Platform fixes. --- diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 8498e7f..b779c20 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -452,8 +452,10 @@ public class Platform public static void addJ2SBinaryType(String ext) { - - jsutil.addBinaryFileType(ext); + if (isJS()) + { + jsutil.addBinaryFileType(ext); + } } /** @@ -510,8 +512,7 @@ public class Platform public static Object parseJSON(String json) throws ParseException { - return (isJS() ? JSON.parse(json) - : new JSONParser().parse(json)); + return (isJS() ? JSON.parse(json) : new JSONParser().parse(json)); } public static Object parseJSON(Reader r) @@ -627,22 +628,20 @@ public class Platform public static void ensureJmol() { - if (!isJS()) + if (isJS()) { - return; + jsutil.loadResourceIfClassUnknown("core/core_jvjmol.z.js", + "org.jmol.viewer.Viewer"); } - jsutil.loadResourceIfClassUnknown("core/core_jvjmol.z.js", - "org.jmol.viewer.Viewer"); } public static void ensureRegex() { - if (!isJS()) + if (isJS()) { - return; - } jsutil.loadResourceIfClassUnknown("core/core_stevesoft.z.js", "com.stevesoft.pat.Regex"); + } } public static Regex newRegex(String searchString, String replaceString) @@ -756,7 +755,7 @@ public class Platform * * @return Map for static singleton classes unique to a given applet */ - public static HashMap getJSSingletons() + public static HashMap getJSSingletons() { return (isJS() ? jsutil.getJSContext("jssingletons") : null); } @@ -772,7 +771,7 @@ public class Platform { return new HashSet<>(16, 0.75f); } - + /** * Switch the flag in SwingJS to use or not use the JavaScript Map object in * any Hashtable, HashMap, or HashSet. Default is enabled.