JAL-1563 Added fix to prevent swing timer from reinitiating search action when jalvie...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Wed, 27 Apr 2016 15:36:20 +0000 (16:36 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Wed, 27 Apr 2016 15:36:20 +0000 (16:36 +0100)
src/jalview/fts/core/GFTSPanel.java

index cae271d..0b23503 100644 (file)
@@ -96,6 +96,8 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
 
   protected Collection<FTSDataColumnI> wantedFields;
 
+  private String lastSearchTerm = "";
+
   private JTable tbl_summary = new JTable()
   {
     @Override
@@ -364,7 +366,11 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
               @Override
               public void actionPerformed(ActionEvent e)
               {
-                searchAction();
+                if (!getTypedText().equalsIgnoreCase(lastSearchTerm))
+                {
+                  searchAction();
+                  lastSearchTerm = getTypedText();
+                }
               }
             }, false);
     txt_search.getDocument().addDocumentListener(listener);