Changeset 12649 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreference.java
- Timestamp:
- 2017-08-25T21:51:00+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreference.java
r11247 r12649 8 8 import java.util.Collection; 9 9 import java.util.Collections; 10 import java.util.HashMap;11 10 import java.util.List; 12 import java.util.Map;13 11 14 12 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry; 14 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper; 15 import org.openstreetmap.josm.data.preferences.sources.SourceEntry; 16 import org.openstreetmap.josm.data.preferences.sources.SourceProvider; 17 import org.openstreetmap.josm.data.preferences.sources.SourceType; 15 18 import org.openstreetmap.josm.data.validation.OsmValidator; 16 19 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker; … … 19 22 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 20 23 import org.openstreetmap.josm.gui.preferences.SourceEditor; 21 import org.openstreetmap.josm.gui.preferences.SourceEditor.ExtendedSourceEntry;22 import org.openstreetmap.josm.gui.preferences.SourceEntry;23 import org.openstreetmap.josm.gui.preferences.SourceProvider;24 import org.openstreetmap.josm.gui.preferences.SourceType;25 24 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 26 25 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; … … 64 63 @Override 65 64 public Collection<? extends SourceEntry> getInitialSourcesList() { 66 return RulePrefHelper.INSTANCE.get();65 return ValidatorPrefHelper.INSTANCE.get(); 67 66 } 68 67 69 68 @Override 70 69 public boolean finish() { 71 return RulePrefHelper.INSTANCE.put(activeSourcesModel.getSources());70 return ValidatorPrefHelper.INSTANCE.put(activeSourcesModel.getSources()); 72 71 } 73 72 74 73 @Override 75 74 public Collection<ExtendedSourceEntry> getDefault() { 76 return RulePrefHelper.INSTANCE.getDefault();75 return ValidatorPrefHelper.INSTANCE.getDefault(); 77 76 } 78 77 … … 123 122 } 124 123 125 /**126 * Helper class for validator tag checker rules preferences.127 */128 public static class RulePrefHelper extends SourceEditor.SourcePrefHelper {129 130 /**131 * The unique instance.132 */133 public static final RulePrefHelper INSTANCE = new RulePrefHelper();134 135 /**136 * Constructs a new {@code PresetPrefHelper}.137 */138 public RulePrefHelper() {139 super(MapCSSTagChecker.ENTRIES_PREF_KEY);140 }141 142 @Override143 public Collection<ExtendedSourceEntry> getDefault() {144 List<ExtendedSourceEntry> def = new ArrayList<>();145 146 // CHECKSTYLE.OFF: SingleSpaceSeparator147 addDefault(def, "addresses", tr("Addresses"), tr("Checks for errors on addresses"));148 addDefault(def, "combinations", tr("Tag combinations"), tr("Checks for missing tag or suspicious combinations"));149 addDefault(def, "deprecated", tr("Deprecated features"), tr("Checks for deprecated features"));150 addDefault(def, "geometry", tr("Geometry"), tr("Checks for geometry errors"));151 addDefault(def, "highway", tr("Highways"), tr("Checks for errors on highways"));152 addDefault(def, "multiple", tr("Multiple values"), tr("Checks for wrong multiple values"));153 addDefault(def, "numeric", tr("Numeric values"), tr("Checks for wrong numeric values"));154 addDefault(def, "religion", tr("Religion"), tr("Checks for errors on religious objects"));155 addDefault(def, "relation", tr("Relations"), tr("Checks for errors on relations"));156 addDefault(def, "territories", tr("Territories"), tr("Checks for territories-specific features"));157 addDefault(def, "unnecessary", tr("Unnecessary tags"), tr("Checks for unnecessary tags"));158 addDefault(def, "wikipedia", tr("Wikipedia"), tr("Checks for wrong wikipedia tags"));159 // CHECKSTYLE.ON: SingleSpaceSeparator160 161 return def;162 }163 164 private static void addDefault(List<ExtendedSourceEntry> defaults, String filename, String title, String description) {165 ExtendedSourceEntry i = new ExtendedSourceEntry(filename+".mapcss", "resource://data/validator/"+filename+".mapcss");166 i.title = title;167 i.description = description;168 defaults.add(i);169 }170 171 @Override172 public Map<String, String> serialize(SourceEntry entry) {173 Map<String, String> res = new HashMap<>();174 res.put("url", entry.url);175 res.put("title", entry.title == null ? "" : entry.title);176 res.put("active", Boolean.toString(entry.active));177 return res;178 }179 180 @Override181 public SourceEntry deserialize(Map<String, String> s) {182 return new SourceEntry(s.get("url"), null, s.get("title"), Boolean.parseBoolean(s.get("active")));183 }184 }185 186 124 private SourceEditor sources; 187 125
Note:
See TracChangeset
for help on using the changeset viewer.