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.ActionEvent;
008import java.awt.event.KeyEvent;
009
010import org.openstreetmap.josm.gui.download.DownloadDialog;
011import org.openstreetmap.josm.tools.Shortcut;
012
013/**
014 * Action that opens a connection to the osm server and downloads map data.
015 *
016 * An dialog is displayed asking the user to specify a rectangle to grab.
017 * The url and account settings from the preferences are used.
018 *
019 * @author imi
020 */
021public class DownloadAction extends JosmAction {
022
023    /**
024     * Constructs a new {@code DownloadAction}.
025     */
026    public DownloadAction() {
027        super(tr("Download data"), "download", tr("Download map data from a server of your choice"),
028              Shortcut.registerShortcut("file:download", tr("File: {0}", tr("Download data")), KeyEvent.VK_DOWN, Shortcut.CTRL_SHIFT),
029              true);
030        putValue("help", ht("/Action/Download"));
031    }
032
033    @Override
034    public void actionPerformed(ActionEvent e) {
035        DownloadDialog dialog = DownloadDialog.getInstance();
036        dialog.restoreSettings();
037        dialog.setVisible(true);
038    }
039}