mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 16:28:51 -05:00
* added missing file
This commit is contained in:
parent
8a75000ecd
commit
c4fb1e1453
21
source/net/filebot/ui/rename/FileNameFormat.java
Normal file
21
source/net/filebot/ui/rename/FileNameFormat.java
Normal 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);
|
||||
}
|
||||
}
|
@ -138,7 +138,7 @@ public class FormatDialog extends JDialog {
|
||||
case Music:
|
||||
return new AudioTrackFormat();
|
||||
default:
|
||||
return new FileFormat();
|
||||
return new FileNameFormat();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user