Package org.openstreetmap.josm.actions

Source Code of org.openstreetmap.josm.actions.NewAction

// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.actions;

import static org.openstreetmap.josm.tools.I18n.tr;
import static org.openstreetmap.josm.gui.help.HelpUtil.ht;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.tools.Shortcut;

/**
* Creates a blank new OSM data layer.
* @since 169
*/
public class NewAction extends JosmAction {

    /**
     * Constructs a {@code NewAction}.
     */
    public NewAction() {
        super(tr("New Layer"), "new", tr("Create a new map layer."),
                Shortcut.registerShortcut("system:new", tr("File: {0}", tr("New Layer")), KeyEvent.VK_N, Shortcut.CTRL), true);
        putValue("help", ht("/Action/NewLayer"));
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        Main.main.addLayer(new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null));
    }
}
TOP

Related Classes of org.openstreetmap.josm.actions.NewAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.