Changeset 18113 in josm


Ignore:
Timestamp:
2021-08-02T02:35:03+02:00 (4 years ago)
Author:
Don-vip
Message:

fix #20990 - open dialog: new advanced property use.details.view.file.dialog to show the files in the details view by default (patch by Strubbl, modified)

Location:
trunk/src/org/openstreetmap/josm/gui/widgets
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/widgets/AbstractFileChooser.java

    r11023 r18113  
    77import java.util.Locale;
    88
     9import javax.swing.ActionMap;
    910import javax.swing.filechooser.FileFilter;
    1011
     
    215216     */
    216217    public abstract int showSaveDialog(Component parent);
     218
     219    /**
     220     * Gets the list of action names.
     221     *
     222     * @return a <code>ActionMap</code> array containing all the action names
     223     * @since 18113
     224     */
     225    public abstract ActionMap getActionMap();
    217226}
  • trunk/src/org/openstreetmap/josm/gui/widgets/FileChooserManager.java

    r17333 r18113  
    88import java.util.function.Predicate;
    99
     10import javax.swing.Action;
    1011import javax.swing.JFileChooser;
    1112import javax.swing.filechooser.FileFilter;
     
    3738            PlatformManager.isPlatformOsx());
    3839
     40    /**
     41     * Property to use the details view in file dialogs.
     42     */
     43    public static final BooleanProperty PROP_USE_DETAILS_VIEW_FILE_DIALOG = new BooleanProperty("use.details.view.file.dialog", false);
     44
    3945    private final boolean open;
    4046    private final String lastDirProperty;
     
    303309        } else {
    304310            fc = new SwingFileChooser(f);
     311            if (PROP_USE_DETAILS_VIEW_FILE_DIALOG.get()) {
     312                // See sun.swing.FilePane.ACTION_VIEW_DETAILS
     313                Action details = fc.getActionMap().get("viewTypeDetails");
     314                if (details != null) {
     315                    details.actionPerformed(null);
     316                }
     317            }
    305318        }
    306319
  • trunk/src/org/openstreetmap/josm/gui/widgets/NativeFileChooser.java

    r15287 r18113  
    99import java.util.List;
    1010
     11import javax.swing.ActionMap;
    1112import javax.swing.JFileChooser;
    1213import javax.swing.filechooser.FileFilter;
     
    162163    }
    163164
     165    @Override
     166    public ActionMap getActionMap() {
     167        return new ActionMap();
     168    }
     169
    164170    /**
    165171     * Determines if the selection mode is suuported by the native file chooser.
  • trunk/src/org/openstreetmap/josm/gui/widgets/SwingFileChooser.java

    r7937 r18113  
    55import java.io.File;
    66
     7import javax.swing.ActionMap;
    78import javax.swing.JFileChooser;
    89import javax.swing.filechooser.FileFilter;
     
    106107        return jFileChooser.showSaveDialog(parent);
    107108    }
     109
     110    @Override
     111    public ActionMap getActionMap() {
     112        return jFileChooser.getActionMap();
     113    }
    108114}
Note: See TracChangeset for help on using the changeset viewer.