JAL-1826 bug fix to select pdb sequence fetcher via enter key
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 13 Aug 2015 12:39:46 +0000 (13:39 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 13 Aug 2015 12:39:46 +0000 (13:39 +0100)
src/jalview/gui/JDatabaseTree.java
src/jalview/gui/SequenceFetcher.java

index 94ac141..207c600 100644 (file)
@@ -60,6 +60,8 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener
 {
   boolean allowMultiSelections = false;
 
+  public int action;
+
   JButton getDatabaseSelectorButton()
   {
     final JButton viewdbs = new JButton(
@@ -544,10 +546,12 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener
   {
     if (!arg0.isConsumed() && arg0.getKeyCode() == KeyEvent.VK_ENTER)
     {
+      action = arg0.getKeyCode();
       okPressed();
     }
     if (!arg0.isConsumed() && arg0.getKeyChar() == KeyEvent.VK_ESCAPE)
     {
+      action = arg0.getKeyCode();
       cancelPressed();
     }
   }
index c330a92..6a0d010 100755 (executable)
@@ -358,18 +358,19 @@ public class SequenceFetcher extends JPanel implements Runnable
       {
         debounceTrap++;
         String currentSelection = database.getSelectedItem();
-
         if (!currentSelection.equalsIgnoreCase("pdb"))
         {
             otherSourceAction();
         }
-        if (currentSelection.equalsIgnoreCase("pdb") && ((debounceTrap % 2) == 0))
+        if (currentSelection.equalsIgnoreCase("pdb")
+                && (database.action == KeyEvent.VK_ENTER || ((debounceTrap % 2) == 0)))
         {
           pdbSourceAction();
         }
-
+        database.action = -1;
       }
     });
+
     dbeg.setText("");
     jPanel2.add(databaseButt, java.awt.BorderLayout.NORTH);
     jPanel2.add(dbeg, java.awt.BorderLayout.CENTER);
@@ -890,6 +891,8 @@ public class SequenceFetcher extends JPanel implements Runnable
     return progressIndicator;
   }
 
+
+
   public void setProgressIndicator(IProgressIndicator progressIndicator)
   {
     this.progressIndicator = progressIndicator;