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


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

fixed #8184 - Map paint settings: wrong file filter for adding local style files

Location:
trunk/src/org/openstreetmap/josm
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r5492 r5572  
    2727import java.net.URL;
    2828import java.util.ArrayList;
     29import java.util.Arrays;
    2930import java.util.Collection;
    3031import java.util.Collections;
     
    6667import javax.swing.event.TableModelEvent;
    6768import javax.swing.event.TableModelListener;
     69import javax.swing.filechooser.FileFilter;
    6870import javax.swing.table.AbstractTableModel;
    6971import javax.swing.table.DefaultTableCellRenderer;
     
    7274
    7375import org.openstreetmap.josm.Main;
     76import org.openstreetmap.josm.actions.ExtensionFileFilter;
    7477import org.openstreetmap.josm.gui.ExtendedDialog;
    7578import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    7679import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     80import org.openstreetmap.josm.gui.util.FileFilterAllFiles;
    7781import org.openstreetmap.josm.gui.widgets.JFileChooserManager;
    7882import org.openstreetmap.josm.io.MirroredInputStream;
     
    752756
    753757            public void actionPerformed(ActionEvent e) {
    754                 JFileChooserManager fcm = new JFileChooserManager(true).createFileChooser();
     758                FileFilter ff;
     759                if (isMapPaint) {
     760                    ff = new ExtensionFileFilter("xml,mapcss,css", "xml", tr("Map paint style file (*.xml, *.mapcss)"));
     761                } else {
     762                    ff = new ExtensionFileFilter("xml", "xml", tr("Preset definition file (*.xml)"));
     763                }
     764                JFileChooserManager fcm = new JFileChooserManager(true)
     765                        .createFileChooser(true, null, Arrays.asList(ff, FileFilterAllFiles.getInstance()), ff, JFileChooser.FILES_ONLY);
    755766                prepareFileChooser(tfURL.getText(), fcm.getFileChooser());
    756767                JFileChooser fc = fcm.openFileChooser(JOptionPane.getFrameForComponent(SourceEditor.this));
  • trunk/src/org/openstreetmap/josm/gui/widgets/JFileChooserManager.java

    r5457 r5572  
    4242     * @param open If true, "Open File" dialogs will be created. If false, "Save File" dialogs will be created.
    4343     * @param lastDirProperty The name of the property used to get the last directory. This directory is used to initialize the JFileChooser.
    44      *                        Then, if the user effetively choses a file or a directory, this property will be updated to the directory path.
     44     *                        Then, if the user effectively chooses a file or a directory, this property will be updated to the directory path.
    4545     * @see #createFileChooser
    4646     */
     
    5353     * @param open If true, "Open File" dialogs will be created. If false, "Save File" dialogs will be created.
    5454     * @param lastDirProperty The name of the property used to get the last directory. This directory is used to initialize the JFileChooser.
    55      *                        Then, if the user effetively choses a file or a directory, this property will be updated to the directory path.
     55     *                        Then, if the user effectively chooses a file or a directory, this property will be updated to the directory path.
    5656     * @param defaultDir The default directory used to initialize the JFileChooser if the {@code lastDirProperty} property value is missing.
    5757     * @see #createFileChooser
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r5551 r5572  
    1818import java.util.Enumeration;
    1919import java.util.HashMap;
    20 import java.util.LinkedHashMap;
    2120import java.util.List;
    2221import java.util.Map;
Note: See TracChangeset for help on using the changeset viewer.