From 08643e75e18b16562e90e9b42c0b327f9c46226b Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Thu, 13 Aug 2015 13:39:46 +0100 Subject: [PATCH] JAL-1826 bug fix to select pdb sequence fetcher via enter key --- src/jalview/gui/JDatabaseTree.java | 4 ++++ src/jalview/gui/SequenceFetcher.java | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/jalview/gui/JDatabaseTree.java b/src/jalview/gui/JDatabaseTree.java index 94ac141..207c600 100644 --- a/src/jalview/gui/JDatabaseTree.java +++ b/src/jalview/gui/JDatabaseTree.java @@ -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(); } } diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index c330a92..6a0d010 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -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; -- 1.7.10.2