001 // License: GPL. Copyright 2007 by Immanuel Scholz and others 002 package org.openstreetmap.josm.actions; 003 004 import static org.openstreetmap.josm.tools.I18n.tr; 005 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 006 007 import java.awt.event.ActionEvent; 008 import java.awt.event.KeyEvent; 009 010 import org.openstreetmap.josm.Main; 011 import org.openstreetmap.josm.data.osm.DataSet; 012 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 013 import org.openstreetmap.josm.tools.Shortcut; 014 015 public class NewAction extends JosmAction { 016 017 public NewAction() { 018 super(tr("New Layer"), "new", tr("Create a new map layer."), 019 Shortcut.registerShortcut("system:new", tr("File: {0}", tr("New Layer")), KeyEvent.VK_N, Shortcut.CTRL), true); 020 putValue("help", ht("/Action/NewLayer")); 021 } 022 023 public void actionPerformed(ActionEvent e) { 024 Main.main.addLayer(new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null)); 025 } 026 }