From: tcofoegbu Date: Thu, 13 Aug 2015 12:39:46 +0000 (+0100) Subject: JAL-1826 bug fix to select pdb sequence fetcher via enter key X-Git-Tag: Release_2_10_0~542 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=08643e75e18b16562e90e9b42c0b327f9c46226b;p=jalview.git JAL-1826 bug fix to select pdb sequence fetcher via enter key --- 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;