Changeset 5573 in josm


Ignore:
Timestamp:
2012-11-08T18:54:08+01:00 (9 years ago)
Author:
bastiK
Message:

add *.* file filter at 2 more places

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

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

    r5438 r5573  
    88import java.io.File;
    99import java.io.IOException;
     10import java.util.Arrays;
    1011import java.util.List;
    1112
     
    1920import org.openstreetmap.josm.gui.layer.Layer;
    2021import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     22import org.openstreetmap.josm.gui.util.FileFilterAllFiles;
    2123import org.openstreetmap.josm.io.IllegalDataException;
    2224import org.openstreetmap.josm.io.session.SessionReader;
     
    3133    public void actionPerformed(ActionEvent e) {
    3234        ExtensionFileFilter ff = new ExtensionFileFilter("jos,joz", "jos", tr("Session file (*.jos, *.joz)"));
    33         JFileChooser fc = createAndOpenFileChooser(true, false, tr("Open session"), ff, JFileChooser.FILES_ONLY, "lastDirectory");
     35        JFileChooser fc = createAndOpenFileChooser(true, false, tr("Open session"), Arrays.asList(ff, FileFilterAllFiles.getInstance()), ff, JFileChooser.FILES_ONLY, "lastDirectory");
    3436        if (fc == null) return;
    3537        File file = fc.getSelectedFile();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r5538 r5573  
    1212import java.awt.Point;
    1313import java.awt.Rectangle;
    14 import java.awt.Window;
    1514import java.awt.event.ActionEvent;
    1615import java.awt.event.ActionListener;
    1716import java.awt.event.KeyEvent;
    1817import java.awt.event.MouseEvent;
    19 import java.awt.event.WindowAdapter;
    20 import java.awt.event.WindowEvent;
    2118import java.io.BufferedInputStream;
    2219import java.io.BufferedOutputStream;
     
    5451import javax.swing.event.ListSelectionEvent;
    5552import javax.swing.event.ListSelectionListener;
     53import javax.swing.filechooser.FileFilter;
    5654import javax.swing.table.AbstractTableModel;
    5755import javax.swing.table.DefaultTableCellRenderer;
     
    6058
    6159import org.openstreetmap.josm.Main;
     60import org.openstreetmap.josm.actions.ExtensionFileFilter;
    6261import org.openstreetmap.josm.gui.ExtendedDialog;
    6362import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     
    6766import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.MapPaintSylesUpdateListener;
    6867import org.openstreetmap.josm.gui.mappaint.StyleSource;
     68import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
    6969import org.openstreetmap.josm.gui.preferences.PreferenceDialog;
    7070import org.openstreetmap.josm.gui.preferences.SourceEntry;
     71import org.openstreetmap.josm.gui.util.FileFilterAllFiles;
    7172import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    7273import org.openstreetmap.josm.gui.widgets.JFileChooserManager;
     
    484485            JFileChooserManager fcm = new JFileChooserManager(false, "mappaint.clone-style.lastDirectory", System.getProperty("user.home"));
    485486            String suggestion = fcm.getInitialDirectory() + File.separator + s.getFileNamePart();
    486             fcm.createFileChooser().getFileChooser().setSelectedFile(new File(suggestion));
     487
     488            FileFilter ff;
     489            if (s instanceof MapCSSStyleSource) {
     490                ff = new ExtensionFileFilter("mapcss,css", "mapcss", tr("Map paint style file (*.mapcss)"));
     491            } else {
     492                ff = new ExtensionFileFilter("xml", "xml", tr("Map paint style file (*.xml)"));
     493            }
     494            fcm.createFileChooser(false, null, Arrays.asList(ff, FileFilterAllFiles.getInstance()), ff, JFileChooser.FILES_ONLY)
     495                    .getFileChooser().setSelectedFile(new File(suggestion));
    487496            JFileChooser fc = fcm.openFileChooser();
    488497            if (fc == null)
Note: See TracChangeset for help on using the changeset viewer.