From 6612a28c2da6411b03d2187faf570b45849e381c Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sat, 25 Apr 2020 21:21:03 +0200 Subject: [PATCH] fix imprtFile on cancel --- .../fanfix_swing/gui/importer/ImporterFrame.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/be/nikiroo/fanfix_swing/gui/importer/ImporterFrame.java b/src/be/nikiroo/fanfix_swing/gui/importer/ImporterFrame.java index e73c9ea5..1216d806 100644 --- a/src/be/nikiroo/fanfix_swing/gui/importer/ImporterFrame.java +++ b/src/be/nikiroo/fanfix_swing/gui/importer/ImporterFrame.java @@ -141,13 +141,12 @@ public class ImporterFrame extends JFrame implements ListenerItem { public void imprtFile(final Container parent) { JFileChooser fc = new JFileChooser(); - - Progress pg = new Progress(); - add(pg, "File"); - if (fc.showOpenDialog(parent) != JFileChooser.CANCEL_OPTION) { Object url = fc.getSelectedFile().getAbsolutePath(); if (url != null && !url.toString().isEmpty()) { + Progress pg = new Progress(); + add(pg, "File"); + Actions.imprt(parent, url.toString(), pg, new Runnable() { @Override public void run() { @@ -184,9 +183,9 @@ public class ImporterFrame extends JFrame implements ListenerItem { basename = "unknown website"; } - add(pg, basename); // TODO: what when null? - if (url != null && !url.isEmpty()) { + add(pg, basename); + Actions.imprt(parent, url, pg, new Runnable() { @Override public void run() { @@ -196,8 +195,6 @@ public class ImporterFrame extends JFrame implements ListenerItem { setVisible(true); } - - // TODO what when not ok? } private void add(Progress pg, final String basename) { -- 2.27.0