Ticket #12953: patch-layer-manager-migrate-from-mapview.patch

File patch-layer-manager-migrate-from-mapview.patch, 25.0 KB (added by michael2402, 3 years ago)
  • src/org/openstreetmap/josm/command/SelectCommand.java

    diff --git a/src/org/openstreetmap/josm/command/SelectCommand.java b/src/org/openstreetmap/josm/command/SelectCommand.java
    index df372ad..d893d18 100644
    a b public class SelectCommand extends Command { 
    3737
    3838    @Override
    3939    public void undoCommand() {
    40         Main.map.mapView.getEditLayer().data.setSelected(oldSelection);
     40        Main.getLayerManager().getEditLayer().data.setSelected(oldSelection);
    4141    }
    4242
    4343    @Override
    4444    public boolean executeCommand() {
    45         oldSelection = Main.map.mapView.getEditLayer().data.getSelected();
    46         Main.map.mapView.getEditLayer().data.setSelected(newSelection);
     45        oldSelection = Main.getLayerManager().getEditLayer().data.getSelected();
     46        Main.getLayerManager().getEditLayer().data.setSelected(newSelection);
    4747        return true;
    4848    }
    4949
  • src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java

    diff --git a/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java b/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java
    index d3da64b..8f7e927 100644
    a b public class ConflictAddCommand extends Command { 
    6161
    6262    @Override
    6363    public void undoCommand() {
    64         if (Main.isDisplayingMapView() && !Main.map.mapView.hasLayer(getLayer())) {
     64        if (Main.isDisplayingMapView() && !Main.getLayerManager().containsLayer(getLayer())) {
    6565            Main.warn(tr("Layer ''{0}'' does not exist any more. Cannot remove conflict for object ''{1}''.",
    6666                    getLayer().getName(),
    6767                    conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance())
  • src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java

    diff --git a/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java b/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java
    index 98c40de..5f21a57 100644
    a b public abstract class ConflictResolveCommand extends Command { 
    7070        super.undoCommand();
    7171
    7272        if (Main.isDisplayingMapView()) {
    73             if (!Main.map.mapView.hasLayer(getLayer())) {
     73            if (!Main.getLayerManager().containsLayer(getLayer())) {
    7474                Main.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more",
    7575                        this.toString(),
    7676                        getLayer().toString()
    public abstract class ConflictResolveCommand extends Command { 
    7878                return;
    7979            }
    8080
    81             Main.map.mapView.setActiveLayer(getLayer());
     81            Main.getLayerManager().setActiveLayer(getLayer());
    8282        }
    8383        reconstituteConflicts();
    8484    }
  • src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java

    diff --git a/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java b/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java
    index 5905af2..820f9cf 100644
    a b public class RelationMemberConflictResolverCommand extends ConflictResolveComman 
    7474    @Override
    7575    public void undoCommand() {
    7676        OsmDataLayer layer = getLayer();
    77         if (!Main.map.mapView.hasLayer(layer)) {
     77        if (!Main.getLayerManager().containsLayer(layer)) {
    7878            Main.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more",
    7979                    this.toString(),
    8080                    layer.toString()
    public class RelationMemberConflictResolverCommand extends ConflictResolveComman 
    8282            return;
    8383        }
    8484
    85         Main.map.mapView.setActiveLayer(layer);
     85        Main.getLayerManager().setActiveLayer(layer);
    8686        OsmDataLayer editLayer = Main.main.getEditLayer();
    8787
    8888        // restore the former state
  • src/org/openstreetmap/josm/data/AutosaveTask.java

    diff --git a/src/org/openstreetmap/josm/data/AutosaveTask.java b/src/org/openstreetmap/josm/data/AutosaveTask.java
    index d872628..1f84387 100644
    a b public class AutosaveTask extends TimerTask implements LayerChangeListener, List 
    126126            timer.schedule(this, 1000L, PROP_INTERVAL.get() * 1000L);
    127127            MapView.addLayerChangeListener(this);
    128128            if (Main.isDisplayingMapView()) {
    129                 for (OsmDataLayer l: Main.map.mapView.getLayersOfType(OsmDataLayer.class)) {
     129                for (OsmDataLayer l: Main.getLayerManager().getLayersOfType(OsmDataLayer.class)) {
    130130                    registerNewlayer(l);
    131131                }
    132132            }
  • src/org/openstreetmap/josm/gui/ImageryMenu.java

    diff --git a/src/org/openstreetmap/josm/gui/ImageryMenu.java b/src/org/openstreetmap/josm/gui/ImageryMenu.java
    index a6359bc..2797a60 100644
    a b public class ImageryMenu extends JMenu implements LayerChangeListener { 
    6969
    7070        @Override
    7171        public void actionPerformed(ActionEvent e) {
    72             Collection<ImageryLayer> layers = Main.map.mapView.getLayersOfType(ImageryLayer.class);
     72            Collection<ImageryLayer> layers = Main.getLayerManager().getLayersOfType(ImageryLayer.class);
    7373            if (layers.isEmpty()) {
    7474                setEnabled(false);
    7575                return;
  • src/org/openstreetmap/josm/gui/MapView.java

    diff --git a/src/org/openstreetmap/josm/gui/MapView.java b/src/org/openstreetmap/josm/gui/MapView.java
    index c1abe48..5f4df08 100644
    a b LayerManager.LayerChangeListener, MainLayerManager.ActiveLayerChangeListener { 
    416416    @Deprecated
    417417    public static void addEditLayerChangeListener(EditLayerChangeListener listener, boolean initialFire) {
    418418        if (listener != null) {
    419             boolean doFire = initialFire && Main.isDisplayingMapView() && Main.map.mapView.getEditLayer() != null;
     419            boolean doFire = initialFire && Main.isDisplayingMapView() && Main.getLayerManager().getEditLayer() != null;
    420420            if (doFire) {
    421421                Main.getLayerManager().addAndFireActiveLayerChangeListener(new EditLayerChangeAdapter(listener));
    422422            } else {
  • src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java

    diff --git a/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java b/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java
    index 468b2ee..3a43f9d 100644
    a b public abstract class ListMerger<T extends PrimitiveId> extends JPanel implement 
    890890
    891891    protected final <P extends OsmPrimitive> OsmDataLayer findLayerFor(P primitive) {
    892892        if (primitive != null) {
    893             Iterable<OsmDataLayer> layers = Main.map.mapView.getLayersOfType(OsmDataLayer.class);
     893            Iterable<OsmDataLayer> layers = Main.getLayerManager().getLayersOfType(OsmDataLayer.class);
    894894            // Find layer with same dataset
    895895            for (OsmDataLayer layer : layers) {
    896896                if (layer.data == primitive.getDataSet()) {
  • src/org/openstreetmap/josm/gui/dialogs/layer/DuplicateAction.java

    diff --git a/src/org/openstreetmap/josm/gui/dialogs/layer/DuplicateAction.java b/src/org/openstreetmap/josm/gui/dialogs/layer/DuplicateAction.java
    index 2d54c21..ca3c889 100644
    a b public final class DuplicateAction extends AbstractAction implements IEnabledSta 
    5656            return;
    5757
    5858        List<String> layerNames = new ArrayList<>();
    59         for (Layer l: Main.map.mapView.getAllLayers()) {
     59        for (Layer l: Main.getLayerManager().getLayers()) {
    6060            layerNames.add(l.getName());
    6161        }
    6262        if (layer instanceof OsmDataLayer) {
  • src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    diff --git a/src/org/openstreetmap/josm/gui/layer/GpxLayer.java b/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
    index 983093d..da9a97e 100644
    a b public class GpxLayer extends Layer { 
    299299        if (!visibleSegments.isEmpty()) {
    300300            drawHelper.readPreferences(getName());
    301301            drawHelper.drawAll(g, mv, visibleSegments);
    302             if (Main.map.mapView.getActiveLayer() == this) {
     302            if (Main.getLayerManager().getActiveLayer() == this) {
    303303                drawHelper.drawColorBar(g, mv);
    304304            }
    305305        }
  • src/org/openstreetmap/josm/gui/layer/Layer.java

    diff --git a/src/org/openstreetmap/josm/gui/layer/Layer.java b/src/org/openstreetmap/josm/gui/layer/Layer.java
    index 45f505c..66154ef 100644
    a b public abstract class Layer extends AbstractMapViewPaintable implements Destroya 
    170170        // calculate total memory needed for all layers
    171171        long memoryBytesRequired = 50L * 1024L * 1024L; // assumed minimum JOSM memory footprint
    172172        if (Main.map != null && Main.map.mapView != null) {
    173             for (Layer layer: Main.map.mapView.getAllLayers()) {
     173            for (Layer layer: Main.getLayerManager().getLayers()) {
    174174                memoryBytesRequired += layer.estimateMemoryUsage();
    175175            }
    176176            if (memoryBytesRequired >  Runtime.getRuntime().maxMemory()) {
  • src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    diff --git a/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java b/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
    index 8169ef0..53248ff 100644
    a b public class CorrelateGpxWithImages extends AbstractAction { 
    180180                // Search whether an other layer has yet defined some bounding box.
    181181                // If none, we'll zoom to the bounding box of the layer with the photos.
    182182                boolean boundingBoxedLayerFound = false;
    183                 for (Layer l: Main.map.mapView.getAllLayers()) {
     183                for (Layer l: Main.getLayerManager().getLayers()) {
    184184                    if (l != yLayer) {
    185185                        BoundingXYVisitor bbox = new BoundingXYVisitor();
    186186                        l.visitBoundingBox(bbox);
    public class CorrelateGpxWithImages extends AbstractAction { 
    556556    @Override
    557557    public void actionPerformed(ActionEvent arg0) {
    558558        // Construct the list of loaded GPX tracks
    559         Collection<Layer> layerLst = Main.map.mapView.getAllLayers();
     559        Collection<Layer> layerLst = Main.getLayerManager().getLayers();
    560560        GpxDataWrapper defaultItem = null;
    561561        for (Layer cur : layerLst) {
    562562            if (cur instanceof GpxLayer) {
  • src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    diff --git a/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java b/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
    index 70ab30c..10a5f49 100644
    a b public class GeoImageLayer extends AbstractModifiableLayer implements PropertyCh 
    783783     */
    784784    private void clearOtherCurrentPhotos() {
    785785        for (GeoImageLayer layer:
    786                  Main.map.mapView.getLayersOfType(GeoImageLayer.class)) {
     786                 Main.getLayerManager().getLayersOfType(GeoImageLayer.class)) {
    787787            if (layer != this) {
    788788                layer.clearCurrentPhoto(false);
    789789            }
  • src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java

    diff --git a/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java b/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java
    index f4c51c5..553ab70 100644
    a b public class DownloadWmsAlongTrackAction extends AbstractAction { 
    115115        if (!Main.isDisplayingMapView()) {
    116116            return null;
    117117        }
    118         List<AbstractTileSourceLayer> targetLayers = Main.map.mapView.getLayersOfType(AbstractTileSourceLayer.class);
     118        List<AbstractTileSourceLayer> targetLayers = Main.getLayerManager().getLayersOfType(AbstractTileSourceLayer.class);
    119119        if (targetLayers.isEmpty()) {
    120120            if (!GraphicsEnvironment.isHeadless()) {
    121121                warnNoImageryLayers();
  • src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    diff --git a/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java b/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
    index 7f7724a..dc61ea3 100644
    a b public class MarkerLayer extends Layer implements JumpToMarkerLayer { 
    448448        if (!Main.isDisplayingMapView())
    449449            return;
    450450        Marker m = null;
    451         Layer l = Main.map.mapView.getActiveLayer();
     451        Layer l = Main.getLayerManager().getActiveLayer();
    452452        if (l != null) {
    453453            m = getAdjacentMarker(startMarker, next, l);
    454454        }
    455455        if (m == null) {
    456             for (Layer layer : Main.map.mapView.getAllLayers()) {
     456            for (Layer layer : Main.getLayerManager().getLayers()) {
    457457                m = getAdjacentMarker(startMarker, next, layer);
    458458                if (m != null) {
    459459                    break;
  • src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java

    diff --git a/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java b/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java
    index 6959fe3..a02d039 100644
    a b public class MapPaintMenu extends JMenu implements MapPaintSylesUpdateListener { 
    6969        }
    7070
    7171        private static boolean mapHasGpxorMarkerLayer() {
    72             for (Layer layer : Main.map.mapView.getAllLayers()) {
     72            for (Layer layer : Main.getLayerManager().getLayers()) {
    7373                if (layer instanceof GpxLayer || layer instanceof MarkerLayer) {
    7474                    return true;
    7575                }
  • src/org/openstreetmap/josm/io/NoteImporter.java

    diff --git a/src/org/openstreetmap/josm/io/NoteImporter.java b/src/org/openstreetmap/josm/io/NoteImporter.java
    index 8ac259e..da40198 100644
    a b public class NoteImporter extends FileImporter { 
    3737        }
    3838        try (InputStream is = Compression.getUncompressedFileInputStream(file)) {
    3939            final NoteLayer layer = loadLayer(is, file, file.getName(), progressMonitor);
    40             if (Main.map == null || !Main.map.mapView.hasLayer(layer)) {
     40            if (Main.map == null || !Main.getLayerManager().containsLayer(layer)) {
    4141                GuiHelper.runInEDT(new Runnable() {
    4242                    @Override
    4343                    public void run() {
    public class NoteImporter extends FileImporter { 
    6868        final List<Note> fileNotes = new NoteReader(in).parse();
    6969        List<NoteLayer> noteLayers = null;
    7070        if (Main.map != null) {
    71             noteLayers = Main.map.mapView.getLayersOfType(NoteLayer.class);
     71            noteLayers = Main.getLayerManager().getLayersOfType(NoteLayer.class);
    7272        }
    7373        final NoteLayer layer;
    7474        if (noteLayers != null && !noteLayers.isEmpty()) {
  • src/org/openstreetmap/josm/io/OsmApi.java

    diff --git a/src/org/openstreetmap/josm/io/OsmApi.java b/src/org/openstreetmap/josm/io/OsmApi.java
    index d661461..3408a8b 100644
    a b public class OsmApi extends OsmConnection { 
    248248             * to load the layers in the first place because they would have
    249249             * been disabled! */
    250250            if (Main.isDisplayingMapView()) {
    251                 for (Layer l : Main.map.mapView.getLayersOfType(ImageryLayer.class)) {
     251                for (Layer l : Main.getLayerManager().getLayersOfType(ImageryLayer.class)) {
    252252                    if (((ImageryLayer) l).getInfo().isBlacklisted()) {
    253253                        Main.info(tr("Removed layer {0} because it is not allowed by the configured API.", l.getName()));
    254254                        Main.main.removeLayer(l);
  • src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java

    diff --git a/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java b/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java
    index d601f15..f85c5dc 100644
    a b public class ImageryHandler extends RequestHandler.RawURLParseRequestHandler { 
    9494    protected void handleRequest() throws RequestHandlerErrorException {
    9595        final ImageryInfo imgInfo = buildImageryInfo();
    9696        if (Main.isDisplayingMapView()) {
    97             for (ImageryLayer layer : Main.map.mapView.getLayersOfType(ImageryLayer.class)) {
     97            for (ImageryLayer layer : Main.getLayerManager().getLayersOfType(ImageryLayer.class)) {
    9898                if (layer.getInfo().equals(imgInfo)) {
    9999                    Main.info("Imagery layer already exists: "+imgInfo);
    100100                    return;
  • src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java

    diff --git a/src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java b/src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java
    index fe34c07..838997d 100644
    a b public class MarkerSessionExporter extends AbstractSessionExporter<MarkerLayer> 
    4343    @Override
    4444    public Collection<Layer> getDependencies() {
    4545        Layer gpxLayer = layer.fromLayer;
    46         if (gpxLayer != null && Main.map.mapView.hasLayer(gpxLayer))
     46        if (gpxLayer != null && Main.getLayerManager().containsLayer(gpxLayer))
    4747            return Collections.singleton(gpxLayer);
    4848        return Collections.emptySet();
    4949    }
  • test/unit/org/openstreetmap/josm/JOSMFixture.java

    diff --git a/test/unit/org/openstreetmap/josm/JOSMFixture.java b/test/unit/org/openstreetmap/josm/JOSMFixture.java
    index 12872f2..9666bd4 100644
    a b public class JOSMFixture { 
    124124            if (Main.map == null) {
    125125                Main.main.createMapFrame(null, null);
    126126            } else {
    127                 for (Layer l: Main.map.mapView.getAllLayers()) {
     127                for (Layer l: Main.getLayerManager().getLayers()) {
    128128                    Main.map.mapView.removeLayer(l);
    129129                }
    130130            }
  • test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java

    diff --git a/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java b/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java
    index da3a1f8..1650c29 100644
    a b public final class AddImageryLayerActionTest { 
    4646     */
    4747    @Test
    4848    public void testActionPerformedEnabled() {
    49         assertTrue(Main.map.mapView.getLayersOfType(TMSLayer.class).isEmpty());
     49        assertTrue(Main.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty());
    5050        new AddImageryLayerAction(new ImageryInfo("foo_tms", "http://bar", "tms", null, null)).actionPerformed(null);
    51         List<TMSLayer> tmsLayers = Main.map.mapView.getLayersOfType(TMSLayer.class);
     51        List<TMSLayer> tmsLayers = Main.getLayerManager().getLayersOfType(TMSLayer.class);
    5252        assertEquals(1, tmsLayers.size());
    5353
    5454        try {
    5555            new AddImageryLayerAction(new ImageryInfo("wms.openstreetmap.fr", "http://wms.openstreetmap.fr/wms?",
    5656                    "wms_endpoint", null, null)).actionPerformed(null);
    57             List<WMSLayer> wmsLayers = Main.map.mapView.getLayersOfType(WMSLayer.class);
     57            List<WMSLayer> wmsLayers = Main.getLayerManager().getLayersOfType(WMSLayer.class);
    5858            assertEquals(1, wmsLayers.size());
    5959
    6060            Main.map.mapView.removeLayer(wmsLayers.get(0));
    public final class AddImageryLayerActionTest { 
    6868     */
    6969    @Test
    7070    public void testActionPerformedDisabled() {
    71         assertTrue(Main.map.mapView.getLayersOfType(TMSLayer.class).isEmpty());
     71        assertTrue(Main.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty());
    7272        new AddImageryLayerAction(new ImageryInfo()).actionPerformed(null);
    73         assertTrue(Main.map.mapView.getLayersOfType(TMSLayer.class).isEmpty());
     73        assertTrue(Main.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty());
    7474    }
    7575}
  • test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java

    diff --git a/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java b/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java
    index 9a8d73a..f51b203 100644
    a b public class ConflictAddCommandTest { 
    5050     */
    5151    @Test
    5252    public void testExecuteUndoCommand() {
    53         OsmDataLayer layer = Main.map.mapView.getEditLayer();
     53        OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    5454        Conflict<Node> conflict = new Conflict<>(new Node(), new Node());
    5555        ConflictAddCommand cmd = new ConflictAddCommand(layer, conflict);
    5656        assertTrue(cmd.executeCommand());
    public class ConflictAddCommandTest { 
    6666     */
    6767    @Test
    6868    public void testGetDescriptionIcon() {
    69         OsmDataLayer layer = Main.map.mapView.getEditLayer();
     69        OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    7070        Conflict<Node> conflict = new Conflict<>(new Node(), new Node());
    7171        assertNotNull(new ConflictAddCommand(layer, conflict).getDescriptionIcon());
    7272    }
  • test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java

    diff --git a/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java b/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java
    index dd20ea9..ba79468 100644
    a b public class GeoImageLayerTest { 
    4848                        Collections.singleton(new File(TestUtils.getRegressionDataFile(12255, "G0016941.JPG"))),
    4949                        gpxLayer).run();
    5050                assertEquals(2, Main.map.mapView.getNumLayers());
    51                 GeoImageLayer layer = Main.map.mapView.getLayersOfType(GeoImageLayer.class).iterator().next();
     51                GeoImageLayer layer = Main.getLayerManager().getLayersOfType(GeoImageLayer.class).iterator().next();
    5252                try {
    5353                    assertEquals(gpxLayer, layer.getGpxLayer());
    5454                    List<ImageEntry> images = layer.getImages();
  • test/unit/org/openstreetmap/josm/io/NoteImporterTest.java

    diff --git a/test/unit/org/openstreetmap/josm/io/NoteImporterTest.java b/test/unit/org/openstreetmap/josm/io/NoteImporterTest.java
    index 012f095..ca34b92 100644
    a b public class NoteImporterTest { 
    2222    @Test
    2323    public void testTicket12531() {
    2424        if (Main.map != null) {
    25             for (Layer l: Main.map.mapView.getAllLayers()) {
     25            for (Layer l: Main.getLayerManager().getLayers()) {
    2626                Main.map.mapView.removeLayer(l);
    2727            }
    2828            Main.main.setMapFrame(null);
  • test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java

    diff --git a/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java b/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java
    index 0345ca0..912347f 100644
    a b public class ImportHandlerTest { 
    9494        try {
    9595            newHandler("https://localhost?url=" + Utils.encodeUrl(url)).handle();
    9696        } finally {
    97             for (OsmDataLayer layer : Main.map.mapView.getLayersOfType(OsmDataLayer.class)) {
     97            for (OsmDataLayer layer : Main.getLayerManager().getLayersOfType(OsmDataLayer.class)) {
    9898                Main.main.removeLayer(layer);
    9999            }
    100100        }
  • test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    diff --git a/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java b/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java
    index ff23165..d5924eb 100644
    a b public class SessionReaderTest { 
    138138    @Test
    139139    public void testReadNotes() throws IOException, IllegalDataException {
    140140        if (Main.isDisplayingMapView()) {
    141             for (NoteLayer nl : Main.map.mapView.getLayersOfType(NoteLayer.class)) {
     141            for (NoteLayer nl : Main.getLayerManager().getLayersOfType(NoteLayer.class)) {
    142142                Main.map.mapView.removeLayer(nl);
    143143            }
    144144        }