source: josm/trunk/src/org/openstreetmap/josm/data/DataSetChecker.java@ 2198

Last change on this file since 2198 was 2017, checked in by Gubaer, 15 years ago

removed OptionPaneUtil
cleanup of deprecated Layer API
cleanup of deprecated APIs in OsmPrimitive and Way
cleanup of imports

  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.data;
3
4import java.util.HashSet;
5import java.util.Set;
6
7import javax.swing.JOptionPane;
8
9import org.openstreetmap.josm.Main;
10import org.openstreetmap.josm.data.osm.OsmPrimitive;
11import org.openstreetmap.josm.gui.layer.Layer;
12import org.openstreetmap.josm.gui.layer.OsmDataLayer;
13
14// FIXME: class still needed?
15
16public class DataSetChecker {
17
18 public static void check() {
19 if (Main.map == null)
20 return;
21
22 Set<OsmPrimitive> s = new HashSet<OsmPrimitive>();
23 for (Layer l : Main.map.mapView.getAllLayers()) {
24 if (l instanceof OsmDataLayer) {
25 for (OsmPrimitive osm : ((OsmDataLayer)l).data.allPrimitives()) {
26 if (s.contains(osm)) {
27 // FIXME: better message
28 // FIXME: translate message and title
29 JOptionPane.showMessageDialog(
30 Main.parent,
31 "cross references",
32 "Information",
33 JOptionPane.INFORMATION_MESSAGE);
34 return;
35 }
36 s.add(osm);
37 }
38 }
39 }
40
41 if (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
42 OsmDataLayer l = (OsmDataLayer)Main.map.mapView.getActiveLayer();
43 if (l.data != Main.main.getCurrentDataSet()) {
44 JOptionPane.showMessageDialog(
45 Main.parent,
46 "Main.ds / active layer mismatch",
47 "Error",
48 JOptionPane.ERROR_MESSAGE
49 );
50 return;
51 }
52 }
53
54 JOptionPane.showMessageDialog(
55 Main.parent, "working", "", JOptionPane.INFORMATION_MESSAGE);
56 }
57}
Note: See TracBrowser for help on using the repository browser.