1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.data;
|
---|
3 |
|
---|
4 | import java.util.HashSet;
|
---|
5 | import java.util.Set;
|
---|
6 |
|
---|
7 | import javax.swing.JOptionPane;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.Main;
|
---|
10 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
11 | import org.openstreetmap.josm.gui.layer.Layer;
|
---|
12 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
13 |
|
---|
14 | // FIXME: class still needed?
|
---|
15 |
|
---|
16 | public 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 | }
|
---|