source: subversion/applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationAction.java

Last change on this file was 34487, checked in by donvip, 8 months ago

update to JOSM 14153

File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.plugins.AddrInterpolation;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.ActionEvent;
7import java.awt.event.KeyEvent;
8
9import org.openstreetmap.josm.actions.JosmAction;
10import org.openstreetmap.josm.data.osm.DataSelectionListener;
11import org.openstreetmap.josm.data.osm.OsmPrimitive;
12import org.openstreetmap.josm.data.osm.Way;
13import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
14import org.openstreetmap.josm.tools.Shortcut;
15
16/**
17 * Handy Address Interpolation Functions
18 */
19public class AddrInterpolationAction extends JosmAction implements DataSelectionListener {
20
21    public AddrInterpolationAction() {
22        super(tr("Address Interpolation"), "AddrInterpolation", tr("Handy Address Interpolation Functions"),
23                Shortcut.registerShortcut("tools:AddressInterpolation", tr("Tool: {0}", tr("Address Interpolation")),
24                        KeyEvent.VK_Z, Shortcut.ALT_CTRL), false);
25        setEnabled(false);
26        SelectionEventManager.getInstance().addSelectionListener(this);
27    }
28
29    @Override
30    public void actionPerformed(ActionEvent e) {
31        /*AddrInterpolationDialog addrDialog =*/ new AddrInterpolationDialog(tr("Define Address Interpolation"));
32    }
33
34    @Override
35    public void selectionChanged(SelectionChangeEvent event) {
36
37        for (OsmPrimitive osm : event.getSelection()) {
38            if (osm instanceof Way) {
39                setEnabled(true);
40                return;
41            }
42        }
43        setEnabled(false);
44    }
45}
Note: See TracBrowser for help on using the repository browser.