| 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.data.osm.DataSet;
|
|---|
| 11 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
|---|
| 12 | import org.openstreetmap.josm.tools.Shortcut;
|
|---|
| 13 |
|
|---|
| 14 | /**
|
|---|
| 15 | * Creates a blank new local OSM data layer.
|
|---|
| 16 | * @since 19547
|
|---|
| 17 | */
|
|---|
| 18 | public class NewLocalAction extends JosmAction {
|
|---|
| 19 |
|
|---|
| 20 | /**
|
|---|
| 21 | * Constructs a {@code NewLocalAction}.
|
|---|
| 22 | */
|
|---|
| 23 | public NewLocalAction() {
|
|---|
| 24 | super(tr("New Local Layer"), "new_local", tr("Create a new local map layer."),
|
|---|
| 25 | Shortcut.registerShortcut("system:new_local", tr("File: {0}",
|
|---|
| 26 | tr("New Local Layer")), KeyEvent.VK_N, Shortcut.CTRL_SHIFT), true, false);
|
|---|
| 27 | setHelpId(ht("/Action/NewLocalLayer"));
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | @Override
|
|---|
| 31 | public void actionPerformed(ActionEvent e) {
|
|---|
| 32 | final OsmDataLayer layer = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null);
|
|---|
| 33 | layer.setUploadDiscouraged(true);
|
|---|
| 34 | getLayerManager().addLayer(layer);
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|