source: osm/applications/editors/josm/plugins/tagging-preset-tester/src/org/openstreetmap/josm/plugins/taggingpresettester/TaggingPresetTesterAction.java

Last change on this file was 35579, checked in by Klumbumbus, 4 years ago

see #19851 - Fix shortcut names

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1package org.openstreetmap.josm.plugins.taggingpresettester;
2
3import static org.openstreetmap.josm.tools.I18n.tr;
4
5import java.awt.event.ActionEvent;
6import java.awt.event.KeyEvent;
7import java.util.Collection;
8
9import javax.swing.JOptionPane;
10
11import org.openstreetmap.josm.actions.JosmAction;
12import org.openstreetmap.josm.gui.MainApplication;
13import org.openstreetmap.josm.gui.MainMenu;
14import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader;
15import org.openstreetmap.josm.plugins.PluginInformation;
16import org.openstreetmap.josm.tools.Shortcut;
17
18/**
19 * Fires up the tagging preset tester
20 * @author Immanuel.Scholz
21 */
22public class TaggingPresetTesterAction extends JosmAction {
23
24 public TaggingPresetTesterAction() {
25 super(tr("Tagging Preset Tester"), "tagging-preset-tester",
26 tr("Open the tagging preset test tool for previewing tagging preset dialogs."),
27 Shortcut.registerShortcut("tools:taggingpresettester",
28 tr("Windows: {0}", tr("Tagging Preset Tester")),
29 KeyEvent.VK_T, Shortcut.ALT_CTRL_SHIFT), true);
30 MainMenu.addAfter(MainApplication.getMenu().windowMenu, this, false, MainApplication.getMenu().changesetManager);
31 }
32
33 public TaggingPresetTesterAction(PluginInformation info) {
34 this();
35 }
36
37 @Override
38 public void actionPerformed(ActionEvent e) {
39 Collection<String> coll = TaggingPresetReader.getPresetSources();
40
41 if (coll.isEmpty()) {
42 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("You have to specify tagging preset sources in the preferences first."));
43 return;
44 }
45
46 String[] taggingPresetSources = new String [coll.size()];
47 coll.toArray(taggingPresetSources);
48 new TaggingPresetTester(taggingPresetSources).setVisible(true);
49 }
50}
Note: See TracBrowser for help on using the repository browser.