From cf5275bfdbb94ba969f954d4c88d276884550d6b Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 15 Jun 2018 03:00:11 +0700 Subject: [PATCH] Experiment with user prompts --- source/net/filebot/ui/rename/RenameAction.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/net/filebot/ui/rename/RenameAction.java b/source/net/filebot/ui/rename/RenameAction.java index face0f7b..c2712be2 100644 --- a/source/net/filebot/ui/rename/RenameAction.java +++ b/source/net/filebot/ui/rename/RenameAction.java @@ -87,6 +87,7 @@ class RenameAction extends AbstractAction { Map renameLog = new LinkedHashMap(); try { + // require valid license for rename mode LICENSE.check(); if (useNativeShell() && NativeRenameAction.isSupported(action)) { @@ -100,9 +101,12 @@ class RenameAction extends AbstractAction { ProgressMonitor.runTask(action.getDisplayName(), message, worker).get(); } } catch (LicenseError e) { - JComponent source = (JComponent) evt.getSource(); - createLicensePopup(e.getMessage(), evt).show(source, -3, source.getHeight() + 4); - return; + if (LICENSE.isFile()) { + JComponent source = (JComponent) evt.getSource(); + createLicensePopup(e.getMessage(), evt).show(source, -3, source.getHeight() + 4); + } else { + log.severe(e::getMessage); + } } catch (CancellationException e) { debug.finest(e::toString); } catch (Throwable e) { @@ -232,12 +236,12 @@ class RenameAction extends AbstractAction { return emptyMap(); } - private ActionPopup createLicensePopup(String message, ActionEvent parent) { + private ActionPopup createLicensePopup(String message, ActionEvent evt) { ActionPopup actionPopup = new ActionPopup("License Required", ResourceManager.getIcon("file.lock")); actionPopup.add(newAction("Select License", ResourceManager.getIcon("license.import"), e -> { - withWaitCursor(parent.getSource(), () -> { - List files = UserFiles.FileChooser.AWT.showLoadDialogSelectFiles(false, false, null, MediaTypes.LICENSE_FILES, "Select License", parent); + withWaitCursor(evt.getSource(), () -> { + List files = UserFiles.FileChooser.AWT.showLoadDialogSelectFiles(false, false, null, MediaTypes.LICENSE_FILES, "Select License", evt); if (files.size() > 0) { configureLicense(files.get(0)); SwingEventBus.getInstance().post(LICENSE);