From: gmungoc Date: Thu, 10 May 2018 12:34:59 +0000 (+0100) Subject: JAL-2629 handle decline 'Add Database' X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f8f41a0fd06d618ddb42f95ec102e98cf21584c1;p=jalview.git JAL-2629 handle decline 'Add Database' --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index f258990..d52aa97 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1150,7 +1150,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } String path = openFileChooser(false); - if (new File(path).exists()) + if (path != null && new File(path).exists()) { IdentifyFile identifier = new IdentifyFile(); FileFormatI format = identifier.identify(path, DataSourceType.FILE); @@ -1178,21 +1178,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, MessageManager.getString("warn.invalid_format")); } } - else - { - JOptionPane.showMessageDialog(this, - MessageManager.getString("label.not_enough_sequences")); - } } /** - * Opens a file chooser + * Opens a file chooser, optionally restricted to selecting folders + * (directories) only. Answers the path to the selected file or folder, or + * null if none is chosen. * - * @param forFolder + * @param * @return */ protected String openFileChooser(boolean forFolder) { + // TODO duplicates GPreferences method - relocate to JalviewFileChooser? String choice = null; JFileChooser chooser = new JFileChooser(); if (forFolder)