001    // License: GPL. Copyright 2007 by Immanuel Scholz and others
002    package org.openstreetmap.josm.actions;
003    
004    import static org.openstreetmap.josm.tools.I18n.tr;
005    import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
006    
007    import java.awt.event.KeyEvent;
008    import java.io.File;
009    
010    import org.openstreetmap.josm.gui.layer.Layer;
011    import org.openstreetmap.josm.tools.Shortcut;
012    
013    /**
014     * Export the data.
015     *
016     * @author imi
017     */
018    public 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));
028            putValue("help", ht("/Action/SaveAs"));
029        }
030        
031        public static SaveAsAction getInstance() {
032            return instance;
033        }
034    
035        @Override protected File getFile(Layer layer) {
036            return layer.createAndOpenSaveFileChooser();
037        }
038    }