remove duplicate host URLs in service list when not indexing services by host
authorjprocter <Jim Procter>
Thu, 9 Sep 2010 15:48:36 +0000 (15:48 +0000)
committerjprocter <Jim Procter>
Thu, 9 Sep 2010 15:48:36 +0000 (15:48 +0000)
src/jalview/ws/jws2/Jws2Discoverer.java

index dda8c4e..ceff8e4 100644 (file)
@@ -366,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;
@@ -394,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);
       /*