source: josm/trunk/src/org/openstreetmap/josm/data/preferences/sources/PresetPrefHelper.java@ 13224

Last change on this file since 13224 was 12825, checked in by Don-vip, 7 years ago

see #15229 - see #15182 - make FileWatcher generic so it has no more dependence on MapCSS

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.preferences.sources;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.util.Collection;
7import java.util.Collections;
8import java.util.HashMap;
9import java.util.Map;
10
11/**
12 * Helper class for tagging presets preferences.
13 * @since 12649 (extracted from gui.preferences package)
14 */
15public class PresetPrefHelper extends SourcePrefHelper {
16
17 /**
18 * The unique instance.
19 */
20 public static final PresetPrefHelper INSTANCE = new PresetPrefHelper();
21
22 /**
23 * Constructs a new {@code PresetPrefHelper}.
24 */
25 public PresetPrefHelper() {
26 super("taggingpreset.entries", SourceType.TAGGING_PRESET);
27 }
28
29 @Override
30 public Collection<ExtendedSourceEntry> getDefault() {
31 ExtendedSourceEntry i = new ExtendedSourceEntry(type, "defaultpresets.xml", "resource://data/defaultpresets.xml");
32 i.title = tr("Internal Preset");
33 i.description = tr("The default preset for JOSM");
34 return Collections.singletonList(i);
35 }
36
37 @Override
38 public Map<String, String> serialize(SourceEntry entry) {
39 Map<String, String> res = new HashMap<>();
40 res.put("url", entry.url);
41 res.put("title", entry.title == null ? "" : entry.title);
42 return res;
43 }
44
45 @Override
46 public SourceEntry deserialize(Map<String, String> s) {
47 return new SourceEntry(type, s.get("url"), null, s.get("title"), true);
48 }
49}
Note: See TracBrowser for help on using the repository browser.