diff --git a/resources/images/new_local.svg b/resources/images/new_local.svg new file mode 100644 index 0000000000..2b75b63c16 --- /dev/null +++ b/resources/images/new_local.svg @@ -0,0 +1,380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + New Document + + + text + plaintext + regular + document + + + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + + Luca Ferretti + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/org/openstreetmap/josm/actions/NewLocalAction.java b/src/org/openstreetmap/josm/actions/NewLocalAction.java new file mode 100644 index 0000000000..98dad2a392 --- /dev/null +++ b/src/org/openstreetmap/josm/actions/NewLocalAction.java @@ -0,0 +1,35 @@ +// License: GPL. For details, see LICENSE file. +package org.openstreetmap.josm.actions; + +import static org.openstreetmap.josm.gui.help.HelpUtil.ht; +import static org.openstreetmap.josm.tools.I18n.tr; + +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; + +import org.openstreetmap.josm.data.osm.DataSet; +import org.openstreetmap.josm.gui.layer.OsmDataLayer; +import org.openstreetmap.josm.tools.Shortcut; + +/** + * Creates a blank new local OSM data layer. + * @since 169 + */ +public class NewLocalAction extends JosmAction { + + /** + * Constructs a {@code NewLocalAction}. + */ + public NewLocalAction() { + super(tr("New Local Layer"), "new_local", tr("Create a new local map layer."), + Shortcut.registerShortcut("system:new_local", tr("File: {0}", tr("New Local Layer")), KeyEvent.VK_N, Shortcut.CTRL_SHIFT), true, false); + setHelpId(ht("/Action/NewLocalLayer")); + } + + @Override + public void actionPerformed(ActionEvent e) { + final OsmDataLayer layer = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null); + layer.setUploadDiscouraged(true); + getLayerManager().addLayer(layer); + } +} diff --git a/src/org/openstreetmap/josm/gui/MainMenu.java b/src/org/openstreetmap/josm/gui/MainMenu.java index e8fbe10c84..3a089782ba 100644 --- a/src/org/openstreetmap/josm/gui/MainMenu.java +++ b/src/org/openstreetmap/josm/gui/MainMenu.java @@ -76,6 +76,7 @@ import org.openstreetmap.josm.actions.MoveAction; import org.openstreetmap.josm.actions.MoveNodeAction; import org.openstreetmap.josm.actions.NewAction; +import org.openstreetmap.josm.actions.NewLocalAction; import org.openstreetmap.josm.actions.OpenFileAction; import org.openstreetmap.josm.actions.OpenLocationAction; import org.openstreetmap.josm.actions.OrthogonalizeAction; @@ -167,6 +168,8 @@ public enum WINDOW_MENU_GROUP { /* File menu */ /** File / New Layer **/ public final NewAction newAction = new NewAction(); + /** File / New Local Layer **/ + public final NewLocalAction newLocalAction = new NewLocalAction(); /** File / Open... **/ public final OpenFileAction openFile = new OpenFileAction(); /** File / Open Recent > **/ @@ -740,6 +743,7 @@ public void initialize() { gpsMenu.setVisible(false); add(fileMenu, newAction); + add(fileMenu, newLocalAction); add(fileMenu, openFile); fileMenu.add(recentlyOpened); add(fileMenu, openLocation);