Changeset 6593 in josm for trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
- Timestamp:
- 2014-01-01T23:07:33+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r6591 r6593 94 94 public static final String PREF_CHECK_FIXMES = PREFIX + ".checkFixmes"; 95 95 96 public static final String PREF_SOURCES = PREFIX + ".sources"; 97 public static final String PREF_USE_DATA_FILE = PREFIX + ".usedatafile"; 98 public static final String PREF_USE_IGNORE_FILE = PREFIX + ".useignorefile"; 99 public static final String PREF_USE_SPELL_FILE = PREFIX + ".usespellfile"; 96 public static final String PREF_SOURCES = PREFIX + ".source"; 100 97 101 98 public static final String PREF_CHECK_KEYS_BEFORE_UPLOAD = PREF_CHECK_KEYS + "BeforeUpload"; … … 120 117 protected JCheckBox prefCheckFixmesBeforeUpload; 121 118 protected JCheckBox prefCheckPaintBeforeUpload; 122 123 protected JCheckBox prefUseDataFile;124 protected JCheckBox prefUseIgnoreFile;125 protected JCheckBox prefUseSpellFile;126 119 127 120 protected static final int EMPTY_VALUES = 1200; … … 172 165 173 166 spellCheckKeyData = new HashMap<String, String>(); 174 String sources = Main.pref.get( PREF_SOURCES, ""); 175 if (Main.pref.getBoolean(PREF_USE_DATA_FILE, true)) { 176 if (sources == null || sources.length() == 0) { 177 sources = DATA_FILE; 178 } else { 179 sources = DATA_FILE + ";" + sources; 180 } 181 } 182 if (Main.pref.getBoolean(PREF_USE_IGNORE_FILE, true)) { 183 if (sources == null || sources.length() == 0) { 184 sources = IGNORE_FILE; 185 } else { 186 sources = IGNORE_FILE + ";" + sources; 187 } 188 } 189 if (Main.pref.getBoolean(PREF_USE_SPELL_FILE, true)) { 190 if( sources == null || sources.length() == 0) { 191 sources = SPELL_FILE; 192 } else { 193 sources = SPELL_FILE + ";" + sources; 194 } 195 } 196 167 197 168 String errorSources = ""; 198 if (sources.length() == 0) 199 return; 200 for (String source : sources.split(";")) { 169 for (String source : Main.pref.getCollection(PREF_SOURCES, Arrays.asList(DATA_FILE, IGNORE_FILE, SPELL_FILE))) { 201 170 BufferedReader reader = null; 202 171 try { … … 511 480 testPanel.add(prefCheckComplexBeforeUpload, a); 512 481 513 final String sources = Main.pref.get(PREF_SOURCES);482 final Collection<String> sources = Main.pref.getCollection(PREF_SOURCES, Arrays.asList(DATA_FILE, IGNORE_FILE, SPELL_FILE)); 514 483 sourcesList = new EditableList(tr("TagChecker source")); 515 sourcesList.setItems(sources != null ? Arrays.asList(sources.split(";")) : Collections.<String>emptyList());484 sourcesList.setItems(sources); 516 485 testPanel.add(new JLabel(tr("Data sources ({0})", "*.cfg")), GBC.eol().insets(23, 0, 0, 0)); 517 486 testPanel.add(sourcesList, GBC.eol().fill(GridBagConstraints.HORIZONTAL).insets(23, 0, 0, 0)); … … 545 514 prefCheckFixmesBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, true)); 546 515 testPanel.add(prefCheckFixmesBeforeUpload, a); 547 548 prefUseDataFile = new JCheckBox(tr("Use default data file."), Main.pref.getBoolean(PREF_USE_DATA_FILE, true));549 prefUseDataFile.setToolTipText(tr("Use the default data file (recommended)."));550 testPanel.add(prefUseDataFile, GBC.eol().insets(20,0,0,0));551 552 prefUseIgnoreFile = new JCheckBox(tr("Use default tag ignore file."), Main.pref.getBoolean(PREF_USE_IGNORE_FILE, true));553 prefUseIgnoreFile.setToolTipText(tr("Use the default tag ignore file (recommended)."));554 testPanel.add(prefUseIgnoreFile, GBC.eol().insets(20,0,0,0));555 556 prefUseSpellFile = new JCheckBox(tr("Use default spellcheck file."), Main.pref.getBoolean(PREF_USE_SPELL_FILE, true));557 prefUseSpellFile.setToolTipText(tr("Use the default spellcheck file (recommended)."));558 testPanel.add(prefUseSpellFile, GBC.eol().insets(20,0,0,0));559 516 } 560 517 … … 579 536 Main.pref.put(PREF_CHECK_KEYS_BEFORE_UPLOAD, prefCheckKeysBeforeUpload.isSelected()); 580 537 Main.pref.put(PREF_CHECK_FIXMES_BEFORE_UPLOAD, prefCheckFixmesBeforeUpload.isSelected()); 581 Main.pref.put(PREF_USE_DATA_FILE, prefUseDataFile.isSelected()); 582 Main.pref.put(PREF_USE_IGNORE_FILE, prefUseIgnoreFile.isSelected()); 583 Main.pref.put(PREF_USE_SPELL_FILE, prefUseSpellFile.isSelected()); 584 final List<String> sources = sourcesList.getItems(); 585 return Main.pref.put(PREF_SOURCES, sources.isEmpty() ? null : Utils.join(";", sources)); 538 return Main.pref.putCollection(PREF_SOURCES, sourcesList.getItems()); 586 539 } 587 540 588 541 @Override 589 542 public Command fixError(TestError testError) { 590 591 543 List<Command> commands = new ArrayList<Command>(50); 592 544 … … 631 583 @Override 632 584 public boolean isFixable(TestError testError) { 633 634 585 if (testError.getTester() instanceof TagChecker) { 635 586 int code = testError.getCode();
Note:
See TracChangeset
for help on using the changeset viewer.