remove duplicate host URLs in service list when not indexing services by host
[jalview.git] / src / jalview / ws / jws2 / Jws2Discoverer.java
index 2ef9cfd..ceff8e4 100644 (file)
@@ -162,7 +162,10 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
     }
     System.out.println("Discovered service: " + jwsservers + " "
             + srv.toString());
-    services.add(new Jws2Instance(jwsservers, srv.toString(), service2));
+    Jws2Instance service = new Jws2Instance(jwsservers, srv.toString(), service2);
+
+    services.add(service);
+    service.getParamStore();
   }
 
   public class Jws2Instance
@@ -344,6 +347,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
 
     });
     wsmenu.add(jws2al);
+    
   }
 
   private void populateWSMenuEntry(JMenu jws2al, final AlignFrame alignFrame)
@@ -362,6 +366,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
     MsaWSClient msacl = new MsaWSClient();
     Vector hostLabels = new Vector();
     jws2al.removeAll();
+    String lasthost=null;
     for (final Jws2Instance service : services)
     {
       atpoint = jws2al;
@@ -390,9 +395,12 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
         // group
         JMenuItem hitm;
         atpoint.addSeparator();
-        atpoint.add(hitm = new JMenuItem(host));
-        hitm.setForeground(Color.blue);
-        hostLabels.addElement(host);
+        if (lasthost==null || !lasthost.equals(host))
+        {
+          atpoint.add(hitm = new JMenuItem(host));
+          hitm.setForeground(Color.blue);
+        }
+        hostLabels.addElement(lasthost=host);
       }
       msacl.attachWSMenuEntry(atpoint, service, alignFrame);
       /*