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 * Action shortcut (ctrl-shift-down by default), made public in order to be used from {@code GettingStarted} page. 025 */ 026 public static final Shortcut SHORTCUT = 027 Shortcut.registerShortcut("file:download", tr("File: {0}", tr("Download data")), KeyEvent.VK_DOWN, Shortcut.CTRL_SHIFT); 028 029 /** 030 * Constructs a new {@code DownloadAction}. 031 */ 032 public DownloadAction() { 033 super(tr("Download data..."), "download", tr("Download map data from a server of your choice"), 034 SHORTCUT, true, false); 035 setHelpId(ht("/Action/Download")); 036 } 037 038 @Override 039 public void actionPerformed(ActionEvent e) { 040 DownloadDialog dialog = DownloadDialog.getInstance(); 041 dialog.restoreSettings(); 042 dialog.setVisible(true); 043 } 044}