From: TZVanaalten Date: Tue, 15 Aug 2017 16:10:10 +0000 (+0100) Subject: JAL-2629 configure file chooser to select either a folder or a file X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9b62eba8c12e2739460f2f96e6b597a64b2bf12f;p=jalview.git JAL-2629 configure file chooser to select either a folder or a file --- diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 68dc27b..289434a 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -476,7 +476,7 @@ public class GPreferences extends JPanel { if (e.getClickCount() == 2) { - String chosen = openFileChooser(); + String chosen = openFileChooser(true); if (chosen != null) { hmmerPath.setText(chosen); @@ -1185,7 +1185,7 @@ public class GPreferences extends JPanel { if (e.getClickCount() == 2) { - String chosen = openFileChooser(); + String chosen = openFileChooser(false); if (chosen != null) { chimeraPath.setText(chosen); @@ -1240,10 +1240,14 @@ public class GPreferences extends JPanel * * @return */ - protected String openFileChooser() + protected String openFileChooser(boolean forFolder) { String choice = null; JFileChooser chooser = new JFileChooser(); + if (forFolder) + { + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + } // chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager