* added missing file

This commit is contained in:
Reinhard Pointner 2014-06-29 12:22:01 +00:00
parent 8a75000ecd
commit c4fb1e1453
3 changed files with 24 additions and 3 deletions

View File

@ -0,0 +1,21 @@
package net.filebot.ui.rename;
import java.io.File;
import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;
import net.filebot.util.FileUtilities;
public class FileNameFormat extends Format {
@Override
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
return toAppendTo.append(FileUtilities.getName((File) obj));
}
@Override
public Object parseObject(String source, ParsePosition pos) {
return new File(source);
}
}

View File

@ -138,7 +138,7 @@ public class FormatDialog extends JDialog {
case Music:
return new AudioTrackFormat();
default:
return new FileFormat();
return new FileNameFormat();
}
}

View File

@ -128,7 +128,7 @@ public class RenamePanel extends JComponent {
try {
// restore custom music formatter
renameModel.useFormatter(File.class, new ExpressionFormatter(persistentFileFormat.getValue(), new FileFormat(), File.class));
renameModel.useFormatter(File.class, new ExpressionFormatter(persistentFileFormat.getValue(), new FileNameFormat(), File.class));
} catch (Exception e) {
// use default filename formatter
renameModel.useFormatter(File.class, new FileNameFormatter(renameModel.preserveExtension()));
@ -497,7 +497,7 @@ public class RenamePanel extends JComponent {
persistentMusicFormat.setValue(dialog.getFormat().getExpression());
break;
case File:
renameModel.useFormatter(File.class, new ExpressionFormatter(dialog.getFormat().getExpression(), new FileFormat(), File.class));
renameModel.useFormatter(File.class, new ExpressionFormatter(dialog.getFormat().getExpression(), new FileNameFormat(), File.class));
persistentFileFormat.setValue(dialog.getFormat().getExpression());
break;
}