public abstract class SaveActionBase extends DiskAccessAction
JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
Modifier and Type | Field and Description |
---|---|
private java.io.File |
file |
sc
Constructor and Description |
---|
SaveActionBase(java.lang.String name,
java.lang.String iconName,
java.lang.String tooltip,
Shortcut shortcut) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
(package private) static void |
addToFileOpenHistory(java.io.File file) |
private static java.io.File |
checkFileAndConfirmOverWrite(AbstractFileChooser 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,
boolean checkSaveConditions)
Saves a layer to a given file.
|
protected abstract java.io.File |
getFile(Layer layer) |
protected void |
updateEnabledState()
Refreshes the enabled state
|
createAndOpenFileChooser, createAndOpenFileChooser, createAndOpenFileChooser, createAndOpenFileChooser, createAndOpenFileChooser
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip, updateEnabledState
private java.io.File file
public SaveActionBase(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut)
public void actionPerformed(java.awt.event.ActionEvent e)
public boolean doSave()
public static boolean doSave(Layer layer, java.io.File file, boolean checkSaveConditions)
layer
- The layer to savefile
- The destination filecheckSaveConditions
- if true
, checks preconditions before saving. Set it to false
to skip it
if preconditions have already been checked (as this check can prompt UI dialog in EDT it may be best in some cases
to do it earlier).true
if the layer has been successfully saved, false
otherwiseprivate static boolean doInternalSave(Layer layer, java.io.File file)
protected void updateEnabledState()
updateEnabledState
in class JosmAction
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
public static java.io.File createAndOpenSaveFileChooser(java.lang.String title, ExtensionFileFilter filter)
ExtensionFileFilter
and makes it visible.title
- The dialog titlefilter
- The dialog file filterFile
DiskAccessAction.createAndOpenFileChooser(boolean, boolean, String, FileFilter, int, String)
public static java.io.File createAndOpenSaveFileChooser(java.lang.String title, java.lang.String extension)
title
- The dialog titleextension
- The file extensionFile
DiskAccessAction.createAndOpenFileChooser(boolean, boolean, String, String)
private static java.io.File checkFileAndConfirmOverWrite(AbstractFileChooser fc, java.lang.String extension)
public static boolean confirmOverwrite(java.io.File file)
static void addToFileOpenHistory(java.io.File file)