no selection, do nothing and return successfully

This commit is contained in:
Reinhard Pointner 2016-11-25 19:06:05 +08:00
parent d03794600b
commit 5b693caf22
1 changed files with 6 additions and 1 deletions

View File

@ -53,7 +53,7 @@ public class CmdlineOperationsTextUI extends CmdlineOperations {
ui.setTheme(LanternaThemes.getRegisteredTheme(DEFAULT_THEME)); ui.setTheme(LanternaThemes.getRegisteredTheme(DEFAULT_THEME));
} }
public <T> T onScreen(Supplier<T> dialog) throws Exception { public synchronized <T> T onScreen(Supplier<T> dialog) throws Exception {
try { try {
screen.startScreen(); screen.startScreen();
return dialog.get(); return dialog.get();
@ -72,6 +72,11 @@ public class CmdlineOperationsTextUI extends CmdlineOperations {
// manually confirm each file mapping // manually confirm each file mapping
Map<File, File> selection = onScreen(() -> confirmRenameMap(renameMap, renameAction, conflictAction)); Map<File, File> selection = onScreen(() -> confirmRenameMap(renameMap, renameAction, conflictAction));
// no selection, do nothing and return successfully
if (selection.isEmpty()) {
return emptyList();
}
return super.renameAll(selection, renameAction, conflictAction, matches); return super.renameAll(selection, renameAction, conflictAction, matches);
} }