From f8f41a0fd06d618ddb42f95ec102e98cf21584c1 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 10 May 2018 13:34:59 +0100 Subject: [PATCH] JAL-2629 handle decline 'Add Database' --- src/jalview/gui/AlignFrame.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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) -- 1.7.10.2