default behavior if rename map is empty

This commit is contained in:
Reinhard Pointner 2016-11-25 08:03:59 +08:00
parent 0a14298e8d
commit d03794600b
1 changed files with 8 additions and 4 deletions

View File

@ -64,6 +64,11 @@ public class CmdlineOperationsTextUI extends CmdlineOperations {
@Override
public List<File> renameAll(Map<File, File> renameMap, RenameAction renameAction, ConflictAction conflictAction, List<Match<File, ?>> matches) throws Exception {
// default behavior if rename map is empty
if (renameMap.isEmpty()) {
return super.renameAll(renameMap, renameAction, conflictAction, matches);
}
// manually confirm each file mapping
Map<File, File> selection = onScreen(() -> confirmRenameMap(renameMap, renameAction, conflictAction));
@ -74,12 +79,11 @@ public class CmdlineOperationsTextUI extends CmdlineOperations {
protected List<SearchResult> selectSearchResult(String query, Collection<? extends SearchResult> options, boolean alias, boolean strict) throws Exception {
List<SearchResult> matches = getProbableMatches(query, options, alias, false);
// manually select option if there is more than one
if (matches.size() > 1) {
return onScreen(() -> confirmSearchResult(query, matches));
if (matches.size() < 2) {
return matches;
}
return matches;
return onScreen(() -> confirmSearchResult(query, matches)); // manually select option if there is more than one
}
protected List<SearchResult> confirmSearchResult(String query, List<SearchResult> options) {