source: josm/trunk/src/org/openstreetmap/josm/actions/relation/DownloadRelationAction.java

Last change on this file was 17485, checked in by GerdP, 3 years ago

see #20432: Additional panel context menu item: Download complete relation

  • unlile "download members" this will download the relation using the API call with /full This is typically much faster, while "download members" really downloads (only) the current members with possibly many multiget calls

Difference to "download members": The data for the relation is also updated, esp. also the member list

TODO: Create new icon for either of the actions.

File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions.relation;
3
4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.event.ActionEvent;
8import java.util.ArrayList;
9
10import org.openstreetmap.josm.gui.MainApplication;
11import org.openstreetmap.josm.gui.io.DownloadPrimitivesTask;
12import org.openstreetmap.josm.tools.ImageProvider;
13
14/**
15 * The action for downloading relations with members
16 * @since 17485
17 */
18public class DownloadRelationAction extends AbstractRelationAction {
19
20 /**
21 * Constructs a new <code>DownloadMembersAction</code>.
22 */
23 public DownloadRelationAction() {
24 putValue(SHORT_DESCRIPTION, tr("Download relation with members"));
25 putValue(NAME, tr("Download with members"));
26 new ImageProvider("dialogs", "downloadincomplete").getResource().attachImageIcon(this, true);
27 setHelpId(ht("/Dialog/RelationList#DownloadRelation"));
28 }
29
30 @Override
31 public void actionPerformed(ActionEvent e) {
32 if (!isEnabled() || relations.isEmpty() || !MainApplication.isDisplayingMapView())
33 return;
34 MainApplication.worker.submit(new DownloadPrimitivesTask(MainApplication.getLayerManager().getEditLayer(),
35 new ArrayList<>(relations), true));
36 }
37
38 @Override
39 protected void updateEnabledState() {
40 setEnabled(canDownload());
41 }
42}
Note: See TracBrowser for help on using the repository browser.