Index: /applications/editors/josm/plugins/imagery_offset_db/.checkstyle
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/.checkstyle	(revision 32528)
+++ /applications/editors/josm/plugins/imagery_offset_db/.checkstyle	(revision 32528)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+  <local-check-config name="JOSM" location="/JOSM/tools/checkstyle/josm_checks.xml" type="project" description="">
+    <additional-data name="protect-config-file" value="false"/>
+  </local-check-config>
+  <fileset name="all" enabled="true" check-config-name="JOSM" local="true">
+    <file-match-pattern match-pattern="." include-pattern="true"/>
+  </fileset>
+  <filter name="DerivedFiles" enabled="true"/>
+  <filter name="FilesFromPackage" enabled="true">
+    <filter-data value="data"/>
+    <filter-data value="images"/>
+    <filter-data value="styles"/>
+    <filter-data value="resources"/>
+    <filter-data value="scripts"/>
+  </filter>
+</fileset-config>
Index: /applications/editors/josm/plugins/imagery_offset_db/.project
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/.project	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/.project	(revision 32528)
@@ -16,7 +16,13 @@
 			</arguments>
 		</buildCommand>
+		<buildCommand>
+			<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
 	</buildSpec>
 	<natures>
 		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
 	</natures>
 </projectDescription>
Index: /applications/editors/josm/plugins/imagery_offset_db/LICENSE
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/LICENSE	(revision 32528)
+++ /applications/editors/josm/plugins/imagery_offset_db/LICENSE	(revision 32528)
@@ -0,0 +1,13 @@
+            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+                    Version 2, December 2004
+
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. You just DO WHAT THE FUCK YOU WANT TO.
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/CalibrationLayer.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/CalibrationLayer.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/CalibrationLayer.java	(revision 32528)
@@ -1,8 +1,22 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
-import java.awt.*;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.RenderingHints;
+import java.awt.Stroke;
 import java.awt.event.ActionEvent;
 import java.awt.geom.GeneralPath;
-import javax.swing.*;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.Icon;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.AutoScaleAction;
@@ -14,5 +28,4 @@
 import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
 import org.openstreetmap.josm.gui.layer.Layer;
-import static org.openstreetmap.josm.tools.I18n.tr;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -29,5 +42,5 @@
     private LatLon center;
 
-    public CalibrationLayer( CalibrationObject obj ) {
+    public CalibrationLayer(CalibrationObject obj) {
         super(tr("Calibration Layer"));
         color = Color.RED;
@@ -40,5 +53,5 @@
      */
     @Override
-    public void paint( Graphics2D g, MapView mv, Bounds box ) {
+    public void paint(Graphics2D g, MapView mv, Bounds box) {
         g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         Stroke oldStroke = g.getStroke();
@@ -46,5 +59,5 @@
         g.setStroke(new BasicStroke(1));
         LatLon[] geometry = obj.getGeometry();
-        if( geometry.length == 1 ) {
+        if (geometry.length == 1) {
             // draw crosshair
             Point p = mv.getPoint(geometry[0]);
@@ -54,10 +67,10 @@
             g.drawLine(p.x, p.y - 10, p.x, p.y - 20);
             g.drawLine(p.x, p.y + 10, p.x, p.y + 20);
-        } else if( geometry.length > 1 ) {
+        } else if (geometry.length > 1) {
             // draw a line
             GeneralPath path = new GeneralPath();
-            for( int i = 0; i < geometry.length; i++ ) {
+            for (int i = 0; i < geometry.length; i++) {
                 Point p = mv.getPoint(geometry[i]);
-                if( i == 0 )
+                if (i == 0)
                     path.moveTo(p.x, p.y);
                 else
@@ -71,5 +84,5 @@
     @Override
     public Icon getIcon() {
-        if( icon == null )
+        if (icon == null)
             icon = ImageProvider.get("calibration_layer");
         return icon;
@@ -77,9 +90,9 @@
 
     @Override
-    public void mergeFrom( Layer from ) {
-    }
-
-    @Override
-    public boolean isMergable( Layer other ) {
+    public void mergeFrom(Layer from) {
+    }
+
+    @Override
+    public boolean isMergable(Layer other) {
         return false;
     }
@@ -89,7 +102,8 @@
      */
     @Override
-    public void visitBoundingBox( BoundingXYVisitor v ) {
-        for( LatLon ll : obj.getGeometry() )
+    public void visitBoundingBox(BoundingXYVisitor v) {
+        for (LatLon ll : obj.getGeometry()) {
             v.visit(ll);
+        }
     }
 
@@ -99,5 +113,5 @@
     @Override
     public String getToolTipText() {
-        if( obj.isDeprecated() )
+        if (obj.isDeprecated())
             return tr("A deprecated calibration geometry of {0} nodes by {1}", obj.getGeometry().length, obj.getAuthor());
         else
@@ -116,13 +130,13 @@
     public Action[] getMenuEntries() {
         return new Action[] {
-            LayerListDialog.getInstance().createShowHideLayerAction(),
-            LayerListDialog.getInstance().createDeleteLayerAction(),
-            SeparatorLayerAction.INSTANCE,
-            new ZoomToLayerAction(),
-            new SelectColorAction(Color.RED),
-            new SelectColorAction(Color.CYAN),
-            new SelectColorAction(Color.YELLOW),
-            SeparatorLayerAction.INSTANCE,
-            new LayerListPopup.InfoAction(this)
+                LayerListDialog.getInstance().createShowHideLayerAction(),
+                LayerListDialog.getInstance().createDeleteLayerAction(),
+                SeparatorLayerAction.INSTANCE,
+                new ZoomToLayerAction(),
+                new SelectColorAction(Color.RED),
+                new SelectColorAction(Color.CYAN),
+                new SelectColorAction(Color.YELLOW),
+                SeparatorLayerAction.INSTANCE,
+                new LayerListPopup.InfoAction(this)
         };
     }
@@ -134,9 +148,9 @@
      */
     public void panToCenter() {
-        if( center == null ) {
+        if (center == null) {
             LatLon[] geometry = obj.getGeometry();
             double lat = 0.0;
             double lon = 0.0;
-            for( int i = 0; i < geometry.length; i++ ) {
+            for (int i = 0; i < geometry.length; i++) {
                 lon += geometry[i].lon();
                 lat += geometry[i].lat();
@@ -155,5 +169,5 @@
         private Color c;
 
-        public SelectColorAction( Color color ) {
+        SelectColorAction(Color color) {
             super(tr("Change Color"));
             putValue(SMALL_ICON, new SingleColorIcon(color));
@@ -161,5 +175,6 @@
         }
 
-        public void actionPerformed( ActionEvent e ) {
+        @Override
+        public void actionPerformed(ActionEvent e) {
             color = c;
             Main.map.mapView.repaint();
@@ -173,21 +188,23 @@
         private Color color;
 
-        public SingleColorIcon( Color color ) {
+        SingleColorIcon(Color color) {
             this.color = color;
         }
 
-        public void paintIcon( Component c, Graphics g, int x, int y ) {
+        @Override
+        public void paintIcon(Component c, Graphics g, int x, int y) {
             g.setColor(color);
             g.fillRect(x, y, 24, 24);
         }
 
+        @Override
         public int getIconWidth() {
             return 24;
         }
 
+        @Override
         public int getIconHeight() {
             return 24;
         }
-
     }
 
@@ -197,10 +214,11 @@
      */
     class ZoomToLayerAction extends AbstractAction {
-        public ZoomToLayerAction() {
+        ZoomToLayerAction() {
             super(tr("Zoom to {0}", tr("layer"))); // to use translation from AutoScaleAction
             putValue(SMALL_ICON, ImageProvider.get("dialogs/autoscale/layer"));
         }
 
-        public void actionPerformed( ActionEvent e ) {
+        @Override
+        public void actionPerformed(ActionEvent e) {
             AutoScaleAction.autoScale("layer");
         }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/CalibrationObject.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/CalibrationObject.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/CalibrationObject.java	(revision 32528)
@@ -1,5 +1,7 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
 import java.util.Map;
+
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.Node;
@@ -28,11 +30,12 @@
      * Initialize a calibration object from OSM primitive.
      */
-    public CalibrationObject( OsmPrimitive p ) {
-        if( p instanceof Node )
-            geometry = new LatLon[] { ((Node)p).getCoor() };
-        else if( p instanceof Way ) {
-            geometry = new LatLon[((Way)p).getNodesCount()];
-            for( int i = 0; i < geometry.length; i++ )
-                geometry[i] = ((Way)p).getNode(i).getCoor();
+    public CalibrationObject(OsmPrimitive p) {
+        if (p instanceof Node)
+            geometry = new LatLon[] {((Node) p).getCoor()};
+        else if (p instanceof Way) {
+            geometry = new LatLon[((Way) p).getNodesCount()];
+            for (int i = 0; i < geometry.length; i++) {
+                geometry[i] = ((Way) p).getNode(i).getCoor();
+            }
         } else
             throw new IllegalArgumentException("Calibration Object can be created either from node or a way");
@@ -47,9 +50,9 @@
 
     @Override
-    public void putServerParams( Map<String, String> map ) {
+    public void putServerParams(Map<String, String> map) {
         super.putServerParams(map);
         StringBuilder sb = new StringBuilder();
-        for( int i = 0; i < geometry.length; i++ ) {
-            if( i > 0 )
+        for (int i = 0; i < geometry.length; i++) {
+            if (i > 0)
                 sb.append(',');
             sb.append(geometry[i].lon()).append(' ').append(geometry[i].lat());
@@ -60,5 +63,6 @@
     @Override
     public String toString() {
-        return "CalibrationObject{" + geometry.length + "nodes; position=" + position + ", date=" + date + ", author=" + author + ", description=" + description + ", abandonDate=" + abandonDate + '}';
+        return "CalibrationObject{" + geometry.length + "nodes; position=" + position + ", date=" + date + ", author=" + author +
+                ", description=" + description + ", abandonDate=" + abandonDate + '}';
     }
 }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/DeprecateOffsetAction.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/DeprecateOffsetAction.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/DeprecateOffsetAction.java	(revision 32528)
@@ -1,17 +1,21 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.event.ActionEvent;
 import java.io.UnsupportedEncodingException;
-import java.net.*;
+import java.net.URLEncoder;
+
 import javax.swing.AbstractAction;
 import javax.swing.JOptionPane;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.JosmUserIdentityManager;
-import static org.openstreetmap.josm.tools.I18n.tr;
 import org.openstreetmap.josm.tools.ImageProvider;
 
 /**
  * A context-dependent action to deprecate an offset.
- * 
+ *
  * @author Zverik
  * @license WTFPL
@@ -20,9 +24,9 @@
     private ImageryOffsetBase offset;
     private QuerySuccessListener listener;
-    
+
     /**
      * Initialize an action with an offset object.
      */
-    public DeprecateOffsetAction( ImageryOffsetBase offset ) {
+    public DeprecateOffsetAction(ImageryOffsetBase offset) {
         super(tr("Deprecate Offset"));
         putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
@@ -37,17 +41,18 @@
      * on a positive answer.
      */
+    @Override
     public void actionPerformed(ActionEvent e) {
-        if( Main.map == null || Main.map.mapView == null || !Main.map.isVisible() )
+        if (Main.map == null || Main.map.mapView == null || !Main.map.isVisible())
             return;
-        
+
         String desc = offset instanceof ImageryOffset ?
                 tr("Are you sure this imagery offset is wrong?") :
-                tr("Are you sure this calibration geometry is aligned badly?");
-        if( JOptionPane.showConfirmDialog(Main.parent,
-                tr("Warning: deprecation is basically irreversible!")+ "\n" + desc,
-                ImageryOffsetTools.DIALOG_TITLE, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION ) {
-            return;
-        }
-        deprecateOffset(offset, listener);
+                    tr("Are you sure this calibration geometry is aligned badly?");
+                if (JOptionPane.showConfirmDialog(Main.parent,
+                        tr("Warning: deprecation is basically irreversible!")+ "\n" + desc,
+                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION) {
+                    return;
+                }
+                deprecateOffset(offset, listener);
     }
 
@@ -55,5 +60,5 @@
      * Installs a listener to process successful deprecation event.
      */
-    public void setListener( QuerySuccessListener listener ) {
+    public void setListener(QuerySuccessListener listener) {
         this.listener = listener;
     }
@@ -61,7 +66,7 @@
     /**
      * Deprecate the given offset.
-     * @see #deprecateOffset(iodb.ImageryOffsetBase, iodb.QuerySuccessListener) 
+     * @see #deprecateOffset(iodb.ImageryOffsetBase, iodb.QuerySuccessListener)
      */
-    public static void deprecateOffset( ImageryOffsetBase offset ) {
+    public static void deprecateOffset(ImageryOffsetBase offset) {
         deprecateOffset(offset, null);
     }
@@ -71,8 +76,9 @@
      * and executes {@link SimpleOffsetQueryTask} with a query to deprecate the offset.
      */
-    public static void deprecateOffset( ImageryOffsetBase offset, QuerySuccessListener listener ) {
+    public static void deprecateOffset(ImageryOffsetBase offset, QuerySuccessListener listener) {
         String userName = JosmUserIdentityManager.getInstance().getUserName();
-        if( userName == null ) {
-            JOptionPane.showMessageDialog(Main.parent, tr("To store imagery offsets you must be a registered OSM user."), ImageryOffsetTools.DIALOG_TITLE, JOptionPane.ERROR_MESSAGE);
+        if (userName == null) {
+            JOptionPane.showMessageDialog(Main.parent, tr("To store imagery offsets you must be a registered OSM user."),
+                    ImageryOffsetTools.DIALOG_TITLE, JOptionPane.ERROR_MESSAGE);
             return;
         }
@@ -80,20 +86,20 @@
         String message = offset instanceof ImageryOffset
                 ? tr("Please enter the reason why you mark this imagery offset as deprecated")
-                : tr("Please enter the reason why you mark this calibration geometry as deprecated");
-        String reason = StoreImageryOffsetAction.queryDescription(message + ":");
-        if( reason == null )
-            return;
-        
-        try {
-            String query = "deprecate?id=" + offset.getId()
-                + "&author=" + URLEncoder.encode(userName, "UTF8")
-                + "&reason=" + URLEncoder.encode(reason, "UTF8");
-            SimpleOffsetQueryTask depTask = new SimpleOffsetQueryTask(query, tr("Notifying the server of the deprecation..."));
-            if( listener != null )
-                depTask.setListener(listener);
-            Main.worker.submit(depTask);
-        } catch( UnsupportedEncodingException ex ) {
-            // WTF
-        }
+                        : tr("Please enter the reason why you mark this calibration geometry as deprecated");
+                String reason = StoreImageryOffsetAction.queryDescription(message + ":");
+                if (reason == null)
+                    return;
+
+                try {
+                    String query = "deprecate?id=" + offset.getId()
+                    + "&author=" + URLEncoder.encode(userName, "UTF8")
+                    + "&reason=" + URLEncoder.encode(reason, "UTF8");
+                    SimpleOffsetQueryTask depTask = new SimpleOffsetQueryTask(query, tr("Notifying the server of the deprecation..."));
+                    if (listener != null)
+                        depTask.setListener(listener);
+                    Main.worker.submit(depTask);
+                } catch (UnsupportedEncodingException ex) {
+                    Main.error(ex);
+                }
     }
 }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/GetImageryOffsetAction.java	(revision 32528)
@@ -1,3 +1,6 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.event.ActionEvent;
@@ -5,9 +8,11 @@
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
-import java.net.*;
-import java.util.*;
+import java.net.URLEncoder;
+import java.util.List;
+
 import javax.swing.Action;
 import javax.swing.Icon;
 import javax.swing.JOptionPane;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
@@ -16,5 +21,4 @@
 import org.openstreetmap.josm.data.projection.Projection;
 import org.openstreetmap.josm.gui.layer.ImageryLayer;
-import static org.openstreetmap.josm.tools.I18n.tr;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -22,5 +26,5 @@
 /**
  * Download a list of imagery offsets for the current position, let user choose which one to use.
- * 
+ *
  * @author Zverik
  * @license WTFPL
@@ -29,5 +33,5 @@
     private Icon iconOffsetOk;
     private Icon iconOffsetBad;
-    
+
     /**
      * Initialize the action. Sets "Ctrl+Alt+I" shortcut: the only shortcut in this plugin.
@@ -37,5 +41,5 @@
         super(tr("Get Imagery Offset..."), "getoffset", tr("Download offsets for current imagery from a server"),
                 Shortcut.registerShortcut("imageryoffset:get", tr("Imagery: {0}", tr("Get Imagery Offset...")),
-                KeyEvent.VK_I, Shortcut.ALT_CTRL), true);
+                        KeyEvent.VK_I, Shortcut.ALT_CTRL), true);
         iconOffsetOk = new ImageProvider("getoffset").setSize(ImageProvider.ImageSizes.MENU).get();
         iconOffsetBad = new ImageProvider("getoffsetnow").setSize(ImageProvider.ImageSizes.MENU).get();
@@ -46,6 +50,7 @@
      * The action just executes {@link DownloadOffsetsTask}.
      */
+    @Override
     public void actionPerformed(ActionEvent e) {
-        if( Main.map == null || Main.map.mapView == null || !Main.map.isVisible() )
+        if (Main.map == null || Main.map.mapView == null || !Main.map.isVisible())
             return;
         Projection proj = Main.map.mapView.getProjection();
@@ -53,7 +58,7 @@
         ImageryLayer layer = ImageryOffsetTools.getTopImageryLayer();
         String imagery = ImageryOffsetTools.getImageryID(layer);
-        if( imagery == null )
+        if (imagery == null)
             return;
-        
+
         DownloadOffsetsTask download = new DownloadOffsetsTask(center, layer, imagery);
         Main.worker.submit(download);
@@ -67,12 +72,12 @@
     protected void updateEnabledState() {
         boolean state = true;
-        if( Main.map == null || Main.map.mapView == null || !Main.map.isVisible() )
+        if (Main.map == null || Main.map.mapView == null || !Main.map.isVisible())
             state = false;
         ImageryLayer layer = ImageryOffsetTools.getTopImageryLayer();
-        if( ImageryOffsetTools.getImageryID(layer) == null )
+        if (ImageryOffsetTools.getImageryID(layer) == null)
             state = false;
         setEnabled(state);
     }
-    
+
     /**
      * Display a dialog for choosing between offsets. If there are no offsets in
@@ -80,6 +85,6 @@
      * @param offsets List of offset objects to choose from.
      */
-    private void showOffsetDialog( List<ImageryOffsetBase> offsets ) {
-        if( offsets.isEmpty() ) {
+    private void showOffsetDialog(List<ImageryOffsetBase> offsets) {
+        if (offsets.isEmpty()) {
             JOptionPane.showMessageDialog(Main.parent,
                     tr("No data for this region. Please adjust imagery layer and upload an offset."),
@@ -88,5 +93,5 @@
         }
         OffsetDialog offsetDialog = new OffsetDialog(offsets);
-        if( offsetDialog.showDialog() != null )
+        if (offsetDialog.showDialog() != null)
             offsetDialog.applyOffset();
     }
@@ -95,5 +100,6 @@
      * Update action icon based on an offset state.
      */
-    public void offsetStateChanged( boolean isOffsetGood ) {
+    @Override
+    public void offsetStateChanged(boolean isOffsetGood) {
         putValue(Action.SMALL_ICON, isOffsetGood ? iconOffsetOk : iconOffsetBad);
     }
@@ -122,15 +128,15 @@
          * @param imagery Imagery ID for the layer.
          */
-        public DownloadOffsetsTask( LatLon center, ImageryLayer layer, String imagery ) {
+        DownloadOffsetsTask(LatLon center, ImageryLayer layer, String imagery) {
             super(null, tr("Loading imagery offsets..."));
             try {
                 String query = "get?lat=" + center.latToString(CoordinateFormat.DECIMAL_DEGREES)
-                        + "&lon=" + center.lonToString(CoordinateFormat.DECIMAL_DEGREES)
-                        + "&imagery=" + URLEncoder.encode(imagery, "UTF8");
+                + "&lon=" + center.lonToString(CoordinateFormat.DECIMAL_DEGREES)
+                + "&imagery=" + URLEncoder.encode(imagery, "UTF8");
                 int radius = Main.pref.getInteger("iodb.radius", -1);
-                if( radius > 0 )
+                if (radius > 0)
                     query = query + "&radius=" + radius;
                 setQuery(query);
-            } catch( UnsupportedEncodingException e ) {
+            } catch (UnsupportedEncodingException e) {
                 throw new IllegalArgumentException(e);
             }
@@ -142,8 +148,8 @@
         @Override
         protected void afterFinish() {
-            if( !cancelled && offsets != null )
+            if (!cancelled && offsets != null)
                 showOffsetDialog(offsets);
         }
-        
+
         /**
          * Parses the response with {@link IODBReader}.
@@ -152,9 +158,9 @@
          */
         @Override
-        protected void processResponse( InputStream inp ) throws UploadException {
+        protected void processResponse(InputStream inp) throws UploadException {
             offsets = null;
             try {
                 offsets = new IODBReader(inp).parse();
-            } catch( Exception e ) {
+            } catch (Exception e) {
                 throw new UploadException(tr("Error processing XML response: {0}", e.getMessage()));
             }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/IODBReader.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/IODBReader.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/IODBReader.java	(revision 32528)
@@ -1,2 +1,3 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
@@ -8,6 +9,8 @@
 import java.util.Date;
 import java.util.List;
+
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
+
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.io.UTFInputStreamReader;
@@ -20,5 +23,5 @@
  * Parses the server response. It expects XML in UTF-8 with several &lt;offset&gt;
  * and &lt;calibration&gt; elements.
- * 
+ *
  * @author Zverik
  * @license WTFPL
@@ -27,5 +30,5 @@
     private List<ImageryOffsetBase> offsets;
     private InputSource source;
-    
+
     /**
      * Initializes the parser. This constructor creates an input source on the input
@@ -34,5 +37,5 @@
      * @throws IOException Thrown when something's wrong with the stream.
      */
-    public IODBReader( InputStream source ) throws IOException {
+    public IODBReader(InputStream source) throws IOException {
         this.source = new InputSource(UTFInputStreamReader.create(source, "UTF-8"));
         this.offsets = new ArrayList<>();
@@ -51,5 +54,5 @@
             factory.newSAXParser().parse(source, parser);
             return offsets;
-        } catch( ParserConfigurationException e ) {
+        } catch (ParserConfigurationException e) {
             throw new SAXException(e);
         }
@@ -93,6 +96,6 @@
         @Override
         public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
-            if( !parsingOffset ) {
-                if( qName.equals("offset") || qName.equals("calibration") ) {
+            if (!parsingOffset) {
+                if (qName.equals("offset") || qName.equals("calibration")) {
                     parsingOffset = true;
                     parsingDeprecate = false;
@@ -100,20 +103,20 @@
                     fields.position = parseLatLon(attributes);
                     fields.id = Integer.parseInt(attributes.getValue("id"));
-                    if( attributes.getValue("flagged") != null && attributes.getValue("flagged").equals("yes") )
+                    if (attributes.getValue("flagged") != null && attributes.getValue("flagged").equals("yes"))
                         fields.flagged = true;
                 }
             } else {
-                if( qName.equals("node") ) {
+                if (qName.equals("node")) {
                     fields.geometry.add(parseLatLon(attributes));
-                } else if( qName.equals("imagery-position") ) {
+                } else if (qName.equals("imagery-position")) {
                     fields.imageryPos = parseLatLon(attributes);
-                } else if( qName.equals("imagery") ) {
+                } else if (qName.equals("imagery")) {
                     String minZoom = attributes.getValue("minzoom");
                     String maxZoom = attributes.getValue("maxzoom");
-                    if( minZoom != null )
+                    if (minZoom != null)
                         fields.minZoom = Integer.parseInt(minZoom);
-                    if( maxZoom != null )
+                    if (maxZoom != null)
                         fields.maxZoom = Integer.parseInt(maxZoom);
-                } else if( qName.equals("deprecated") ) {
+                } else if (qName.equals("deprecated")) {
                     parsingDeprecate = true;
                 }
@@ -121,8 +124,8 @@
             accumulator.setLength(0);
         }
-        
+
         @Override
         public void characters(char[] ch, int start, int length) throws SAXException {
-            if( parsingOffset )
+            if (parsingOffset)
                 accumulator.append(ch, start, length);
         }
@@ -130,17 +133,17 @@
         @Override
         public void endElement(String uri, String localName, String qName) throws SAXException {
-            if( parsingOffset ) {
-                if( qName.equals("author") ) {
-                    if( !parsingDeprecate )
+            if (parsingOffset) {
+                if (qName.equals("author")) {
+                    if (!parsingDeprecate)
                         fields.author = accumulator.toString();
                     else
                         fields.abandonAuthor = accumulator.toString();
-                } else if( qName.equals("description") ) {
+                } else if (qName.equals("description")) {
                     fields.description = accumulator.toString();
-                } else if( qName.equals("reason") && parsingDeprecate ) {
+                } else if (qName.equals("reason") && parsingDeprecate) {
                     fields.abandonReason = accumulator.toString();
-                } else if( qName.equals("date") ) {
+                } else if (qName.equals("date")) {
                     try {
-                        if( !parsingDeprecate )
+                        if (!parsingDeprecate)
                             fields.date = dateParser.parse(accumulator.toString());
                         else
@@ -149,13 +152,13 @@
                         throw new SAXException(ex);
                     }
-                } else if( qName.equals("deprecated") ) {
+                } else if (qName.equals("deprecated")) {
                     parsingDeprecate = false;
-                } else if( qName.equals("imagery") ) {
+                } else if (qName.equals("imagery")) {
                     fields.imagery = accumulator.toString();
-                } else if( qName.equals("offset") || qName.equals("calibration") ) {
+                } else if (qName.equals("offset") || qName.equals("calibration")) {
                     // store offset
                     try {
                         offsets.add(fields.constructObject());
-                    } catch( IllegalArgumentException ex ) {
+                    } catch (IllegalArgumentException ex) {
                         // On one hand, we don't care, but this situation is one
                         // of those "it can never happen" cases.
@@ -167,5 +170,5 @@
         }
     }
-    
+
     /**
      * An accumulator for parsed fields. When there's enough data, it can construct
@@ -191,8 +194,8 @@
          * A constructor just calls {@link #clear()}.
          */
-        public IOFields() {
+        IOFields() {
             clear();
         }
-        
+
         /**
          * Clear all fields to <tt>null</tt> and <tt>-1</tt>.
@@ -220,23 +223,23 @@
          */
         public ImageryOffsetBase constructObject() {
-            if( author == null || description == null || position == null || date == null )
+            if (author == null || description == null || position == null || date == null)
                 throw new IllegalArgumentException("Not enought arguments to build an object");
             ImageryOffsetBase result;
-            if( geometry.isEmpty() ) {
-                if( imagery == null || imageryPos == null )
+            if (geometry.isEmpty()) {
+                if (imagery == null || imageryPos == null)
                     throw new IllegalArgumentException("Both imagery and imageryPos should be specified for the offset");
                 result = new ImageryOffset(imagery, imageryPos);
-                if( minZoom >= 0 )
-                    ((ImageryOffset)result).setMinZoom(minZoom);
-                if( maxZoom >= 0 )
-                    ((ImageryOffset)result).setMaxZoom(maxZoom);
+                if (minZoom >= 0)
+                    ((ImageryOffset) result).setMinZoom(minZoom);
+                if (maxZoom >= 0)
+                    ((ImageryOffset) result).setMaxZoom(maxZoom);
             } else {
                 result = new CalibrationObject(geometry.toArray(new LatLon[0]));
             }
-            if( id >= 0 )
+            if (id >= 0)
                 result.setId(id);
             result.setBasicInfo(position, author, description, date);
             result.setDeprecated(abandonDate, abandonAuthor, abandonReason);
-            if( flagged )
+            if (flagged)
                 result.setFlagged(flagged);
             return result;
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryIdGenerator.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryIdGenerator.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryIdGenerator.java	(revision 32528)
@@ -1,5 +1,11 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
 
@@ -10,23 +16,27 @@
  * @license WTFPL
  */
-public class ImageryIdGenerator {
+public final class ImageryIdGenerator {
 
-    public static String getImageryID( String url, ImageryType type ) {
-        if( url == null )
+    private ImageryIdGenerator() {
+        // Hide default constructor for utilities classes
+    }
+
+    public static String getImageryID(String url, ImageryType type) {
+        if (url == null)
             return null;
 
         // predefined layers
-        if( ImageryType.BING.equals(type) || url.contains("tiles.virtualearth.net") )
+        if (ImageryType.BING.equals(type) || url.contains("tiles.virtualearth.net"))
             return "bing";
 
-        if( ImageryType.SCANEX.equals(type) && url.toLowerCase().equals("irs") )
+        if (ImageryType.SCANEX.equals(type) && url.toLowerCase().equals("irs"))
             return "scanex_irs";
 
-        if( ImageryType.TMS.equals(type) && url.toLowerCase().matches(".+tiles\\.mapbox\\.com/v[3-9]/openstreetmap\\.map.*") )
+        if (ImageryType.TMS.equals(type) && url.toLowerCase().matches(".+tiles\\.mapbox\\.com/v[3-9]/openstreetmap\\.map.*"))
             return "mapbox";
 
         boolean isWMS = ImageryType.WMS.equals(type);
 
-//        System.out.println(url);
+        //        System.out.println(url);
 
         // Remove protocol
@@ -37,5 +47,5 @@
         i = url.indexOf('?');
         String query = "";
-        if( i > 0 ) {
+        if (i > 0) {
             query = url.substring(i);
             url = url.substring(0, i);
@@ -44,16 +54,16 @@
         // Parse query parameters into a sorted map
         final Set<String> removeWMSParams = new TreeSet<>(Arrays.asList(new String[] {
-                    "srs", "width", "height", "bbox", "service", "request", "version", "format", "styles", "transparent"
-                }));
+                "srs", "width", "height", "bbox", "service", "request", "version", "format", "styles", "transparent"
+        }));
         Map<String, String> qparams = new TreeMap<>();
         String[] qparamsStr = query.length() > 1 ? query.substring(1).split("&") : new String[0];
-        for( String param : qparamsStr ) {
+        for (String param : qparamsStr) {
             String[] kv = param.split("=");
             kv[0] = kv[0].toLowerCase();
             // WMS: if this is WMS, remove all parameters except map and layers
-            if( isWMS && removeWMSParams.contains(kv[0]) )
+            if (isWMS && removeWMSParams.contains(kv[0]))
                 continue;
             // TMS: skip parameters with variable values
-            if( kv.length > 1 && kv[1].indexOf('{') >= 0 && kv[1].indexOf('}') > 0 )
+            if (kv.length > 1 && kv[1].indexOf('{') >= 0 && kv[1].indexOf('}') > 0)
                 continue;
             qparams.put(kv[0].toLowerCase(), kv.length > 1 ? kv[1] : null);
@@ -62,8 +72,8 @@
         // Reconstruct query parameters
         StringBuilder sb = new StringBuilder();
-        for( String qk : qparams.keySet() ) {
-            if( sb.length() > 0 )
+        for (String qk : qparams.keySet()) {
+            if (sb.length() > 0)
                 sb.append('&');
-            else if( query.length() > 0 )
+            else if (query.length() > 0)
                 sb.append('?');
             sb.append(qk).append('=').append(qparams.get(qk));
@@ -75,10 +85,10 @@
         // TMS: remove variable parts
         url = url.replaceAll("\\{[^}]+\\}", "");
-        while( url.contains("..") )
+        while (url.contains("..")) {
             url = url.replace("..", ".");
-        if( url.startsWith(".") )
+        }
+        if (url.startsWith("."))
             url = url.substring(1);
 
-//        System.out.println("-> " + url + query);
         return url + query;
     }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffset.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffset.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffset.java	(revision 32528)
@@ -1,5 +1,7 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
 import java.util.Map;
+
 import org.openstreetmap.josm.data.coor.CoordinateFormat;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -9,5 +11,5 @@
  * of the position point on the imagery layer. The offset is then calculated
  * as a difference between the two.
- * 
+ *
  * @author Zverik
  * @license WTFPL
@@ -18,5 +20,5 @@
     private int minZoom, maxZoom;
 
-    public ImageryOffset( String imagery, LatLon imageryPos ) {
+    public ImageryOffset(String imagery, LatLon imageryPos) {
         this.imageryPos = imageryPos;
         this.imagery = imagery;
@@ -24,5 +26,5 @@
         this.maxZoom = 30;
     }
-    
+
     public void setMaxZoom(int maxZoom) {
         this.maxZoom = maxZoom;
@@ -32,5 +34,5 @@
         this.minZoom = minZoom;
     }
-    
+
     public LatLon getImageryPos() {
         return imageryPos;
@@ -50,12 +52,12 @@
 
     @Override
-    public void putServerParams( Map<String, String> map ) {
+    public void putServerParams(Map<String, String> map) {
         super.putServerParams(map);
         map.put("imagery", imagery);
         map.put("imlat", imageryPos.latToString(CoordinateFormat.DECIMAL_DEGREES));
         map.put("imlon", imageryPos.lonToString(CoordinateFormat.DECIMAL_DEGREES));
-        if( minZoom > 0 )
+        if (minZoom > 0)
             map.put("minzoom", String.valueOf(minZoom));
-        if( maxZoom < 30 )
+        if (maxZoom < 30)
             map.put("maxzoom", String.valueOf(maxZoom));
     }
@@ -63,5 +65,6 @@
     @Override
     public String toString() {
-        return "ImageryOffset{" + "imageryPos=" + imageryPos + ", imagery=" + imagery + "position=" + position + ", date=" + date + ", author=" + author + ", description=" + description + ", abandonDate=" + abandonDate + '}';
+        return "ImageryOffset{" + "imageryPos=" + imageryPos + ", imagery=" + imagery + "position=" + position + ", date=" + date +
+                ", author=" + author + ", description=" + description + ", abandonDate=" + abandonDate + '}';
     }
 }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetBase.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetBase.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetBase.java	(revision 32528)
@@ -1,6 +1,8 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
 import java.util.Date;
 import java.util.Map;
+
 import org.openstreetmap.josm.data.coor.CoordinateFormat;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -10,5 +12,5 @@
  * and {@link CalibrationObject} classes and contains common fields
  * like position, author and description.
- * 
+ *
  * @author Zverik
  * @license WTFPL
@@ -24,10 +26,10 @@
     protected String abandonReason;
     protected boolean flagged;
-    
+
     /**
      * Initialize object with the basic information. It's offset location, author, date
      * and description.
      */
-    public void setBasicInfo( LatLon position, String author, String description, Date date ) {
+    public void setBasicInfo(LatLon position, String author, String description, Date date) {
         this.position = position;
         this.author = author;
@@ -38,5 +40,5 @@
     }
 
-    public void setId( long id ) {
+    public void setId(long id) {
         this.offsetId = id;
     }
@@ -60,5 +62,5 @@
     }
 
-    public void setFlagged( boolean flagged ) {
+    public void setFlagged(boolean flagged) {
         this.flagged = flagged;
     }
@@ -75,5 +77,5 @@
         return abandonReason;
     }
-    
+
     /**
      * Check that {@link #getAbandonDate()} is not null. Note that
@@ -96,5 +98,5 @@
     }
 
-    public void setDescription( String description ) {
+    public void setDescription(String description) {
         this.description = description;
     }
@@ -103,6 +105,6 @@
         return position;
     }
-    
-    public void putServerParams( Map<String, String> map ) {
+
+    public void putServerParams(Map<String, String> map) {
         map.put("lat", position.latToString(CoordinateFormat.DECIMAL_DEGREES));
         map.put("lon", position.lonToString(CoordinateFormat.DECIMAL_DEGREES));
@@ -113,5 +115,6 @@
     @Override
     public String toString() {
-        return "ImageryOffsetBase{" + "position=" + position + ", date=" + date + ", author=" + author + ", description=" + description + ", abandonDate=" + abandonDate + '}';
+        return "ImageryOffsetBase{" + "position=" + position + ", date=" + date + ", author=" + author +
+                ", description=" + description + ", abandonDate=" + abandonDate + '}';
     }
 }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetPlugin.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetPlugin.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetPlugin.java	(revision 32528)
@@ -1,2 +1,3 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
@@ -31,5 +32,5 @@
      * or completely unsuitable for imagery offset actions.
      */
-    public ImageryOffsetPlugin( PluginInformation info ) {
+    public ImageryOffsetPlugin(PluginInformation info) {
         super(info);
 
@@ -42,18 +43,18 @@
         JMenu offsetMenu = version < 5803
                 ? Main.main.menu.addMenu("Offset", tr("Offset"), KeyEvent.VK_O, 6, "help")
-                : Main.main.menu.imageryMenu;
-        offsetMenu.add(getAction);
-        offsetMenu.add(storeAction);
+                        : Main.main.menu.imageryMenu;
+                offsetMenu.add(getAction);
+                offsetMenu.add(storeAction);
 
-        // an ugly hack to add this plugin to the toolbar
-        if( Main.pref.getBoolean("iodb.modify.toolbar", true) ) {
-            Collection<String> toolbar = new LinkedList<>(ToolbarPreferences.getToolString());
-            if( !toolbar.contains("getoffset") ) {
-                toolbar.add("getoffset");
-                Main.pref.putCollection("toolbar", toolbar);
-                Main.toolbar.refreshToolbarControl();
-            }
-            Main.pref.put("iodb.modify.toolbar", false);
-        }
+                // an ugly hack to add this plugin to the toolbar
+                if (Main.pref.getBoolean("iodb.modify.toolbar", true)) {
+                    Collection<String> toolbar = new LinkedList<>(ToolbarPreferences.getToolString());
+                    if (!toolbar.contains("getoffset")) {
+                        toolbar.add("getoffset");
+                        Main.pref.putCollection("toolbar", toolbar);
+                        Main.toolbar.refreshToolbarControl();
+                    }
+                    Main.pref.put("iodb.modify.toolbar", false);
+                }
     }
 }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetTools.java	(revision 32528)
@@ -1,6 +1,10 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
+import static org.openstreetmap.josm.tools.I18n.tr;
+
 import java.text.MessageFormat;
-import java.util.*;
+import java.util.List;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.EastNorth;
@@ -9,18 +13,21 @@
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.gui.layer.ImageryLayer;
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 /**
  * Some common static methods for querying and processing imagery layers.
- * 
+ *
  * @author Zverik
  * @license WTFPL
  */
-public class ImageryOffsetTools {
+public final class ImageryOffsetTools {
     /**
      * A title for all dialogs created in this plugin.
      */
     public static final String DIALOG_TITLE = tr("Imagery Offset Database");
-    
+
+    private ImageryOffsetTools() {
+        // Hide default constructor for utilities classes
+    }
+
     /**
      * Returns the topmost visible imagery layer.
@@ -28,10 +35,10 @@
      */
     public static ImageryLayer getTopImageryLayer() {
-        if( Main.map == null || Main.map.mapView == null )
+        if (Main.map == null || Main.map.mapView == null)
             return null;
         List<ImageryLayer> layers = Main.getLayerManager().getLayersOfType(ImageryLayer.class);
-        for( ImageryLayer layer : layers ) {
+        for (ImageryLayer layer : layers) {
             String url = layer.getInfo().getUrl();
-            if( layer.isVisible() && url != null && !url.contains("gps-") ) {
+            if (layer.isVisible() && url != null && !url.contains("gps-")) {
                 return layer;
             }
@@ -39,5 +46,5 @@
         return null;
     }
-    
+
     /**
      * Calculates the center of a visible map area.
@@ -49,5 +56,5 @@
                 ? new LatLon(0, 0) : proj.eastNorth2latlon(Main.map.mapView.getCenter());
     }
-    
+
     /**
      * Calculates an imagery layer offset.
@@ -57,5 +64,5 @@
      * @see #applyLayerOffset
      */
-    public static LatLon getLayerOffset( ImageryLayer layer, LatLon center ) {
+    public static LatLon getLayerOffset(ImageryLayer layer, LatLon center) {
         Projection proj = Main.getProjection();
         EastNorth offsetCenter = Main.map.mapView.getCenter();
@@ -64,5 +71,5 @@
         return offsetLL;
     }
-    
+
     /**
      * Applies the offset to the imagery layer.
@@ -70,5 +77,5 @@
      * @see #getLayerOffset
      */
-    public static void applyLayerOffset( ImageryLayer layer, ImageryOffset offset ) {
+    public static void applyLayerOffset(ImageryLayer layer, ImageryOffset offset) {
         double[] dxy = calculateOffset(offset);
         layer.setOffset(dxy[0], dxy[1]);
@@ -80,11 +87,11 @@
      * @see #applyLayerOffset
      */
-    public static double[] calculateOffset( ImageryOffset offset ) {
+    public static double[] calculateOffset(ImageryOffset offset) {
         Projection proj = Main.getProjection();
         EastNorth center = proj.latlon2eastNorth(offset.getPosition());
         EastNorth offsetPos = proj.latlon2eastNorth(offset.getImageryPos());
-        return new double[] { center.getX() - offsetPos.getX(), center.getY() - offsetPos.getY() };
+        return new double[] {center.getX() - offsetPos.getX(), center.getY() - offsetPos.getY()};
     }
-    
+
     /**
      * Generate unique imagery identifier based on its type and URL.
@@ -92,7 +99,7 @@
      * @return imagery id.
      */
-    public static String getImageryID( ImageryLayer layer ) {
+    public static String getImageryID(ImageryLayer layer) {
         return layer == null ? null :
-                ImageryIdGenerator.getImageryID(layer.getInfo().getUrl(), layer.getInfo().getImageryType());
+            ImageryIdGenerator.getImageryID(layer.getInfo().getUrl(), layer.getInfo().getImageryType());
     }
 
@@ -134,12 +141,14 @@
      * Converts distance in meters to a human-readable string.
      */
-    public static String formatDistance( double d ) {
-        if( d < 0.0095 ) return formatDistance(d * 1000, tr("mm"), true);
-        if( d < 0.095 )  return formatDistance(d * 100,  tr("cm"), true );
-        if( d < 0.95 )   return formatDistance(d * 100,  tr("cm"), false);
-        if( d < 9.5 )    return formatDistance(d,        tr("m"),  true );
-        if( d < 950 )    return formatDistance(d,        tr("m"),  false );
-        if( d < 9500 )   return formatDistance(d / 1000, tr("km"), true);
-        if( d < 1e6 )    return formatDistance(d / 1000, tr("km"), false);
+    public static String formatDistance(double d) {
+        // CHECKSTYLE.OFF: SingleSpaceSeparator
+        if (d < 0.0095) return formatDistance(d * 1000, tr("mm"), true);
+        if (d < 0.095)  return formatDistance(d * 100,  tr("cm"), true);
+        if (d < 0.95)   return formatDistance(d * 100,  tr("cm"), false);
+        if (d < 9.5)    return formatDistance(d,        tr("m"),  true);
+        if (d < 950)    return formatDistance(d,        tr("m"),  false);
+        if (d < 9500)   return formatDistance(d / 1000, tr("km"), true);
+        if (d < 1e6)    return formatDistance(d / 1000, tr("km"), false);
+        // CHECKSTYLE.ON: SingleSpaceSeparator
         return "\u221E";
     }
@@ -152,5 +161,5 @@
      * @return A formatted string.
      */
-    private static String formatDistance( double d, String si, boolean floating ) {
+    private static String formatDistance(double d, String si, boolean floating) {
         return MessageFormat.format(floating ? "{0,number,0.0} {1}" : "{0,number,0} {1}", d, si);
     }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetWatcher.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetWatcher.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetWatcher.java	(revision 32528)
@@ -1,2 +1,3 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
@@ -32,5 +33,5 @@
  * @license WTFPL
  */
-public class ImageryOffsetWatcher implements ZoomChangeListener, LayerChangeListener, ActiveLayerChangeListener, Destroyable {
+public final class ImageryOffsetWatcher implements ZoomChangeListener, LayerChangeListener, ActiveLayerChangeListener, Destroyable {
     private static final double THRESHOLD = 1e-8;
     private static ImageryOffsetWatcher instance;
@@ -71,5 +72,5 @@
      */
     public static ImageryOffsetWatcher getInstance() {
-        if( instance == null ) {
+        if (instance == null) {
             instance = new ImageryOffsetWatcher();
         }
@@ -80,5 +81,5 @@
      * Register an offset state listener.
      */
-    public void register( OffsetStateListener listener ) {
+    public void register(OffsetStateListener listener) {
         listeners.add(listener);
         listener.offsetStateChanged(offsetGood);
@@ -88,5 +89,5 @@
      * Unregister an offset state listener.
      */
-    public void unregister( OffsetStateListener listener ) {
+    public void unregister(OffsetStateListener listener) {
         listeners.remove(listener);
     }
@@ -95,8 +96,9 @@
      * Change stored offset state, notify listeners if needed.
      */
-    private void setOffsetGood( boolean good ) {
-        if( good != offsetGood ) {
-            for( OffsetStateListener listener : listeners )
+    private void setOffsetGood(boolean good) {
+        if (good != offsetGood) {
+            for (OffsetStateListener listener : listeners) {
                 listener.offsetStateChanged(good);
+            }
         }
         offsetGood = good;
@@ -107,10 +109,10 @@
      */
     private synchronized void checkOffset() {
-        if( maxDistance <= 0 ) {
+        if (maxDistance <= 0) {
             setOffsetGood(true);
             return;
         }
         ImageryLayer layer = ImageryOffsetTools.getTopImageryLayer();
-        if( layer == null ) {
+        if (layer == null) {
             setOffsetGood(true);
             return;
@@ -119,5 +121,5 @@
         Integer hash = layer.hashCode();
         ImageryLayerData data = layers.get(hash);
-        if( data == null ) {
+        if (data == null) {
             // create entry for this layer and mark as needing alignment
             data = new ImageryLayerData();
@@ -125,5 +127,5 @@
             data.lastDy = layer.getDy();
             boolean r = false;
-            if( Math.abs(data.lastDx) + Math.abs(data.lastDy) > THRESHOLD ) {
+            if (Math.abs(data.lastDx) + Math.abs(data.lastDy) > THRESHOLD) {
                 data.lastChecked = center;
                 r = true;
@@ -133,5 +135,5 @@
         } else {
             // now, we have a returning layer.
-            if( Math.abs(data.lastDx - layer.getDx()) + Math.abs(data.lastDy - layer.getDy()) > THRESHOLD ) {
+            if (Math.abs(data.lastDx - layer.getDx()) + Math.abs(data.lastDy - layer.getDy()) > THRESHOLD) {
                 // offset has changed, record the current position
                 data.lastDx = layer.getDx();
@@ -153,9 +155,9 @@
     public void markGood() {
         ImageryLayer layer = ImageryOffsetTools.getTopImageryLayer();
-        if( layer != null ) {
+        if (layer != null) {
             LatLon center = ImageryOffsetTools.getMapCenter();
             Integer hash = layer.hashCode();
             ImageryLayerData data = layers.get(hash);
-            if( data == null ) {
+            if (data == null) {
                 // create entry for this layer and mark as good
                 data = new ImageryLayerData();
@@ -216,12 +218,12 @@
      * projections: nobody uses them anyway.
      */
-    private void storeLayerOffset( ImageryLayer layer ) {
+    private void storeLayerOffset(ImageryLayer layer) {
         String id = ImageryOffsetTools.getImageryID(layer);
-        if( !Main.pref.getBoolean("iodb.remember.offsets", true) || id == null )
+        if (!Main.pref.getBoolean("iodb.remember.offsets", true) || id == null)
             return;
         Collection<String> offsets = new LinkedList<>(Main.pref.getCollection("iodb.stored.offsets"));
-        for( Iterator<String> iter = offsets.iterator(); iter.hasNext(); ) {
+        for (Iterator<String> iter = offsets.iterator(); iter.hasNext();) {
             String[] offset = iter.next().split(":");
-            if( offset.length == 5 && offset[0].equals(id) )
+            if (offset.length == 5 && offset[0].equals(id))
                 iter.remove();
         }
@@ -234,21 +236,22 @@
      * Loads the current imagery layer offset from preferences.
      */
-    private void loadLayerOffset( ImageryLayer layer ) {
+    private void loadLayerOffset(ImageryLayer layer) {
         String id = ImageryOffsetTools.getImageryID(layer);
-        if( !Main.pref.getBoolean("iodb.remember.offsets", true) || id == null )
+        if (!Main.pref.getBoolean("iodb.remember.offsets", true) || id == null)
             return;
         Collection<String> offsets = Main.pref.getCollection("iodb.stored.offsets");
-        for( String offset : offsets ) {
+        for (String offset : offsets) {
             String[] parts = offset.split(":");
-            if( parts.length == 5 && parts[0].equals(id) ) {
+            if (parts.length == 5 && parts[0].equals(id)) {
                 double[] dparts = new double[4];
                 try {
-                    for( int i = 0; i < 4; i++ )
+                    for (int i = 0; i < 4; i++) {
                         dparts[i] = Double.parseDouble(parts[i+1]);
-                } catch( Exception e ) {
+                    }
+                } catch (Exception e) {
                     continue;
                 }
                 LatLon lastPos = new LatLon(dparts[0], dparts[1]);
-                if( lastPos.greatCircleDistance(ImageryOffsetTools.getMapCenter()) < Math.max(maxDistance, 3.0) * 1000 ) {
+                if (lastPos.greatCircleDistance(ImageryOffsetTools.getMapCenter()) < Math.max(maxDistance, 3.0) * 1000) {
                     // apply offset
                     layer.setOffset(dparts[2], dparts[3]);
@@ -277,5 +280,5 @@
      */
     public interface OffsetStateListener {
-        void offsetStateChanged( boolean isOffsetGood );
+        void offsetStateChanged(boolean isOffsetGood);
     }
 }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java	(revision 32528)
@@ -1,2 +1,3 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
@@ -72,5 +73,5 @@
      * @param offsets The list of offset to choose from.
      */
-    public OffsetDialog( List<ImageryOffsetBase> offsets ) {
+    public OffsetDialog(List<ImageryOffsetBase> offsets) {
         super(JOptionPane.getFrameForComponent(Main.parent), ImageryOffsetTools.DIALOG_TITLE,
                 MODAL ? ModalityType.DOCUMENT_MODAL : ModalityType.MODELESS);
@@ -94,5 +95,5 @@
         calibrationBox.addActionListener(new ActionListener() {
             @Override
-            public void actionPerformed( ActionEvent e ) {
+            public void actionPerformed(ActionEvent e) {
                 Main.pref.put(PREF_CALIBRATION, calibrationBox.isSelected());
                 updateButtonPanel();
@@ -103,5 +104,5 @@
         deprecatedBox.addActionListener(new ActionListener() {
             @Override
-            public void actionPerformed( ActionEvent e ) {
+            public void actionPerformed(ActionEvent e) {
                 Main.pref.put(PREF_DEPRECATED, deprecatedBox.isSelected());
                 updateButtonPanel();
@@ -135,14 +136,14 @@
     private void updateButtonPanel() {
         List<ImageryOffsetBase> filteredOffsets = filterOffsets();
-        if( buttonPanel == null )
+        if (buttonPanel == null)
             buttonPanel = new JPanel();
         buttonPanel.removeAll();
         buttonPanel.setLayout(new GridLayout(filteredOffsets.size(), 1, 0, 5));
-        for( ImageryOffsetBase offset : filteredOffsets ) {
+        for (ImageryOffsetBase offset : filteredOffsets) {
             OffsetDialogButton button = new OffsetDialogButton(offset);
             button.addActionListener(this);
             JPopupMenu popupMenu = new JPopupMenu();
             popupMenu.add(new OffsetInfoAction(offset));
-            if( !offset.isDeprecated() ) {
+            if (!offset.isDeprecated()) {
                 DeprecateOffsetAction action = new DeprecateOffsetAction(offset);
                 action.setListener(new DeprecateOffsetListener(offset));
@@ -164,11 +165,11 @@
         boolean showDeprecated = Main.pref.getBoolean(PREF_DEPRECATED, false);
         List<ImageryOffsetBase> filteredOffsets = new ArrayList<>();
-        for( ImageryOffsetBase offset : offsets ) {
-            if( offset.isDeprecated() && !showDeprecated )
+        for (ImageryOffsetBase offset : offsets) {
+            if (offset.isDeprecated() && !showDeprecated)
                 continue;
-            if( offset instanceof CalibrationObject && !showCalibration )
+            if (offset instanceof CalibrationObject && !showCalibration)
                 continue;
             filteredOffsets.add(offset);
-            if( filteredOffsets.size() >= MAX_OFFSETS )
+            if (filteredOffsets.size() >= MAX_OFFSETS)
                 break;
         }
@@ -182,7 +183,7 @@
     @Override
     public void zoomChanged() {
-        for( Component c : buttonPanel.getComponents() ) {
-            if( c instanceof OffsetDialogButton ) {
-                ((OffsetDialogButton)c).updateLocation();
+        for (Component c : buttonPanel.getComponents()) {
+            if (c instanceof OffsetDialogButton) {
+                ((OffsetDialogButton) c).updateLocation();
             }
         }
@@ -194,12 +195,12 @@
      */
     @Override
-    public void paint( Graphics2D g, MapView mv, Bounds bbox ) {
-        if( offsets == null )
+    public void paint(Graphics2D g, MapView mv, Bounds bbox) {
+        if (offsets == null)
             return;
 
-        Graphics2D g2 = (Graphics2D)g.create();
+        Graphics2D g2 = (Graphics2D) g.create();
         g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         g2.setStroke(new BasicStroke(2));
-        for( ImageryOffsetBase offset : filterOffsets() ) {
+        for (ImageryOffsetBase offset : filterOffsets()) {
             Point p = mv.getPoint(offset.getPosition());
             g2.setColor(Color.BLACK);
@@ -221,5 +222,5 @@
         prepareDialog();
         MapView.addZoomChangeListener(this);
-        if( !MODAL ) {
+        if (!MODAL) {
             Main.map.mapView.addTemporaryLayer(this);
             Main.map.mapView.repaint();
@@ -237,7 +238,7 @@
      */
     @Override
-    public void actionPerformed( ActionEvent e ) {
-        if( e.getSource() instanceof OffsetDialogButton ) {
-            selectedOffset = ((OffsetDialogButton)e.getSource()).getOffset();
+    public void actionPerformed(ActionEvent e) {
+        if (e.getSource() instanceof OffsetDialogButton) {
+            selectedOffset = ((OffsetDialogButton) e.getSource()).getOffset();
         } else
             selectedOffset = null;
@@ -245,21 +246,20 @@
                 || selectedOffset instanceof CalibrationObject
                 || Main.pref.getBoolean("iodb.close.on.select", true);
-        if( closeDialog ) {
+        if (closeDialog) {
             MapView.removeZoomChangeListener(this);
             setVisible(false);
         }
-        if( !MODAL ) {
-            if( closeDialog ) {
+        if (!MODAL) {
+            if (closeDialog) {
                 Main.map.mapView.removeTemporaryLayer(this);
                 Main.map.mapView.repaint();
             }
-            if( selectedOffset != null ) {
+            if (selectedOffset != null) {
                 applyOffset();
-                if( !closeDialog )
+                if (!closeDialog)
                     updateButtonPanel();
             }
         }
     }
-
 
     /**
@@ -269,10 +269,10 @@
      */
     public void applyOffset() {
-        if( selectedOffset instanceof ImageryOffset ) {
+        if (selectedOffset instanceof ImageryOffset) {
             ImageryLayer layer = ImageryOffsetTools.getTopImageryLayer();
-            ImageryOffsetTools.applyLayerOffset(layer, (ImageryOffset)selectedOffset);
+            ImageryOffsetTools.applyLayerOffset(layer, (ImageryOffset) selectedOffset);
             ImageryOffsetWatcher.getInstance().markGood();
             Main.map.repaint();
-            if( !Main.pref.getBoolean("iodb.offset.message", false) ) {
+            if (!Main.pref.getBoolean("iodb.offset.message", false)) {
                 JOptionPane.showMessageDialog(Main.parent,
                         tr("The topmost imagery layer has been shifted to presumably match\n"
@@ -282,9 +282,9 @@
                 Main.pref.put("iodb.offset.message", true);
             }
-        } else if( selectedOffset instanceof CalibrationObject ) {
-            CalibrationLayer clayer = new CalibrationLayer((CalibrationObject)selectedOffset);
+        } else if (selectedOffset instanceof CalibrationObject) {
+            CalibrationLayer clayer = new CalibrationLayer((CalibrationObject) selectedOffset);
             Main.getLayerManager().addLayer(clayer);
             clayer.panToCenter();
-            if( !Main.pref.getBoolean("iodb.calibration.message", false) ) {
+            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"
@@ -305,5 +305,5 @@
          * Initialize the listener with an offset.
          */
-        public DeprecateOffsetListener( ImageryOffsetBase offset ) {
+        DeprecateOffsetListener(ImageryOffsetBase offset) {
             this.offset = offset;
         }
@@ -324,5 +324,5 @@
     class HelpAction extends AbstractAction {
 
-        public HelpAction() {
+        HelpAction() {
             super(tr("Help"));
             putValue(SMALL_ICON, ImageProvider.get("help"));
@@ -330,5 +330,5 @@
 
         @Override
-        public void actionPerformed( ActionEvent e ) {
+        public void actionPerformed(ActionEvent e) {
             String base = Main.pref.get("url.openstreetmap-wiki", "http://wiki.openstreetmap.org/wiki/");
             String lang = LanguageInfo.getWikiLanguagePrefix();
@@ -341,5 +341,5 @@
                     lang = "";
                 }
-            } catch( IOException ex ) {
+            } catch (IOException ex) {
                 lang = "";
             }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java	(revision 32528)
@@ -1,6 +1,27 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
-import java.awt.*;
-import javax.swing.*;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.AlphaComposite;
+import java.awt.BasicStroke;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.RenderingHints;
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.EastNorth;
@@ -9,15 +30,14 @@
 import org.openstreetmap.josm.gui.layer.ImageryLayer;
 import org.openstreetmap.josm.tools.ImageProvider;
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 /**
  * A button which shows offset information. Must be spectacular, since it's the only
  * non-JOptionPane GUI in the plugin.
- * 
+ *
  * @author Zverik
  * @license WTFPL
  */
 public class OffsetDialogButton extends JButton {
-    
+
     private ImageryOffsetBase offset;
 
@@ -29,5 +49,5 @@
      * @param offset An offset to display on the button.
      */
-    public OffsetDialogButton( ImageryOffsetBase offset ) {
+    public OffsetDialogButton(ImageryOffsetBase offset) {
         this.offset = offset;
         layoutComponents();
@@ -57,54 +77,54 @@
         String authorAndDate = offset.isDeprecated()
                 ? tr("Deprecated by {0} on {1}", offset.getAbandonAuthor(),
-                OffsetInfoAction.DATE_FORMAT.format(offset.getAbandonDate()))
-                : tr("Created by {0} on {1}", offset.getAuthor(),
-                OffsetInfoAction.DATE_FORMAT.format(offset.getDate()));
-        JLabel authorAndDateLabel = new JLabel(authorAndDate);
-        Font authorFont = new Font(authorAndDateLabel.getFont().getName(), Font.ITALIC, authorAndDateLabel.getFont().getSize());
-        authorAndDateLabel.setFont(authorFont);
-
-        directionArrow = new DirectionIcon(offset.getPosition());
-        distanceLabel = new JLabel("", directionArrow, SwingConstants.RIGHT);
-        distanceLabel.setHorizontalTextPosition(SwingConstants.LEFT);
-        Font distanceFont = new Font(distanceLabel.getFont().getName(), Font.PLAIN, distanceLabel.getFont().getSize());
-        distanceLabel.setFont(distanceFont);
-        updateLocation();
-
-        String description = offset.isDeprecated() ? offset.getAbandonReason() : offset.getDescription();
-        description = description.replace("<", "&lt;").replace(">", "&gt;");
-        JLabel descriptionLabel = new JLabel("<html><div style=\"width: 300px;\">"+description+"</div></html>");
-        Font descriptionFont = new Font(descriptionLabel.getFont().getName(), Font.BOLD, descriptionLabel.getFont().getSize());
-        descriptionLabel.setFont(descriptionFont);
-
-        OffsetIcon offsetIcon = new OffsetIcon(offset);
-        double offsetDistance = offset instanceof ImageryOffset
-                ? offsetIcon.getDistance() : 0.0;
-//                ? ((ImageryOffset)offset).getImageryPos().greatCircleDistance(offset.getPosition()) : 0.0;
-        JLabel offsetLabel = new JLabel(offsetDistance > 0.2 ? ImageryOffsetTools.formatDistance(offsetDistance) : "",
-                offsetIcon, SwingConstants.CENTER);
-        Font offsetFont = new Font(offsetLabel.getFont().getName(), Font.PLAIN, offsetLabel.getFont().getSize() - 2);
-        offsetLabel.setFont(offsetFont);
-        offsetLabel.setHorizontalTextPosition(SwingConstants.CENTER);
-        offsetLabel.setVerticalTextPosition(SwingConstants.BOTTOM);
-
-        Box topLine = new Box(BoxLayout.X_AXIS);
-        topLine.add(authorAndDateLabel);
-        topLine.add(Box.createHorizontalGlue());
-        topLine.add(Box.createHorizontalStrut(10));
-        topLine.add(distanceLabel);
-
-        JPanel p = new JPanel(new BorderLayout(10, 5));
-        p.setOpaque(false);
-        p.add(topLine, BorderLayout.NORTH);
-        p.add(offsetLabel, BorderLayout.WEST);
-        p.add(descriptionLabel, BorderLayout.CENTER);
-        add(p);
+                        OffsetInfoAction.DATE_FORMAT.format(offset.getAbandonDate()))
+                        : tr("Created by {0} on {1}", offset.getAuthor(),
+                                OffsetInfoAction.DATE_FORMAT.format(offset.getDate()));
+                JLabel authorAndDateLabel = new JLabel(authorAndDate);
+                Font authorFont = new Font(authorAndDateLabel.getFont().getName(), Font.ITALIC, authorAndDateLabel.getFont().getSize());
+                authorAndDateLabel.setFont(authorFont);
+
+                directionArrow = new DirectionIcon(offset.getPosition());
+                distanceLabel = new JLabel("", directionArrow, SwingConstants.RIGHT);
+                distanceLabel.setHorizontalTextPosition(SwingConstants.LEFT);
+                Font distanceFont = new Font(distanceLabel.getFont().getName(), Font.PLAIN, distanceLabel.getFont().getSize());
+                distanceLabel.setFont(distanceFont);
+                updateLocation();
+
+                String description = offset.isDeprecated() ? offset.getAbandonReason() : offset.getDescription();
+                description = description.replace("<", "&lt;").replace(">", "&gt;");
+                JLabel descriptionLabel = new JLabel("<html><div style=\"width: 300px;\">"+description+"</div></html>");
+                Font descriptionFont = new Font(descriptionLabel.getFont().getName(), Font.BOLD, descriptionLabel.getFont().getSize());
+                descriptionLabel.setFont(descriptionFont);
+
+                OffsetIcon offsetIcon = new OffsetIcon(offset);
+                double offsetDistance = offset instanceof ImageryOffset
+                        ? offsetIcon.getDistance() : 0.0;
+                        //                ? ((ImageryOffset)offset).getImageryPos().greatCircleDistance(offset.getPosition()) : 0.0;
+                        JLabel offsetLabel = new JLabel(offsetDistance > 0.2 ? ImageryOffsetTools.formatDistance(offsetDistance) : "",
+                                offsetIcon, SwingConstants.CENTER);
+                        Font offsetFont = new Font(offsetLabel.getFont().getName(), Font.PLAIN, offsetLabel.getFont().getSize() - 2);
+                        offsetLabel.setFont(offsetFont);
+                        offsetLabel.setHorizontalTextPosition(SwingConstants.CENTER);
+                        offsetLabel.setVerticalTextPosition(SwingConstants.BOTTOM);
+
+                        Box topLine = new Box(BoxLayout.X_AXIS);
+                        topLine.add(authorAndDateLabel);
+                        topLine.add(Box.createHorizontalGlue());
+                        topLine.add(Box.createHorizontalStrut(10));
+                        topLine.add(distanceLabel);
+
+                        JPanel p = new JPanel(new BorderLayout(10, 5));
+                        p.setOpaque(false);
+                        p.add(topLine, BorderLayout.NORTH);
+                        p.add(offsetLabel, BorderLayout.WEST);
+                        p.add(descriptionLabel, BorderLayout.CENTER);
+                        add(p);
     }
 
     /**
      * Calculates length and direction for two points in the imagery offset object.
-     * @see #getLengthAndDirection(iodb.ImageryOffset, double, double) 
-     */
-    private double[] getLengthAndDirection( ImageryOffset offset ) {
+     * @see #getLengthAndDirection(iodb.ImageryOffset, double, double)
+     */
+    private double[] getLengthAndDirection(ImageryOffset offset) {
         ImageryLayer layer = ImageryOffsetTools.getTopImageryLayer();
         double[] dxy = layer == null ? new double[] {0.0, 0.0} : new double[] {layer.getDx(), layer.getDy()};
@@ -118,5 +138,5 @@
      * @see #getLengthAndDirection(iodb.ImageryOffset)
      */
-    public static double[] getLengthAndDirection( ImageryOffset offset, double dx, double dy ) {
+    public static double[] getLengthAndDirection(ImageryOffset offset, double dx, double dy) {
         Projection proj = Main.getProjection();
         EastNorth pos = proj.latlon2eastNorth(offset.getPosition());
@@ -124,21 +144,21 @@
         double length = correctedCenterLL.greatCircleDistance(offset.getImageryPos());
         double direction = length < 1e-2 ? 0.0 : correctedCenterLL.heading(offset.getImageryPos());
-        if( direction < 0 )
+        if (direction < 0)
             direction += Math.PI * 2;
         return new double[] {length, direction};
     }
 
-    private static void drawArrow( Graphics g, int cx, int cy, double length, double direction ) {
-        int dx = (int)Math.round(Math.sin(direction) * length / 2);
-        int dy = (int)Math.round(Math.cos(direction) * length / 2);
+    private static void drawArrow(Graphics g, int cx, int cy, double length, double direction) {
+        int dx = (int) Math.round(Math.sin(direction) * length / 2);
+        int dy = (int) Math.round(Math.cos(direction) * length / 2);
         g.drawLine(cx - dx, cy - dy, cx + dx, cy + dy);
         double wingLength = Math.max(length / 3, 4);
         double d1 = direction - Math.PI / 6;
-        int dx1 = (int)Math.round(Math.sin(d1) * wingLength);
-        int dy1 = (int)Math.round(Math.cos(d1) * wingLength);
+        int dx1 = (int) Math.round(Math.sin(d1) * wingLength);
+        int dy1 = (int) Math.round(Math.cos(d1) * wingLength);
         g.drawLine(cx + dx, cy + dy, cx + dx - dx1, cy + dy - dy1);
         double d2 = direction + Math.PI / 6;
-        int dx2 = (int)Math.round(Math.sin(d2) * wingLength);
-        int dy2 = (int)Math.round(Math.cos(d2) * wingLength);
+        int dx2 = (int) Math.round(Math.sin(d2) * wingLength);
+        int dy2 = (int) Math.round(Math.cos(d2) * wingLength);
         g.drawLine(cx + dx, cy + dy, cx + dx - dx2, cy + dy - dy2);
     }
@@ -159,10 +179,10 @@
          * of an arrow if they're needed.
          */
-        public OffsetIcon( ImageryOffsetBase offset ) {
+        OffsetIcon(ImageryOffsetBase offset) {
             isDeprecated = offset.isDeprecated();
             isCalibration = offset instanceof CalibrationObject;
-            if( offset instanceof ImageryOffset ) {
+            if (offset instanceof ImageryOffset) {
                 background = ImageProvider.get("offset");
-                double[] ld = getLengthAndDirection((ImageryOffset)offset);
+                double[] ld = getLengthAndDirection((ImageryOffset) offset);
                 distance = ld[0];
                 direction = ld[1];
@@ -179,13 +199,14 @@
          * Paints the base image and adds to it according to the offset.
          */
-        public void paintIcon( Component comp, Graphics g, int x, int y ) {
+        @Override
+        public void paintIcon(Component comp, Graphics g, int x, int y) {
             background.paintIcon(comp, g, x, y);
 
-            Graphics2D g2 = (Graphics2D)g.create();
+            Graphics2D g2 = (Graphics2D) g.create();
             g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-            if( !isCalibration ) {
+            if (!isCalibration) {
                 g2.setColor(Color.black);
                 Point c = new Point(x + getIconWidth() / 2, y + getIconHeight() / 2);
-                if( distance < 1e-2 ) {
+                if (distance < 1e-2) {
                     // no offset
                     g2.fillOval(c.x - 3, c.y - 3, 7, 7);
@@ -197,5 +218,5 @@
                 }
             }
-            if( isDeprecated ) {
+            if (isDeprecated) {
                 // big red X
                 g2.setColor(Color.red);
@@ -207,8 +228,10 @@
         }
 
+        @Override
         public int getIconWidth() {
             return background.getIconWidth();
         }
 
+        @Override
         public int getIconHeight() {
             return background.getIconHeight();
@@ -223,9 +246,9 @@
         private double direction;
 
-        public DirectionIcon( LatLon to ) {
+        DirectionIcon(LatLon to) {
             this.to = to;
         }
 
-        public void updateIcon( LatLon from ) {
+        public void updateIcon(LatLon from) {
             distance = from.greatCircleDistance(to);
             direction = to.heading(from);
@@ -235,10 +258,11 @@
          * Paints the base image and adds to it according to the offset.
          */
-        public void paintIcon( Component comp, Graphics g, int x, int y ) {
-            Graphics2D g2 = (Graphics2D)g.create();
+        @Override
+        public void paintIcon(Component comp, Graphics g, int x, int y) {
+            Graphics2D g2 = (Graphics2D) g.create();
             g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
             g2.setColor(Color.black);
             Point c = new Point(x + getIconWidth() / 2, y + getIconHeight() / 2);
-            if( distance < 1 ) {
+            if (distance < 1) {
                 // no offset
                 int r = 2;
@@ -251,8 +275,10 @@
         }
 
+        @Override
         public int getIconWidth() {
             return SIZE;
         }
 
+        @Override
         public int getIconHeight() {
             return SIZE;
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetInfoAction.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetInfoAction.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetInfoAction.java	(revision 32528)
@@ -1,3 +1,6 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.event.ActionEvent;
@@ -5,13 +8,14 @@
 import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
+
 import javax.swing.AbstractAction;
 import javax.swing.JOptionPane;
+
 import org.openstreetmap.josm.Main;
-import static org.openstreetmap.josm.tools.I18n.tr;
 import org.openstreetmap.josm.tools.ImageProvider;
 
 /**
  * Display an information box for an offset.
- * 
+ *
  * @author Zverik
  * @license WTFPL
@@ -21,10 +25,10 @@
 
     ImageryOffsetBase offset;
-    
+
     /**
      * Initializes the action with an offset object.
      * Calls {@link #getInformationObject(iodb.ImageryOffsetBase)}.
      */
-    public OffsetInfoAction( ImageryOffsetBase offset ) {
+    public OffsetInfoAction(ImageryOffsetBase offset) {
         super(tr("Offset Information"));
         putValue(SMALL_ICON, ImageProvider.get("info"));
@@ -37,26 +41,27 @@
      * to report the given offset.
      */
+    @Override
     public void actionPerformed(ActionEvent e) {
         Object info = offset == null ? null : getInformationObject(offset);
-        if( offset.isFlagged() )
+        if (offset.isFlagged())
             JOptionPane.showMessageDialog(Main.parent, info, ImageryOffsetTools.DIALOG_TITLE, JOptionPane.PLAIN_MESSAGE);
         else {
             int result = JOptionPane.showOptionDialog(Main.parent, info, ImageryOffsetTools.DIALOG_TITLE,
                     JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null,
-                    new String[] { "OK", tr("Report this offset") }, null);
-            if( result == 1 ) {
+                    new String[] {"OK", tr("Report this offset")}, null);
+            if (result == 1) {
                 // ask for a reason
                 Object reason = JOptionPane.showInputDialog(Main.parent,
                         tr("You are to notify moderators of this offset. Why?"),
                         ImageryOffsetTools.DIALOG_TITLE, JOptionPane.PLAIN_MESSAGE);
-                if( reason != null && reason.toString().length() > 0 ) {
+                if (reason != null && reason.toString().length() > 0) {
                     try {
                         String query = "report?id=" + offset.getId()
-                                + "&reason=" + URLEncoder.encode(reason.toString(), "UTF8");
+                        + "&reason=" + URLEncoder.encode(reason.toString(), "UTF8");
                         SimpleOffsetQueryTask reportTask =
                                 new SimpleOffsetQueryTask(query, tr("Reporting the offset..."));
                         Main.worker.submit(reportTask);
-                    } catch( UnsupportedEncodingException ex ) {
-                        // WTF
+                    } catch (UnsupportedEncodingException ex) {
+                        Main.error(ex);
                     }
                 }
@@ -68,32 +73,32 @@
      * Constructs a string with all information about the given offset.
      */
-    public static Object getInformationObject( ImageryOffsetBase offset ) {
+    public static Object getInformationObject(ImageryOffsetBase offset) {
         StringBuilder sb = new StringBuilder();
-        if( offset instanceof ImageryOffset ) {
-            double odist = ((ImageryOffset)offset).getImageryPos().greatCircleDistance(offset.getPosition());
-            if( odist < 1e-2 ) odist = 0.0;
+        if (offset instanceof ImageryOffset) {
+            double odist = ((ImageryOffset) offset).getImageryPos().greatCircleDistance(offset.getPosition());
+            if (odist < 1e-2) odist = 0.0;
             sb.append(tr("An imagery offset of {0}", ImageryOffsetTools.formatDistance(odist))).append('\n');
-            sb.append(tr("Imagery ID")).append(": ").append(((ImageryOffset)offset).getImagery()).append('\n');
+            sb.append(tr("Imagery ID")).append(": ").append(((ImageryOffset) offset).getImagery()).append('\n');
         } else {
-            sb.append(tr("A calibration geometry of {0} nodes", ((CalibrationObject)offset).getGeometry().length)).append('\n');
+            sb.append(tr("A calibration geometry of {0} nodes", ((CalibrationObject) offset).getGeometry().length)).append('\n');
         }
-        
+
         double dist = ImageryOffsetTools.getMapCenter().greatCircleDistance(offset.getPosition());
         sb.append(dist < 50 ? tr("Determined right here") : tr("Determined {0} away",
                 ImageryOffsetTools.formatDistance(dist)));
-        
+
         sb.append("\n\n");
         sb.append(tr("Created by {0} on {1}", offset.getAuthor(),
                 DATE_FORMAT.format(offset.getDate()))).append('\n');
         sb.append(tr("Description")).append(": ").append(offset.getDescription());
-        
-        if( offset.isDeprecated() ) {
+
+        if (offset.isDeprecated()) {
             sb.append("\n\n");
-            sb.append(tr("Deprecated by {0} on {1}",offset.getAbandonAuthor(),
+            sb.append(tr("Deprecated by {0} on {1}", offset.getAbandonAuthor(),
                     DATE_FORMAT.format(offset.getAbandonDate()))).append('\n');
             sb.append(tr("Reason")).append(": ").append(offset.getAbandonReason());
         }
 
-        if( offset.isFlagged() ) {
+        if (offset.isFlagged()) {
             sb.append("\n\n").append(tr("This entry has been reported."));
         }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/QuerySuccessListener.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/QuerySuccessListener.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/QuerySuccessListener.java	(revision 32528)
@@ -1,2 +1,3 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/SimpleOffsetQueryTask.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/SimpleOffsetQueryTask.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/SimpleOffsetQueryTask.java	(revision 32528)
@@ -1,13 +1,20 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.*;
-import java.util.*;
-import java.util.regex.*;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Scanner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 import javax.swing.JOptionPane;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.PleaseWaitRunnable;
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 /**
@@ -29,5 +36,5 @@
      * @param title A title for the progress monitor.
      */
-    public SimpleOffsetQueryTask( String query, String title ) {
+    SimpleOffsetQueryTask(String query, String title) {
         super(ImageryOffsetTools.DIALOG_TITLE);
         this.query = query;
@@ -39,7 +46,7 @@
      * In case a query was not specified when the object was constructed,
      * it can be set with this method.
-     * @see #SimpleOffsetQueryTask(java.lang.String, java.lang.String) 
+     * @see #SimpleOffsetQueryTask(java.lang.String, java.lang.String)
      */
-    public void setQuery( String query ) {
+    public void setQuery(String query) {
         this.query = query;
     }
@@ -48,5 +55,5 @@
      * Install a listener for successful responses. There can be only one.
      */
-    public void setListener( QuerySuccessListener listener ) {
+    public void setListener(QuerySuccessListener listener) {
         this.listener = listener;
     }
@@ -68,7 +75,7 @@
             errorMessage = null;
             doQuery(query);
-        } catch( UploadException e ) {
+        } catch (UploadException e) {
             errorMessage = tr("Server has rejected the request") + ":\n" + e.getMessage();
-        } catch( IOException e ) {
+        } catch (IOException e) {
             errorMessage = tr("Unable to connect to the server") + "\n" + e.getMessage();
         }
@@ -78,28 +85,24 @@
      * Sends a request to the imagery offset server. Processes exceptions and
      * return codes, calls {@link #processResponse(java.io.InputStream)} on success.
-     * @param query
-     * @throws iodb.SimpleOffsetQueryTask.UploadException
-     * @throws IOException 
      */
-    private void doQuery( String query ) throws UploadException, IOException {
+    private void doQuery(String query) throws UploadException, IOException {
         try {
             String serverURL = Main.pref.get("iodb.server.url", "http://offsets.textual.ru/");
             URL url = new URL(serverURL + query);
-//            Main.info("IODB URL = " + url); // todo: remove in release
-            HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
             connection.connect();
-            if( connection.getResponseCode() != 200 ) {
+            if (connection.getResponseCode() != 200) {
                 throw new IOException("HTTP Response code " + connection.getResponseCode() + " (" + connection.getResponseMessage() + ")");
             }
             InputStream inp = connection.getInputStream();
-            if( inp == null )
+            if (inp == null)
                 throw new IOException("Empty response");
             try {
-                if( !cancelled )
+                if (!cancelled)
                     processResponse(inp);
             } finally {
                 connection.disconnect();
             }
-        } catch( MalformedURLException ex ) {
+        } catch (MalformedURLException ex) {
             throw new IOException("Malformed URL: " + ex.getMessage());
         }
@@ -120,8 +123,8 @@
     @Override
     protected void finish() {
-        if( errorMessage != null ) {
+        if (errorMessage != null) {
             JOptionPane.showMessageDialog(Main.parent, errorMessage,
                     ImageryOffsetTools.DIALOG_TITLE, JOptionPane.ERROR_MESSAGE);
-        } else if( listener != null ) {
+        } else if (listener != null) {
             listener.queryPassed();
         }
@@ -133,7 +136,7 @@
      * @throws iodb.SimpleOffsetQueryTask.UploadException Thrown if an error message was found.
      */
-    protected void processResponse( InputStream inp ) throws UploadException {
+    protected void processResponse(InputStream inp) throws UploadException {
         String response = "";
-        if( inp != null ) {
+        if (inp != null) {
             Scanner sc = new Scanner(inp).useDelimiter("\\A");
             response = sc.hasNext() ? sc.next() : "";
@@ -141,6 +144,6 @@
         Pattern p = Pattern.compile("<(\\w+)>([^<]+)</\\1>");
         Matcher m = p.matcher(response);
-        if( m.find() ) {
-            if( m.group(1).equals("error") ) {
+        if (m.find()) {
+            if (m.group(1).equals("error")) {
                 throw new UploadException(m.group(2));
             }
@@ -154,5 +157,5 @@
      */
     public static class UploadException extends Exception {
-        public UploadException( String message ) {
+        UploadException(String message) {
             super(message);
         }
Index: /applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java
===================================================================
--- /applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java	(revision 32527)
+++ /applications/editors/josm/plugins/imagery_offset_db/src/iodb/StoreImageryOffsetAction.java	(revision 32528)
@@ -1,2 +1,3 @@
+// License: WTFPL. For details, see LICENSE file.
 package iodb;
 
@@ -48,13 +49,13 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        if( Main.map == null || Main.map.mapView == null )
+        if (Main.map == null || Main.map.mapView == null)
             return;
 
         ImageryLayer layer = ImageryOffsetTools.getTopImageryLayer();
-        if( layer == null )
+        if (layer == null)
             return;
 
         String userName = JosmUserIdentityManager.getInstance().getUserName();
-        if( userName == null || userName.length() == 0 ) {
+        if (userName == null || userName.length() == 0) {
             JOptionPane.showMessageDialog(Main.parent,
                     tr("To store imagery offsets you must be a registered OSM user."),
@@ -62,5 +63,5 @@
             return;
         }
-        if( userName.indexOf('@') > 0 )
+        if (userName.indexOf('@') > 0)
             userName = userName.replace('@', ',');
 
@@ -69,7 +70,7 @@
         if (getLayerManager().getEditDataSet() != null) {
             Collection<OsmPrimitive> selectedObjects = getLayerManager().getEditDataSet().getSelected();
-            if( selectedObjects.size() == 1 ) {
+            if (selectedObjects.size() == 1) {
                 OsmPrimitive selection = selectedObjects.iterator().next();
-                if( (selection instanceof Node || selection instanceof Way) && !selection.isIncomplete() && !selection.isReferredByWays(1) ) {
+                if ((selection instanceof Node || selection instanceof Way) && !selection.isIncomplete() && !selection.isReferredByWays(1)) {
                     String[] options = new String[] {tr("Store calibration geometry"), tr("Store imagery offset")};
                     int result = JOptionPane.showOptionDialog(Main.parent,
@@ -77,7 +78,7 @@
                             ImageryOffsetTools.DIALOG_TITLE, JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,
                             null, options, options[0]);
-                    if( result == 2 || result == JOptionPane.CLOSED_OPTION )
+                    if (result == 2 || result == JOptionPane.CLOSED_OPTION)
                         return;
-                    if( result == 0 )
+                    if (result == 0)
                         calibration = selection;
                 }
@@ -88,10 +89,10 @@
         LatLon center = ImageryOffsetTools.getMapCenter();
         ImageryOffsetBase offsetObj;
-        if( calibration == null ) {
+        if (calibration == null) {
             // register imagery offset
-            if( Math.abs(layer.getDx()) < 1e-8 && Math.abs(layer.getDy()) < 1e-8 ) {
-                if( JOptionPane.showConfirmDialog(Main.parent,
+            if (Math.abs(layer.getDx()) < 1e-8 && Math.abs(layer.getDy()) < 1e-8) {
+                if (JOptionPane.showConfirmDialog(Main.parent,
                         tr("The topmost imagery layer has no offset. Are you sure you want to upload this?"),
-                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION )
+                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION)
                     return;
             }
@@ -107,5 +108,5 @@
         }
         String description = queryDescription(message);
-        if( description == null )
+        if (description == null)
             return;
         offsetObj.setBasicInfo(center, userName, null, null);
@@ -117,6 +118,6 @@
             offsetObj.putServerParams(params);
             StringBuilder query = null;
-            for( String key : params.keySet() ) {
-                if( query == null ) {
+            for (String key : params.keySet()) {
+                if (query == null) {
                     query = new StringBuilder("store?");
                 } else {
@@ -126,6 +127,6 @@
             }
             Main.worker.submit(new SimpleOffsetQueryTask(query.toString(), tr("Uploading a new offset...")));
-        } catch( UnsupportedEncodingException ex ) {
-            // WTF
+        } catch (UnsupportedEncodingException ex) {
+            Main.error(ex);
         }
     }
@@ -137,16 +138,17 @@
      * @return Either null or a string 3 to 200 letters long.
      */
-    public static String queryDescription( Object message ) {
+    public static String queryDescription(Object message) {
         String reason = null;
         boolean iterated = false;
         boolean ok = false;
-        while( !ok ) {
-            Object result = JOptionPane.showInputDialog(Main.parent, message, ImageryOffsetTools.DIALOG_TITLE, JOptionPane.PLAIN_MESSAGE, null, null, reason);
-            if( result == null || result.toString().length() == 0 ) {
+        while (!ok) {
+            Object result = JOptionPane.showInputDialog(Main.parent, message,
+                    ImageryOffsetTools.DIALOG_TITLE, JOptionPane.PLAIN_MESSAGE, null, null, reason);
+            if (result == null || result.toString().length() == 0) {
                 return null;
             }
             reason = result.toString();
-            if( reason.length() < 3 || reason.length() > 200 ) {
-                if( !iterated ) {
+            if (reason.length() < 3 || reason.length() > 200) {
+                if (!iterated) {
                     message = message + "\n" + tr("This string should be 3 to 200 letters long.");
                     iterated = true;
@@ -165,7 +167,7 @@
     protected void updateEnabledState() {
         boolean state = true;
-        if( Main.map == null || Main.map.mapView == null || !Main.map.isVisible() )
+        if (Main.map == null || Main.map.mapView == null || !Main.map.isVisible())
             state = false;
-        if( ImageryOffsetTools.getTopImageryLayer() == null )
+        if (ImageryOffsetTools.getTopImageryLayer() == null)
             state = false;
         setEnabled(state);
