JAL-3253 preliminary static fixes for JavaScript part 3 of 3
[jalview.git] / src / jalview / analysis / AlignmentSorter.java
index 427db84..b764787 100755 (executable)
@@ -22,6 +22,7 @@ package jalview.analysis;
 
 import jalview.analysis.scoremodels.PIDModel;
 import jalview.analysis.scoremodels.SimilarityParams;
+import jalview.bin.Jalview;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AlignmentOrder;
@@ -29,7 +30,6 @@ import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.SequenceNode;
-import jalview.util.Platform;
 import jalview.util.QuickSort;
 
 import java.util.ArrayList;
@@ -67,41 +67,12 @@ public class AlignmentSorter
 
   public static final String FEATURE_DENSITY = "density";
 
-  static AlignmentSorter instance;
-
   public static AlignmentSorter getInstance()
   {
-
-    // BH 2019.05.08 need to isolate static fields in JavaScript
-
-    AlignmentSorter i = instance;
-    @SuppressWarnings("unused")
-    ThreadGroup g = null;
-    if (Platform.isJS())
-    {
-      g = Thread.currentThread().getThreadGroup();
-      /**
-       * @j2sNative i = g._jalviewAlignmentSorterInstance;
-       * 
-       */
-    }
-    if (i == null)
-    {
-      i = new AlignmentSorter();
-
-      if (Platform.isJS())
-      {
-        /**
-         * @j2sNative g._jalviewAlignmentSorterInstance = i;
-         * 
-         */
-      }
-      else
-      {
-        instance = i;
-      }
-    }
-    return i;
+    Jalview j = Jalview.getInstance();
+    return (j.alignmentSorter == null
+            ? j.alignmentSorter = new AlignmentSorter()
+            : j.alignmentSorter);
   }
 
   /*