JAL-2629 configure file chooser to select either a folder or a file
authorTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Tue, 15 Aug 2017 16:10:10 +0000 (17:10 +0100)
committerTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Tue, 15 Aug 2017 16:10:10 +0000 (17:10 +0100)
src/jalview/jbgui/GPreferences.java

index 68dc27b..289434a 100755 (executable)
@@ -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