mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2024-12-21 17:29:55 +00:00
Mod FilenameFilter to support JavaFX
(cherry-picked to fix AppleCommander/AppleCommander#13 since I've discovered that I was wrong and it does fix the problem after all!) cwa.storage.Disk.FileFilter was written for SWT, returning multiple extensions as a single string with ; separators. For JavaFX, we actually want individual strings separately or in a list. The only place these are initialized in cwa.storage.Disk anyway, so what I've done is change the class to instatiate with separate strings and join them on demand for SWT. A new getExtensionList() method will return them as-is for JavaFX.
This commit is contained in:
parent
6b4ef151a9
commit
bfaf30bffe
@ -62,12 +62,15 @@ public class Disk {
|
||||
*/
|
||||
public class FilenameFilter {
|
||||
private String names;
|
||||
private String extensions;
|
||||
public FilenameFilter(String names, String extensions) {
|
||||
private String[] extensions;
|
||||
public FilenameFilter(String names, String... extensions) {
|
||||
this.names = names;
|
||||
this.extensions = extensions;
|
||||
}
|
||||
public String getExtensions() {
|
||||
return String.join(";", extensions);
|
||||
}
|
||||
public String[] getExtensionList() {
|
||||
return extensions;
|
||||
}
|
||||
public String getNames() {
|
||||
@ -127,19 +130,19 @@ public class Disk {
|
||||
private Disk() {
|
||||
filenameFilters = new FilenameFilter[] {
|
||||
new FilenameFilter(textBundle.get("Disk.AllImages"), //$NON-NLS-1$
|
||||
"*.do; *.dsk; *.po; *.nib; *.2mg; *.2img; *.hdv; *.do.gz; *.dsk.gz; *.po.gz; *.nib.gz; *.2mg.gz; *.2img.gz"), //$NON-NLS-1$
|
||||
"*.do", "*.dsk", "*.po", "*.nib", "*.2mg", "*.2img", "*.hdv", "*.do.gz", "*.dsk.gz", "*.po.gz", "*.nib.gz", "*.2mg.gz", "*.2img.gz"), //$NON-NLS-1$
|
||||
new FilenameFilter(textBundle.get("Disk.140kDosImages"), //$NON-NLS-1$
|
||||
"*.do; *.dsk; *.do.gz; *.dsk.gz"), //$NON-NLS-1$
|
||||
"*.do", "*.dsk", "*.do.gz", "*.dsk.gz"), //$NON-NLS-1$
|
||||
new FilenameFilter(textBundle.get("Disk.140kNibbleImages"), //$NON-NLS-1$
|
||||
"*.nib; *.nib.gz"), //$NON-NLS-1$
|
||||
"*.nib", "*.nib.gz"), //$NON-NLS-1$
|
||||
new FilenameFilter(textBundle.get("Disk.140kProdosImages"), //$NON-NLS-1$
|
||||
"*.po; *.po.gz"), //$NON-NLS-1$
|
||||
"*.po", "*.po.gz"), //$NON-NLS-1$
|
||||
new FilenameFilter(textBundle.get("Disk.800kProdosImages"), //$NON-NLS-1$
|
||||
"*.2mg; *.2img; *.2mg.gz, *.2img.gz"), //$NON-NLS-1$
|
||||
"*.2mg", "*.2img", "*.2mg.gz", "*.2img.gz"), //$NON-NLS-1$
|
||||
new FilenameFilter(textBundle.get("Disk.ApplePcImages"), //$NON-NLS-1$
|
||||
"*.hdv"), //$NON-NLS-1$
|
||||
new FilenameFilter(textBundle.get("Disk.CompressedImages"), //$NON-NLS-1$
|
||||
"*.sdk; *.shk; *.do.gz; *.dsk.gz; *.po.gz; *.2mg.gz; *.2img.gz"), //$NON-NLS-1$
|
||||
"*.sdk", "*.shk", "*.do.gz", "*.dsk.gz", "*.po.gz", "*.2mg.gz", "*.2img.gz"), //$NON-NLS-1$
|
||||
new FilenameFilter(textBundle.get("Disk.AllFiles"), //$NON-NLS-1$
|
||||
"*.*") //$NON-NLS-1$
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user