Index: /applications/editors/josm/plugins/walkingpapers/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- /applications/editors/josm/plugins/walkingpapers/.settings/org.eclipse.jdt.core.prefs	(revision 32475)
+++ /applications/editors/josm/plugins/walkingpapers/.settings/org.eclipse.jdt.core.prefs	(revision 32476)
@@ -85,4 +85,5 @@
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
 org.eclipse.jdt.core.compiler.problem.unusedImport=warning
 org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
Index: /applications/editors/josm/plugins/walkingpapers/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- /applications/editors/josm/plugins/walkingpapers/.settings/org.eclipse.jdt.ui.prefs	(revision 32475)
+++ /applications/editors/josm/plugins/walkingpapers/.settings/org.eclipse.jdt.ui.prefs	(revision 32476)
@@ -1,3 +1,61 @@
-#Wed Jul 15 15:49:32 CEST 2009
 eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
 internal.default.compliance=default
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
Index: /applications/editors/josm/plugins/walkingpapers/build.xml
===================================================================
--- /applications/editors/josm/plugins/walkingpapers/build.xml	(revision 32475)
+++ /applications/editors/josm/plugins/walkingpapers/build.xml	(revision 32476)
@@ -5,5 +5,5 @@
     <property name="commit.message" value="Changed the constructor signature of the plugin main class"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="7817"/>
+    <property name="plugin.main.version" value="10279"/>
 
     <property name="plugin.author" value="Frederik Ram"/>
Index: /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java
===================================================================
--- /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java	(revision 32475)
+++ /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java	(revision 32476)
@@ -85,6 +85,5 @@
 
         WalkingPapersLayer wpl = new WalkingPapersLayer(mungedWpId, tile, b, minz, maxz);
-        Main.main.addLayer(wpl);
-
+        Main.getLayerManager().addLayer(wpl);
     }
 
Index: /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersLayer.java
===================================================================
--- /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersLayer.java	(revision 32475)
+++ /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersLayer.java	(revision 32476)
@@ -21,8 +21,13 @@
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
 import org.openstreetmap.josm.gui.MapView;
-import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
 import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
 import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
+import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
+import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -67,26 +72,41 @@
         clearTileStorage();
 
-        MapView.addLayerChangeListener(new LayerChangeListener() {
-            public void activeLayerChange(Layer oldLayer, Layer newLayer) {
-                // if user changes to a walking papers layer, zoom there just as if
-                // it was newly added
-                layerAdded(newLayer);
-            }
-
-            public void layerAdded(Layer newLayer) {
-                // only do something if we are affected
-                if (newLayer != WalkingPapersLayer.this) return;
-                BoundingXYVisitor bbox = new BoundingXYVisitor();
-                bbox.visit(printBounds);
-                Main.map.mapView.zoomTo(bbox);
-                needRedraw = true;
-            }
-
-            public void layerRemoved(Layer oldLayer) {
-                if (oldLayer == WalkingPapersLayer.this) {
-                    MapView.removeLayerChangeListener(this);
+        final ActiveLayerChangeListener activeListener = new ActiveLayerChangeListener() {
+            @Override
+            public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
+                // if user changes to a walking papers layer, zoom there just as if it was newly added
+                handleNewLayer(Main.getLayerManager().getActiveLayer());
+            }
+        };
+
+        Main.getLayerManager().addActiveLayerChangeListener(activeListener);
+        Main.getLayerManager().addLayerChangeListener(new LayerChangeListener() {
+
+            @Override
+            public void layerAdded(LayerAddEvent e) {
+                handleNewLayer(e.getAddedLayer());
+            }
+
+            @Override
+            public void layerRemoving(LayerRemoveEvent e) {
+                if (e.getRemovedLayer() == WalkingPapersLayer.this) {
+                    Main.getLayerManager().removeLayerChangeListener(this);
+                    Main.getLayerManager().removeActiveLayerChangeListener(activeListener);
                 }
             }
+
+            @Override
+            public void layerOrderChanged(LayerOrderChangeEvent e) {
+            }
         });
+    }
+
+    private void handleNewLayer(Layer newLayer) {
+        // only do something if we are affected
+        if (newLayer != WalkingPapersLayer.this) return;
+        BoundingXYVisitor bbox = new BoundingXYVisitor();
+        bbox.visit(printBounds);
+        Main.map.mapView.zoomTo(bbox);
+        needRedraw = true;
     }
 
@@ -117,4 +137,5 @@
 
     static class TileTimeComp implements Comparator<WalkingPapersTile> {
+        @Override
         public int compare(WalkingPapersTile s1, WalkingPapersTile s2) {
             long t1 = s1.access_time();
@@ -170,5 +191,5 @@
         int realHeight = img.getHeight(this);
         if (realWidth == -1 || realHeight == -1)
-                return null;
+            return null;
         int drawWidth = p1.x - p0.x;
         int drawHeight = p1.x - p0.x;
@@ -189,6 +210,6 @@
 
         if (botRight.lon() == 0.0 || botRight.lat() == 0) {
-                // probably still initializing
-                return;
+            // probably still initializing
+            return;
         }
         if (lastTopLeft != null && lastBotRight != null
@@ -209,7 +230,7 @@
 
         if (!LatLon.isValidLat(topLeft.lat())  ||
-            !LatLon.isValidLat(botRight.lat()) ||
-            !LatLon.isValidLon(topLeft.lon())  ||
-            !LatLon.isValidLon(botRight.lon()))
+                !LatLon.isValidLat(botRight.lat()) ||
+                !LatLon.isValidLon(topLeft.lon())  ||
+                !LatLon.isValidLon(botRight.lon()))
             return;
 
@@ -257,5 +278,5 @@
                     // check if tile is in range
                     Bounds tileBounds = new Bounds(new LatLon(tileYToLat(y+1), tileXToLon(x)),
-                        new LatLon(tileYToLat(y), tileXToLon(x+1)));
+                            new LatLon(tileYToLat(y), tileXToLon(x+1)));
                     if (!tileBounds.asRect().intersects(printBounds.asRect())) continue;
                     tile = new WalkingPapersTile(x, y, currentZoomLevel, this);
@@ -397,4 +418,5 @@
     }
 
+    @Override
     public boolean imageUpdate(Image img, int infoflags, int x, int y,
             int width, int height) {
@@ -414,7 +436,7 @@
     public URL formatImageUrl(int x, int y, int z) {
         String urlstr = tileUrlTemplate.
-            replace("{x}", String.valueOf(x)).
-            replace("{y}", String.valueOf(y)).
-            replace("{z}", String.valueOf(z));
+                replace("{x}", String.valueOf(x)).
+                replace("{y}", String.valueOf(y)).
+                replace("{z}", String.valueOf(z));
         try {
             return new URL(urlstr);
