| 1 | // License: GPL. For details, see LICENSE file.
|
|---|
| 2 | package org.openstreetmap.josm.actions;
|
|---|
| 3 |
|
|---|
| 4 | import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
|
|---|
| 5 | import static org.openstreetmap.josm.tools.I18n.tr;
|
|---|
| 6 |
|
|---|
| 7 | import java.awt.event.ActionEvent;
|
|---|
| 8 | import java.awt.event.KeyEvent;
|
|---|
| 9 |
|
|---|
| 10 | import org.openstreetmap.josm.gui.download.DownloadDialog;
|
|---|
| 11 | import org.openstreetmap.josm.tools.Shortcut;
|
|---|
| 12 |
|
|---|
| 13 | /**
|
|---|
| 14 | * Action that opens a connection to the osm server and downloads map data.
|
|---|
| 15 | *
|
|---|
| 16 | * An dialog is displayed asking the user to specify a rectangle to grab.
|
|---|
| 17 | * The url and account settings from the preferences are used.
|
|---|
| 18 | *
|
|---|
| 19 | * @author imi
|
|---|
| 20 | */
|
|---|
| 21 | public class DownloadAction extends JosmAction {
|
|---|
| 22 |
|
|---|
| 23 | /**
|
|---|
| 24 | * Action shortcut (ctrl-shift-down by default), made public in order to be used from {@code GettingStarted} page.
|
|---|
| 25 | */
|
|---|
| 26 | public static final Shortcut SHORTCUT =
|
|---|
| 27 | Shortcut.registerShortcut("file:download", tr("File: {0}", tr("Download data")), KeyEvent.VK_DOWN, Shortcut.CTRL_SHIFT);
|
|---|
| 28 |
|
|---|
| 29 | /**
|
|---|
| 30 | * Constructs a new {@code DownloadAction}.
|
|---|
| 31 | */
|
|---|
| 32 | public DownloadAction() {
|
|---|
| 33 | super(tr("Download data..."), "download", tr("Download map data from a server of your choice"),
|
|---|
| 34 | SHORTCUT, true, false);
|
|---|
| 35 | setHelpId(ht("/Action/Download"));
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | @Override
|
|---|
| 39 | public void actionPerformed(ActionEvent e) {
|
|---|
| 40 | DownloadDialog dialog = DownloadDialog.getInstance();
|
|---|
| 41 | dialog.restoreSettings();
|
|---|
| 42 | dialog.setVisible(true);
|
|---|
| 43 | }
|
|---|
| 44 | }
|
|---|