prevent duplicate service submission links
authorjprocter <Jim Procter>
Thu, 1 Apr 2010 16:30:36 +0000 (16:30 +0000)
committerjprocter <Jim Procter>
Thu, 1 Apr 2010 16:30:36 +0000 (16:30 +0000)
src/jalview/ws/EnfinEnvision2OneWay.java

index 8905515..abde7e5 100644 (file)
@@ -11,6 +11,7 @@ import jalview.gui.AlignFrame;
 import jalview.gui.Desktop;
 import jalview.util.GroupUrlLink;
 
+import java.awt.Component;
 import java.awt.Cursor;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -208,6 +209,15 @@ public class EnfinEnvision2OneWay extends DefaultHandler implements Runnable,WSM
    */
   private void addshowLink(JMenu linkMenu, String label, String descr, final GroupUrlLink urlgenerator, final Object[] urlstub)
   {
+    Component[] jmi=linkMenu.getMenuComponents();
+    for (int i=0; i<jmi.length; i++)
+    {
+      if (jmi[i] instanceof JMenuItem && ((JMenuItem)jmi[i]).getText().equalsIgnoreCase(label))
+      {
+        // don't add this - its a repeat of an existing URL.
+        return;
+      }
+    }
     JMenuItem item = new JMenuItem(label);
     item.setToolTipText("Submit ("+urlgenerator.getNumberInvolved(urlstub)+" seqs) to workflow: "+descr);
     item.addActionListener(new java.awt.event.ActionListener()