org.openstreetmap.josm.actions
Class DiskAccessAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.openstreetmap.josm.actions.JosmAction
          extended by org.openstreetmap.josm.actions.DiskAccessAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, Destroyable
Direct Known Subclasses:
GpxExportAction, OpenFileAction, SaveActionBase, SessionLoadAction, SessionSaveAsAction

public abstract class DiskAccessAction
extends JosmAction

Helper class for all actions that access the disk.

Since:
78
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.openstreetmap.josm.actions.JosmAction
sc
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
DiskAccessAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut)
          Constructs a new DiskAccessAction.
DiskAccessAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean register, java.lang.String toolbarId, boolean installAdapters)
          Constructs a new DiskAccessAction.
 
Method Summary
static javax.swing.JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, java.lang.String title)
          Creates a new JFileChooser and makes it visible.
static javax.swing.JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, java.lang.String title, java.util.Collection<? extends javax.swing.filechooser.FileFilter> filters, javax.swing.filechooser.FileFilter defaultFilter, int selectionMode, java.lang.String lastDirProperty)
          Creates a new JFileChooser for several FileFilters and makes it visible.
static javax.swing.JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, java.lang.String title, javax.swing.filechooser.FileFilter filter, int selectionMode, java.lang.String lastDirProperty)
          Creates a new JFileChooser for a single FileFilter and makes it visible.
static javax.swing.JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, java.lang.String title, java.lang.String extension)
          Creates a new JFileChooser and makes it visible.
static javax.swing.JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, java.lang.String title, java.lang.String extension, int selectionMode, boolean allTypes, java.lang.String lastDirProperty)
          Creates a new JFileChooser and makes it visible.
 
Methods inherited from class org.openstreetmap.josm.actions.JosmAction
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip, updateEnabledState, updateEnabledState
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Constructor Detail

DiskAccessAction

public DiskAccessAction(java.lang.String name,
                        java.lang.String iconName,
                        java.lang.String tooltip,
                        Shortcut shortcut)
Constructs a new DiskAccessAction.

Parameters:
name - The action's text as displayed on the menu (if it is added to a menu)
iconName - The filename of the icon to use
tooltip - A longer description of the action that will be displayed in the tooltip
shortcut - A ready-created shortcut object or null if you don't want a shortcut
Since:
1084

DiskAccessAction

public DiskAccessAction(java.lang.String name,
                        java.lang.String iconName,
                        java.lang.String tooltip,
                        Shortcut shortcut,
                        boolean register,
                        java.lang.String toolbarId,
                        boolean installAdapters)
Constructs a new DiskAccessAction.

Parameters:
name - The action's text as displayed on the menu (if it is added to a menu)
iconName - The filename of the icon to use
tooltip - A longer description of the action that will be displayed in the tooltip
shortcut - A ready-created shortcut object or null if you don't want a shortcut
register - Register this action for the toolbar preferences?
toolbarId - Identifier for the toolbar preferences. The iconName is used, if this parameter is null
installAdapters - False, if you don't want to install layer changed and selection changed adapters
Since:
5438
Method Detail

createAndOpenFileChooser

public static javax.swing.JFileChooser createAndOpenFileChooser(boolean open,
                                                                boolean multiple,
                                                                java.lang.String title)
Creates a new JFileChooser and makes it visible.

Parameters:
open - If true, pops up an "Open File" dialog. If false, pops up a "Save File" dialog
multiple - If true, makes the dialog allow multiple file selections
title - The string that goes in the dialog window's title bar
Returns:
The JFileChooser.
Since:
1646

createAndOpenFileChooser

public static javax.swing.JFileChooser createAndOpenFileChooser(boolean open,
                                                                boolean multiple,
                                                                java.lang.String title,
                                                                java.lang.String extension)
Creates a new JFileChooser and makes it visible.

Parameters:
open - If true, pops up an "Open File" dialog. If false, pops up a "Save File" dialog
multiple - If true, makes the dialog allow multiple file selections
title - The string that goes in the dialog window's title bar
extension - The file extension that will be selected as the default file filter
Returns:
The JFileChooser.
Since:
2020

createAndOpenFileChooser

public static javax.swing.JFileChooser createAndOpenFileChooser(boolean open,
                                                                boolean multiple,
                                                                java.lang.String title,
                                                                java.lang.String extension,
                                                                int selectionMode,
                                                                boolean allTypes,
                                                                java.lang.String lastDirProperty)
Creates a new JFileChooser and makes it visible.

Parameters:
open - If true, pops up an "Open File" dialog. If false, pops up a "Save File" dialog
multiple - If true, makes the dialog allow multiple file selections
title - The string that goes in the dialog window's title bar
extension - The file extension that will be selected as the default file filter
selectionMode - The selection mode that allows the user to:
  • just select files (JFileChooser.FILES_ONLY)
  • just select directories (JFileChooser.DIRECTORIES_ONLY)
  • select both files and directories (JFileChooser.FILES_AND_DIRECTORIES)
  • allTypes - If true, all the files types known by JOSM will be proposed in the "file type" combobox. If false, only the file filters that include extension will be proposed
    lastDirProperty - The name of the property used to setup the JFileChooser initial directory. This property will then be updated to the new "last directory" chosen by the user. If null, the default property "lastDirectory" will be used.
    Returns:
    The JFileChooser.
    Since:
    5438

    createAndOpenFileChooser

    public static javax.swing.JFileChooser createAndOpenFileChooser(boolean open,
                                                                    boolean multiple,
                                                                    java.lang.String title,
                                                                    javax.swing.filechooser.FileFilter filter,
                                                                    int selectionMode,
                                                                    java.lang.String lastDirProperty)
    Creates a new JFileChooser for a single FileFilter and makes it visible.

    Parameters:
    open - If true, pops up an "Open File" dialog. If false, pops up a "Save File" dialog
    multiple - If true, makes the dialog allow multiple file selections
    title - The string that goes in the dialog window's title bar
    filter - The only file filter that will be proposed by the dialog
    selectionMode - The selection mode that allows the user to:
  • just select files (JFileChooser.FILES_ONLY)
  • just select directories (JFileChooser.DIRECTORIES_ONLY)
  • select both files and directories (JFileChooser.FILES_AND_DIRECTORIES)
  • lastDirProperty - The name of the property used to setup the JFileChooser initial directory. This property will then be updated to the new "last directory" chosen by the user
    Returns:
    The JFileChooser.
    Since:
    5438

    createAndOpenFileChooser

    public static javax.swing.JFileChooser createAndOpenFileChooser(boolean open,
                                                                    boolean multiple,
                                                                    java.lang.String title,
                                                                    java.util.Collection<? extends javax.swing.filechooser.FileFilter> filters,
                                                                    javax.swing.filechooser.FileFilter defaultFilter,
                                                                    int selectionMode,
                                                                    java.lang.String lastDirProperty)
    Creates a new JFileChooser for several FileFilters and makes it visible.

    Parameters:
    open - If true, pops up an "Open File" dialog. If false, pops up a "Save File" dialog
    multiple - If true, makes the dialog allow multiple file selections
    title - The string that goes in the dialog window's title bar
    filters - The file filters that will be proposed by the dialog
    defaultFilter - The file filter that will be selected by default
    selectionMode - The selection mode that allows the user to:
  • just select files (JFileChooser.FILES_ONLY)
  • just select directories (JFileChooser.DIRECTORIES_ONLY)
  • select both files and directories (JFileChooser.FILES_AND_DIRECTORIES)
  • lastDirProperty - The name of the property used to setup the JFileChooser initial directory. This property will then be updated to the new "last directory" chosen by the user
    Returns:
    The JFileChooser.
    Since:
    5438


    JOSM