Changeset 14858 in josm
- Timestamp:
- 2019-03-09T16:12:40+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r14854 r14858 50 50 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper; 51 51 import org.openstreetmap.josm.data.validation.OsmValidator; 52 import org.openstreetmap.josm.data.validation.Severity; 52 53 import org.openstreetmap.josm.data.validation.TestError; 53 54 import org.openstreetmap.josm.data.validation.ValidatorVisitor; … … 298 299 Object mainNodeInfo = node.getUserObject(); 299 300 final int depth = node.getDepth(); 300 if (depth <= 1) { 301 if (!(mainNodeInfo instanceof TestError)) { 302 Set<Pair<String, String>> state = new HashSet<>(); 303 // ask if the whole set should be ignored 304 if (asked == JOptionPane.DEFAULT_OPTION) { 305 String[] a = new String[] {tr("Whole group"), tr("Single elements"), tr("Nothing")}; 306 asked = JOptionPane.showOptionDialog(MainApplication.getMainFrame(), tr("Ignore whole group or individual elements?"), 307 tr("Ignoring elements"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, 308 a, a[1]); 301 if (!(mainNodeInfo instanceof TestError)) { 302 Set<Pair<String, String>> state = new HashSet<>(); 303 // ask if the whole set should be ignored 304 if (asked == JOptionPane.DEFAULT_OPTION) { 305 String[] a = new String[] {tr("Whole group"), tr("Single elements"), tr("Nothing")}; 306 asked = JOptionPane.showOptionDialog(MainApplication.getMainFrame(), tr("Ignore whole group or individual elements?"), 307 tr("Ignoring elements"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, 308 a, a[1]); 309 } 310 if (asked == JOptionPane.YES_NO_OPTION) { 311 ValidatorTreePanel.visitTestErrors(node, err -> { 312 err.setIgnored(true); 313 changed.set(true); 314 state.add(new Pair<>(depth == 1 ? err.getIgnoreSubGroup() : err.getIgnoreGroup(), err.getMessage())); 315 }, processedNodes); 316 for (Pair<String, String> s : state) { 317 OsmValidator.addIgnoredError(s.a, s.b); 309 318 } 310 if (asked == JOptionPane.YES_NO_OPTION) { 311 ValidatorTreePanel.visitTestErrors(node, err -> { 312 err.setIgnored(true); 313 changed.set(true); 314 state.add(new Pair<>(node.getDepth() == 1 ? err.getIgnoreSubGroup() : err.getIgnoreGroup(), err.getMessage())); 315 }, processedNodes); 316 for (Pair<String, String> s : state) { 317 OsmValidator.addIgnoredError(s.a, s.b); 318 } 319 continue; 320 } else if (asked == JOptionPane.CANCEL_OPTION || asked == JOptionPane.CLOSED_OPTION) { 321 continue; 322 } 323 } 324 325 ValidatorTreePanel.visitTestErrors(node, error -> { 326 String state = error.getIgnoreState(); 327 if (state != null) { 328 OsmValidator.addIgnoredError(state, error.getMessage()); 329 } 330 changed.set(true); 331 error.setIgnored(true); 332 }, processedNodes); 333 } 319 continue; 320 } else if (asked == JOptionPane.CANCEL_OPTION || asked == JOptionPane.CLOSED_OPTION) { 321 continue; 322 } 323 } 324 325 ValidatorTreePanel.visitTestErrors(node, error -> { 326 String state = error.getIgnoreState(); 327 if (state != null) { 328 OsmValidator.addIgnoredError(state, error.getMessage()); 329 } 330 changed.set(true); 331 error.setIgnored(true); 332 }, processedNodes); 334 333 } 335 334 if (changed.get()) { … … 402 401 selectAction.setEnabled(true); 403 402 if (ignoreAction != null) { 404 ignoreAction.setEnabled(node.get Depth() <= 1);403 ignoreAction.setEnabled(!(node.getUserObject() instanceof Severity)); 405 404 } 406 405 }
Note:
See TracChangeset
for help on using the changeset viewer.