From 40f19f22b137384e0225d1f7dfceb050522ab9d1 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 14 Oct 2016 00:25:43 +0800 Subject: [PATCH] Use Wait Cursor when loading/filtering files (can take a while because of listing files or because of loading Groovy classes) --- .../net/filebot/ui/rename/PresetEditor.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/source/net/filebot/ui/rename/PresetEditor.java b/source/net/filebot/ui/rename/PresetEditor.java index dc851205..851d56c4 100644 --- a/source/net/filebot/ui/rename/PresetEditor.java +++ b/source/net/filebot/ui/rename/PresetEditor.java @@ -391,19 +391,21 @@ public class PresetEditor extends JDialog { @Override public void actionPerformed(ActionEvent evt) { try { - List selectInputFiles = getPreset().selectInputFiles(evt); + withWaitCursor(evt.getSource(), () -> { + List selectInputFiles = getPreset().selectInputFiles(evt); - JPopupMenu popup = new JPopupMenu(); - if (selectInputFiles == null || selectInputFiles.isEmpty()) { - popup.add("No files selected").setEnabled(false); - } else { - for (File file : selectInputFiles) { - popup.add(createListItem(evt, file)); + JPopupMenu popup = new JPopupMenu(); + if (selectInputFiles == null || selectInputFiles.isEmpty()) { + popup.add("No files selected").setEnabled(false); + } else { + for (File file : selectInputFiles) { + popup.add(createListItem(evt, file)); + } } - } - JComponent source = (JComponent) evt.getSource(); - popup.show(source, -3, source.getHeight() + 4); + JComponent source = (JComponent) evt.getSource(); + popup.show(source, -3, source.getHeight() + 4); + }); } catch (Exception e) { log.log(Level.WARNING, "Invalid preset settings: " + e.getMessage(), e); }