* 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: case Music:
return new AudioTrackFormat(); return new AudioTrackFormat();
default: default:
return new FileFormat(); return new FileNameFormat();
} }
} }

View File

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