org.openstreetmap.josm.actions
Class SaveActionBase

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

public abstract class SaveActionBase
extends DiskAccessAction

See Also:
Serialized Form

Field Summary
private  java.io.File file
           
 
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
SaveActionBase(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
protected  void addToFileOpenHistory()
           
private static java.io.File checkFileAndConfirmOverWrite(javax.swing.JFileChooser fc, java.lang.String extension)
           
static boolean confirmOverwrite(java.io.File file)
           
static java.io.File createAndOpenSaveFileChooser(java.lang.String title, ExtensionFileFilter filter)
          Creates a new "Save" dialog for a single ExtensionFileFilter and makes it visible.
When the user has chosen a file, checks the file extension, and confirms overwrite if needed.
static java.io.File createAndOpenSaveFileChooser(java.lang.String title, java.lang.String extension)
          Creates a new "Save" dialog for a given file extension and makes it visible.
When the user has chosen a file, checks the file extension, and confirms overwrite if needed.
private static boolean doInternalSave(Layer layer, java.io.File file)
           
 boolean doSave()
           
 boolean doSave(Layer layer)
           
static boolean doSave(Layer layer, java.io.File file)
           
protected abstract  java.io.File getFile(Layer layer)
           
protected  void updateEnabledState()
          Refreshes the enabled state
 
Methods inherited from class org.openstreetmap.josm.actions.DiskAccessAction
createAndOpenFileChooser, createAndOpenFileChooser, createAndOpenFileChooser, createAndOpenFileChooser, createAndOpenFileChooser
 
Methods inherited from class org.openstreetmap.josm.actions.JosmAction
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip, 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
 

Field Detail

file

private java.io.File file
Constructor Detail

SaveActionBase

public SaveActionBase(java.lang.String name,
                      java.lang.String iconName,
                      java.lang.String tooltip,
                      Shortcut shortcut)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)

doSave

public boolean doSave()

doSave

public boolean doSave(Layer layer)

doSave

public static boolean doSave(Layer layer,
                             java.io.File file)

doInternalSave

private static boolean doInternalSave(Layer layer,
                                      java.io.File file)

getFile

protected abstract java.io.File getFile(Layer layer)

updateEnabledState

protected void updateEnabledState()
Refreshes the enabled state

Overrides:
updateEnabledState in class JosmAction
See Also:
JosmAction.updateEnabledState(Collection), JosmAction.initEnabledState()

createAndOpenSaveFileChooser

public static java.io.File createAndOpenSaveFileChooser(java.lang.String title,
                                                        ExtensionFileFilter filter)
Creates a new "Save" dialog for a single ExtensionFileFilter and makes it visible.
When the user has chosen a file, checks the file extension, and confirms overwrite if needed.

Parameters:
title - The dialog title
filter - The dialog file filter
Returns:
The output File
Since:
5456
See Also:
DiskAccessAction.createAndOpenFileChooser(boolean, boolean, String, FileFilter, int, String)

createAndOpenSaveFileChooser

public static java.io.File createAndOpenSaveFileChooser(java.lang.String title,
                                                        java.lang.String extension)
Creates a new "Save" dialog for a given file extension and makes it visible.
When the user has chosen a file, checks the file extension, and confirms overwrite if needed.

Parameters:
title - The dialog title
extension - The file extension
Returns:
The output File
See Also:
DiskAccessAction.createAndOpenFileChooser(boolean, boolean, String, String)

checkFileAndConfirmOverWrite

private static java.io.File checkFileAndConfirmOverWrite(javax.swing.JFileChooser fc,
                                                         java.lang.String extension)

confirmOverwrite

public static boolean confirmOverwrite(java.io.File file)

addToFileOpenHistory

protected void addToFileOpenHistory()


JOSM