Changeset 1978 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2009-08-13T20:36:35+02:00 (15 years ago)
Author:
stoecker
Message:

close #3048 - patch by dmuecke - better defaults in file dialog

File:
1 edited

Legend:

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

    r1949 r1978  
    55
    66import java.io.File;
     7
    78import javax.swing.JFileChooser;
     9import javax.swing.filechooser.FileFilter;
     10
    811import org.openstreetmap.josm.Main;
    912import org.openstreetmap.josm.gui.ExtendedDialog;
     13import org.openstreetmap.josm.io.FileImporter;
    1014import org.openstreetmap.josm.tools.Shortcut;
    11 import org.openstreetmap.josm.io.FileImporter;
    1215
    1316/**
     
    3134
    3235        fc.setMultiSelectionEnabled(multiple);
     36        fc.setAcceptAllFileFilterUsed(false);
     37        FileFilter defaultFilter = null;
    3338        for (FileImporter imExporter: ExtensionFileFilter.importers) {
    3439            fc.addChoosableFileFilter(imExporter.filter);
     40            if (imExporter.filter.defaultExtension.endsWith("osm")) {
     41                defaultFilter = imExporter.filter;
     42            }
     43
    3544        }
    3645
    37         fc.setAcceptAllFileFilterUsed(true);
     46        if (defaultFilter != null) {
     47            fc.setFileFilter(defaultFilter);
     48        }
     49
    3850
    3951        int answer = open ? fc.showOpenDialog(Main.parent) : fc.showSaveDialog(Main.parent);
Note: See TracChangeset for help on using the changeset viewer.