JAL-3253 temporary branch SwingJS upgrade with testNG fixes Java 8
[jalview.git] / src / jalview / bin / ApplicationSingletonProvider.java
index 45ec8ab..1b90259 100644 (file)
@@ -80,21 +80,13 @@ public class ApplicationSingletonProvider
    * 
    * @return
    */
+  @SuppressWarnings("unchecked")
   private static Map<Class<? extends ApplicationSingletonI>, ApplicationSingletonI> getContextMap()
   {
-    @SuppressWarnings("unused")
-    ThreadGroup g = (Platform.isJS()
-            ? Thread.currentThread().getThreadGroup()
-            : null);
-    Map<Class<? extends ApplicationSingletonI>, ApplicationSingletonI> map = singletons;
-    /** @j2sNative map = g._swingjsSingletons; */
-    if (map == null)
-    {
-      map = new HashMap<>();
-      /** @j2sNative g._swingjsSingletons = map; */
-    }
-
-    return map;
+    return (Platform.isJS()
+            ? (Map<Class<? extends ApplicationSingletonI>, ApplicationSingletonI>) Platform
+                    .getJSSingletons()
+            : singletons);
   }
 
   /**
@@ -140,15 +132,10 @@ public class ApplicationSingletonProvider
      * store the new singleton; note that a
      * null value is saved if construction failed
      */
-    setInstance(c, o);
+    getContextMap().put(c, o);
     return o;
   }
 
-  public static void setInstance(Class<? extends ApplicationSingletonI> c,
-          ApplicationSingletonI o)
-  {
-    getContextMap().put(c, o);
-  }
   /**
    * Removes the current singleton instance of the given class from the current
    * application context. This has the effect of ensuring that a new instance is