From 9b62eba8c12e2739460f2f96e6b597a64b2bf12f Mon Sep 17 00:00:00 2001 From: TZVanaalten Date: Tue, 15 Aug 2017 17:10:10 +0100 Subject: [PATCH] JAL-2629 configure file chooser to select either a folder or a file --- src/jalview/jbgui/GPreferences.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 -- 1.7.10.2