1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.actions;
|
---|
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.gui.MainApplication;
|
---|
10 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSearchDialog;
|
---|
11 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * The tagging presets search action (F3).
|
---|
15 | * @since 3388
|
---|
16 | * @since 12834 (moved from {@code gui.tagging.presets} package)
|
---|
17 | */
|
---|
18 | public class TaggingPresetSearchAction extends JosmAction {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Constructs a new {@code TaggingPresetSearchAction}.
|
---|
22 | */
|
---|
23 | public TaggingPresetSearchAction() {
|
---|
24 | super(tr("Search preset"), "dialogs/search", tr("Show preset search dialog"),
|
---|
25 | Shortcut.registerShortcut("preset:search", tr("Search presets"), KeyEvent.VK_F3, Shortcut.DIRECT), false);
|
---|
26 | putValue("toolbar", "presets/search");
|
---|
27 | MainApplication.getToolbar().register(this);
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public void actionPerformed(ActionEvent e) {
|
---|
32 |
|
---|
33 | if (MainApplication.getLayerManager().getEditLayer() == null)
|
---|
34 | return;
|
---|
35 |
|
---|
36 | TaggingPresetSearchDialog.getInstance().showDialog();
|
---|
37 | }
|
---|
38 | }
|
---|