1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.plugins.AddrInterpolation;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.awt.event.ActionEvent;
|
---|
7 | import java.awt.event.KeyEvent;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.actions.JosmAction;
|
---|
10 | import org.openstreetmap.josm.data.osm.DataSelectionListener;
|
---|
11 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
12 | import org.openstreetmap.josm.data.osm.Way;
|
---|
13 | import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
|
---|
14 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Handy Address Interpolation Functions
|
---|
18 | */
|
---|
19 | public 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("Data: {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 | }
|
---|