check for crossreferences every time the menus are updated
authorjprocter <Jim Procter>
Fri, 15 Aug 2008 10:02:43 +0000 (10:02 +0000)
committerjprocter <Jim Procter>
Fri, 15 Aug 2008 10:02:43 +0000 (10:02 +0000)
src/jalview/gui/AlignFrame.java

index e64b8e4..10a9c95 100755 (executable)
@@ -515,11 +515,17 @@ public class AlignFrame
     {
       calculateMenu.remove(calculateMenu.getItemCount()-2);
     }
-    setShowProductsEnabled();
   }
 
 
-
+  /**
+   * set up menus for the currently viewport.
+   * This may be called after any operation that affects the data in the current view (selection changed, etc) to update the menus to reflect the new state.
+   */
+  public void setMenusForViewport()
+  {
+    setMenusFromViewport(viewport);
+  }
   /**
    * Need to call this method when tabs are selected for multiple views,
    * or when loading from Jalview2XML.java
@@ -550,6 +556,8 @@ public class AlignFrame
     hiddenMarkers.setState(av.showHiddenMarkers);
     applyToAllGroups.setState(av.colourAppliesToAllGroups);
 
+    setShowProductsEnabled();
+
     updateEditMenuBar();
   }
 
@@ -595,7 +603,8 @@ public class AlignFrame
 
       progressBars.put(new Long(id), progressPanel);
     }
-
+    // update GUI
+    setMenusForViewport();
     validate();
   }
   /**
@@ -3543,9 +3552,16 @@ public class AlignFrame
 
       public void actionPerformed(ActionEvent e)
       {
-        new jalview.ws.DBRefFetcher(
-                alignPanel.av.getSequenceSelection(),
-                alignPanel.alignFrame).fetchDBRefs(false);
+        javax.swing.SwingUtilities.invokeLater(new Runnable() {
+
+          public void run()
+          {
+            new jalview.ws.DBRefFetcher(
+                    alignPanel.av.getSequenceSelection(),
+                    alignPanel.alignFrame).fetchDBRefs(false);
+          }
+          
+        });
       }
 
     });
@@ -3613,7 +3629,7 @@ public class AlignFrame
           public void actionPerformed(ActionEvent e)
           {
             // TODO: new thread for this call with vis-delay
-            af.showProductsFor(sel, ds, isRegSel, dna, source);
+            af.showProductsFor(af.viewport.getSequenceSelection(), ds, isRegSel, dna, source);
           }
           
         });