Index: /applications/editors/josm/plugins/imagery_offset_db/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/.settings/org.eclipse.jdt.ui.prefs	(revision 32462)
+++ /applications/editors/josm/plugins/imagery_offset_db/.settings/org.eclipse.jdt.ui.prefs	(revision 32462)
@@ -0,0 +1,60 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+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/imagery_offset_db/build.xml
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/build.xml	(revision 32461)
+++ /applications/editors/josm/plugins/imagery_offset_db/build.xml	(revision 32462)
@@ -5,5 +5,5 @@
     <property name="commit.message" value="Imagery Offset Database"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="10279"/>
+    <property name="plugin.main.version" value="10353"/>
 	<property name="plugin.canloadatruntime" value="true"/>
 
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetWatcher.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetWatcher.java	(revision 32461)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetWatcher.java	(revision 32462)
@@ -1,10 +1,26 @@
 package iodb;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.TreeMap;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.NavigatableComponent.ZoomChangeListener;
 import org.openstreetmap.josm.gui.layer.ImageryLayer;
 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.Destroyable;
 
@@ -16,5 +32,5 @@
  * @license WTFPL
  */
-public class ImageryOffsetWatcher implements MapView.ZoomChangeListener, MapView.LayerChangeListener, Destroyable {
+public class ImageryOffsetWatcher implements ZoomChangeListener, LayerChangeListener, ActiveLayerChangeListener, Destroyable {
     private static final double THRESHOLD = 1e-8;
     private static ImageryOffsetWatcher instance;
@@ -32,5 +48,6 @@
         maxDistance = Main.pref.getDouble("iodb.offset.radius", 15);
         MapView.addZoomChangeListener(this);
-        MapView.addLayerChangeListener(this);
+        Main.getLayerManager().addLayerChangeListener(this);
+        Main.getLayerManager().addActiveLayerChangeListener(this);
         checkOffset(); // we assume there's at the most one imagery layer at this moment
         time = new Timer();
@@ -41,7 +58,9 @@
      * Unregister all events. This actually gets never called, but it's not a problem.
      */
+    @Override
     public void destroy() {
         MapView.removeZoomChangeListener(this);
-        MapView.removeLayerChangeListener(this);
+        Main.getLayerManager().removeLayerChangeListener(this);
+        Main.getLayerManager().removeActiveLayerChangeListener(this);
         time.cancel();
     }
@@ -165,20 +184,29 @@
     }
 
+    @Override
     public void zoomChanged() {
         checkOffset();
     }
 
-    public void activeLayerChange( Layer oldLayer, Layer newLayer ) {
-        checkOffset();
-    }
-
-    public void layerAdded( Layer newLayer ) {
-        if( newLayer instanceof ImageryLayer )
-            loadLayerOffset((ImageryLayer)newLayer);
-        checkOffset();
-    }
-
-    public void layerRemoved( Layer oldLayer ) {
-        checkOffset();
+    @Override
+    public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
+        checkOffset();
+    }
+
+    @Override
+    public void layerAdded(LayerAddEvent e) {
+        Layer newLayer = e.getAddedLayer();
+        if (newLayer instanceof ImageryLayer)
+            loadLayerOffset((ImageryLayer) newLayer);
+        checkOffset();
+    }
+
+    @Override
+    public void layerRemoving(LayerRemoveEvent e) {
+        checkOffset();
+    }
+
+    @Override
+    public void layerOrderChanged(LayerOrderChangeEvent e) {
     }
 
@@ -204,5 +232,5 @@
 
     /**
-     * Loads the current imagery layer offset from preferences. 
+     * Loads the current imagery layer offset from preferences.
      */
     private void loadLayerOffset( ImageryLayer layer ) {
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java	(revision 32461)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java	(revision 32462)
@@ -38,4 +38,5 @@
 import org.openstreetmap.josm.gui.JosmUserIdentityManager;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.NavigatableComponent.ZoomChangeListener;
 import org.openstreetmap.josm.gui.layer.ImageryLayer;
 import org.openstreetmap.josm.gui.layer.MapViewPaintable;
@@ -51,5 +52,5 @@
  * @license WTFPL
  */
-public class OffsetDialog extends JDialog implements ActionListener, MapView.ZoomChangeListener, MapViewPaintable {
+public class OffsetDialog extends JDialog implements ActionListener, ZoomChangeListener, MapViewPaintable {
     protected static final String PREF_CALIBRATION = "iodb.show.calibration";
     protected static final String PREF_DEPRECATED = "iodb.show.deprecated";
@@ -276,6 +277,6 @@
                 JOptionPane.showMessageDialog(Main.parent,
                         tr("The topmost imagery layer has been shifted to presumably match\n"
-                        + "OSM data in the area. Please check that the offset is still valid\n"
-                        + "by downloading GPS tracks and comparing them and OSM data to the imagery."),
+                                + "OSM data in the area. Please check that the offset is still valid\n"
+                                + "by downloading GPS tracks and comparing them and OSM data to the imagery."),
                         ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE);
                 Main.pref.put("iodb.offset.message", true);
@@ -283,10 +284,10 @@
         } else if( selectedOffset instanceof CalibrationObject ) {
             CalibrationLayer clayer = new CalibrationLayer((CalibrationObject)selectedOffset);
-            Main.map.mapView.addLayer(clayer);
+            Main.getLayerManager().addLayer(clayer);
             clayer.panToCenter();
             if( !Main.pref.getBoolean("iodb.calibration.message", false) ) {
                 JOptionPane.showMessageDialog(Main.parent,
                         tr("A layer has been added with a calibration geometry. Hide data layers,\n"
-                        + "find the corresponding feature on the imagery layer and move it accordingly."),
+                                + "find the corresponding feature on the imagery layer and move it accordingly."),
                         ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE);
                 Main.pref.put("iodb.calibration.message", true);
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java	(revision 32461)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java	(revision 32462)
@@ -1,20 +1,27 @@
 package iodb;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.event.ActionEvent;
 import java.io.UnsupportedEncodingException;
-import java.net.*;
-import java.util.*;
+import java.net.URLEncoder;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.swing.JOptionPane;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.data.osm.*;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.JosmUserIdentityManager;
 import org.openstreetmap.josm.gui.layer.ImageryLayer;
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 /**
  * Upload the current imagery offset or an calibration geometry information.
- * 
+ *
  * @author Zverik
  * @license WTFPL
@@ -39,4 +46,5 @@
      * and we don't have one when a user name is needed.
      */
+    @Override
     public void actionPerformed(ActionEvent e) {
         if( Main.map == null || Main.map.mapView == null )
@@ -56,9 +64,9 @@
         if( userName.indexOf('@') > 0 )
             userName = userName.replace('@', ',');
-            
+
         // check if an object suitable for calibration is selected
         OsmPrimitive calibration = null;
-        if( getCurrentDataSet() != null ) {
-            Collection<OsmPrimitive> selectedObjects = getCurrentDataSet().getSelected();
+        if (getLayerManager().getEditDataSet() != null) {
+            Collection<OsmPrimitive> selectedObjects = getLayerManager().getEditDataSet().getSelected();
             if( selectedObjects.size() == 1 ) {
                 OsmPrimitive selection = selectedObjects.iterator().next();
