Notify the user if background computation is still in progress

This commit is contained in:
Reinhard Pointner 2018-09-01 12:13:49 +07:00
parent 9d15ac34b4
commit 06eb06830d
2 changed files with 9 additions and 3 deletions

View File

@ -72,9 +72,15 @@ class RenameAction extends AbstractAction {
Window window = getWindow(evt.getSource());
withWaitCursor(window, () -> {
Map<File, File> renameMap = validate(model.getRenameMap(), window);
// prepare rename map (abort and notify the user if background computation is still in progress)
Map<File, File> renameMap = null;
try {
renameMap = validate(model.getRenameMap(), window);
} catch (Exception e) {
log.log(Level.WARNING, e::getMessage);
}
if (renameMap.isEmpty()) {
if (renameMap == null || renameMap.isEmpty()) {
return;
}

View File

@ -92,7 +92,7 @@ public class RenameModel extends MatchModel<Object, File> {
} catch (ExecutionException e) {
throw new IllegalStateException(String.format("\"%s\" could not be formatted: %s.", task.preview(), e.getCause().getMessage()));
} catch (TimeoutException e) {
throw new IllegalStateException(String.format("\"%s\" has not been formatted yet.", task.preview()));
throw new IllegalStateException(String.format("\"%s\" has not been formatted yet. Applying custom formats may take a while.", task.preview()));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}