JAL-3253 jalview.bin.Instance streamlining
[jalview.git] / src / jalview / gui / SequenceFetcher.java
index 7b408a4..518654e 100755 (executable)
@@ -64,9 +64,9 @@ import javax.swing.SwingConstants;
  * If the selected source is Uniprot or PDB, a free text search panel is opened
  * instead to perform the search and selection.
  */
+@SuppressWarnings("serial")
 public class SequenceFetcher extends JPanel implements Runnable
 {
-  private static jalview.ws.SequenceFetcher sfetch = null;
 
   JLabel exampleAccession;
 
@@ -97,20 +97,6 @@ public class SequenceFetcher extends JPanel implements Runnable
   volatile boolean _isConstructing = false;
 
   /**
-   * Returns the shared instance of the SequenceFetcher client
-   * 
-   * @return
-   */
-  public static jalview.ws.SequenceFetcher getSequenceFetcherSingleton()
-  {
-    if (sfetch == null)
-    {
-      sfetch = new jalview.ws.SequenceFetcher();
-    }
-    return sfetch;
-  }
-
-  /**
    * Constructor given a client to receive any status or progress messages
    * (currently either the Desktop, or an AlignFrame panel)
    * 
@@ -132,7 +118,7 @@ public class SequenceFetcher extends JPanel implements Runnable
           final String selectedDb, final String queryString)
   {
     this.progressIndicator = guiIndic;
-    getSequenceFetcherSingleton();
+
     this.guiWindow = progressIndicator;
 
     if (progressIndicator instanceof AlignFrame)
@@ -164,7 +150,8 @@ public class SequenceFetcher extends JPanel implements Runnable
     database = new JComboBox<>();
     database.setFont(JvSwingUtils.getLabelFont());
     database.setPrototypeDisplayValue("ENSEMBLGENOMES   ");
-    String[] sources = new jalview.ws.SequenceFetcher().getSupportedDb();
+    String[] sources = jalview.ws.SequenceFetcher.getInstance()
+            .getSupportedDb();
     Arrays.sort(sources, String.CASE_INSENSITIVE_ORDER);
     database.addItem(MessageManager.getString("action.select_ddbb"));
     for (String source : sources)
@@ -315,7 +302,8 @@ public class SequenceFetcher extends JPanel implements Runnable
   {
     StringBuilder sb = new StringBuilder();
     HashSet<String> hs = new HashSet<>();
-    for (DbSourceProxy dbs : sfetch.getSourceProxy(db))
+    for (DbSourceProxy dbs : jalview.ws.SequenceFetcher.getInstance()
+            .getSourceProxy(db))
     {
       String tq = dbs.getTestQuery();
       if (hs.add(tq)) // not a duplicate source
@@ -463,7 +451,7 @@ public class SequenceFetcher extends JPanel implements Runnable
     List<String> presultTitle = new ArrayList<>();
     List<AlignmentI> presult = new ArrayList<>();
     List<AlignmentI> aresult = new ArrayList<>();
-    List<DbSourceProxy> sources = sfetch
+    List<DbSourceProxy> sources = jalview.ws.SequenceFetcher.getInstance()
             .getSourceProxy((String) database.getSelectedItem());
     Iterator<DbSourceProxy> proxies = sources.iterator();
     String[] qries = textArea.getText().trim().split(";");