From: Niki Roo Date: Sat, 25 Apr 2020 19:21:03 +0000 (+0200) Subject: fix imprtFile on cancel X-Git-Tag: fanfix-swing-1.0.0~31 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=6612a28c2da6411b03d2187faf570b45849e381c;p=fanfix-swing.git fix imprtFile on cancel --- 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) {