Changeset 2020 in josm for trunk


Ignore:
Timestamp:
2009-08-31T09:40:29+02:00 (15 years ago)
Author:
Gubaer
Message:

new method signature for preparing file chooser

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DiskAccessAction.java

    r2001 r2020  
    2424
    2525    public static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, String title) {
     26        return createAndOpenFileChooser(open, multiple, title, null);
     27    }
     28
     29    public static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, String title, String extension) {
    2630        String curDir = Main.pref.get("lastDirectory");
    2731        if (curDir.equals("")) {
     
    3842        for (FileImporter imExporter: ExtensionFileFilter.importers) {
    3943            fc.addChoosableFileFilter(imExporter.filter);
    40             if (imExporter instanceof ExtensionFileFilter.AllFormatsImporter) {
     44            if (extension != null && extension.endsWith(imExporter.filter.defaultExtension)) {
    4145                defaultFilter = imExporter.filter;
    4246            }
    43 
    4447        }
    4548
    46         if (defaultFilter != null) {
    47             fc.setFileFilter(defaultFilter);
     49        if (defaultFilter == null) {
     50            defaultFilter = new ExtensionFileFilter.AllFormatsImporter().filter;
    4851        }
    49 
     52        fc.setFileFilter(defaultFilter);
    5053
    5154        int answer = open ? fc.showOpenDialog(Main.parent) : fc.showSaveDialog(Main.parent);
Note: See TracChangeset for help on using the changeset viewer.