* added status indicators for files that can't be renamed because target already exists or because source and target are the same path
@see http://www.filebot.net/forums/viewtopic.php?f=6&t=751#p4881
This commit is contained in:
parent
4208cb6557
commit
10f314ff7c
|
@ -105,8 +105,7 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer {
|
||||||
if (!renameModel.preserveExtension() && renameModel.hasComplement(index)) {
|
if (!renameModel.preserveExtension() && renameModel.hasComplement(index)) {
|
||||||
// absolute path mode
|
// absolute path mode
|
||||||
File file = renameModel.getMatch(index).getCandidate();
|
File file = renameModel.getMatch(index).getCandidate();
|
||||||
File targetDir = file.getParentFile();
|
File path = resolveAbsolutePath(file.getParentFile(), formattedFuture.toString(), null);
|
||||||
File path = resolveAbsolutePath(targetDir, formattedFuture.toString());
|
|
||||||
setText(isSelected || matchProbablity < 1 ? formatPath(path) : colorizePath(path, true));
|
setText(isSelected || matchProbablity < 1 ? formatPath(path) : colorizePath(path, true));
|
||||||
|
|
||||||
String ext = getExtension(path);
|
String ext = getExtension(path);
|
||||||
|
@ -148,7 +147,18 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer {
|
||||||
typeRenderer.setText(formattedFuture.getMatch().getValue().toString());
|
typeRenderer.setText(formattedFuture.getMatch().getValue().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if files already exist
|
||||||
|
FormattedFuture pathFuture = (FormattedFuture) value;
|
||||||
|
if (pathFuture.isDone() && !pathFuture.isCancelled()) {
|
||||||
|
File from = renameModel.getMatch(index).getCandidate();
|
||||||
|
File to = resolveAbsolutePath(from.getParentFile(), pathFuture.toString(), renameModel.preserveExtension() ? getExtension(from) : null);
|
||||||
|
if (from.equals(to)) {
|
||||||
|
setIcon(ResourceManager.getIcon("dialog.continue"));
|
||||||
|
} else if (to.exists()) {
|
||||||
|
setIcon(ResourceManager.getIcon("dialog.cancel"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,10 +197,10 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected File resolveAbsolutePath(File targetDir, String path) {
|
protected File resolveAbsolutePath(File targetDir, String path, String extension) {
|
||||||
File f = new File(path);
|
File f = new File(extension == null || extension.isEmpty() ? path : String.format("%s.%s", path, extension));
|
||||||
if (!f.isAbsolute()) {
|
if (!f.isAbsolute()) {
|
||||||
f = new File(targetDir, path); // resolve path against target folder
|
f = new File(targetDir, f.getPath()); // resolve path against target folder
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue