001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.actions;
003
004import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
005import static org.openstreetmap.josm.tools.I18n.tr;
006
007import java.awt.event.KeyEvent;
008import java.io.File;
009
010import org.openstreetmap.josm.gui.layer.Layer;
011import org.openstreetmap.josm.tools.Shortcut;
012
013/**
014 * Export the data.
015 *
016 * @author imi
017 */
018public class SaveAsAction extends SaveActionBase {
019    private static SaveAsAction instance = new SaveAsAction();
020
021    /**
022     * Construct the action with "Save" as label.
023     */
024    public SaveAsAction() {
025        super(tr("Save As..."), "save_as", tr("Save the current data to a new file."),
026            Shortcut.registerShortcut("system:saveas", tr("File: {0}", tr("Save As...")),
027            KeyEvent.VK_S, Shortcut.CTRL_SHIFT), false);
028        setHelpId(ht("/Action/SaveAs"));
029    }
030
031    /**
032     * Returns the unique instance.
033     * @return the unique instance
034     */
035    public static SaveAsAction getInstance() {
036        return instance;
037    }
038
039    @Override protected File getFile(Layer layer) {
040        return layer.createAndOpenSaveFileChooser();
041    }
042}