Index: applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AddressDialog.java
===================================================================
--- applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AddressDialog.java	(revision 30010)
+++ applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AddressDialog.java	(revision 30045)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package buildings_tools;
 
@@ -49,5 +50,5 @@
     }
 
-    public void saveValues() {
+    public final void saveValues() {
         lhousenum = housenum.getText();
         lstreetname = streetname.getText();
@@ -55,9 +56,9 @@
     }
 
-    public String getHouseNum() {
+    public final String getHouseNum() {
         return housenum.getText();
     }
 
-    public String getStreetName() {
+    public final String getStreetName() {
         return streetname.getText();
     }
Index: applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AdvancedSettingsDialog.java
===================================================================
--- applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AdvancedSettingsDialog.java	(revision 30010)
+++ applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AdvancedSettingsDialog.java	(revision 30045)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package buildings_tools;
 
@@ -38,5 +39,5 @@
     }
 
-    public void saveSettings() {
+    public final void saveSettings() {
         tagsModel.applyToTags(ToolSettings.getTags(), false);
         ToolSettings.saveTags();
Index: applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AngleSnap.java
===================================================================
--- applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AngleSnap.java	(revision 30010)
+++ applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AngleSnap.java	(revision 30045)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package buildings_tools;
 
@@ -12,19 +13,19 @@
 public class AngleSnap {
     private static final double PI_2 = Math.PI / 2;
-    TreeSet<Double> snapSet = new TreeSet<Double>();
+    final TreeSet<Double> snapSet = new TreeSet<Double>();
 
-    public void clear() {
+    public final void clear() {
         snapSet.clear();
     }
 
-    public void addSnap(double snap) {
+    public final void addSnap(double snap) {
         snapSet.add(snap % PI_2);
     }
 
-    public Double addSnap(Node[] nodes) {
+    public final Double addSnap(Node[] nodes) {
         if (nodes.length == 2) {
             EastNorth p1, p2;
-            p1 = latlon2eastNorth(((Node) nodes[0]).getCoor());
-            p2 = latlon2eastNorth(((Node) nodes[1]).getCoor());
+            p1 = latlon2eastNorth(nodes[0].getCoor());
+            p2 = latlon2eastNorth(nodes[1].getCoor());
             double heading = p1.heading(p2);
             addSnap(heading);
@@ -36,5 +37,5 @@
     }
 
-    public void addSnap(Way way) {
+    public final void addSnap(Way way) {
         for (Pair<Node, Node> pair : way.getNodePairs(false)) {
             EastNorth a, b;
@@ -46,5 +47,5 @@
     }
 
-    public Double getAngle() {
+    public final Double getAngle() {
         if (snapSet.isEmpty()) {
             return null;
@@ -65,5 +66,5 @@
     }
 
-    public double snapAngle(double angle) {
+    public final double snapAngle(double angle) {
         if (snapSet.isEmpty()) {
             return angle;
Index: applications/editors/josm/plugins/buildings_tools/src/buildings_tools/Building.java
===================================================================
--- applications/editors/josm/plugins/buildings_tools/src/buildings_tools/Building.java	(revision 30010)
+++ applications/editors/josm/plugins/buildings_tools/src/buildings_tools/Building.java	(revision 30045)
@@ -1,8 +1,8 @@
+// License: GPL. For details, see LICENSE file.
 package buildings_tools;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 import static buildings_tools.BuildingsToolsPlugin.eastNorth2latlon;
 import static buildings_tools.BuildingsToolsPlugin.latlon2eastNorth;
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.Graphics2D;
@@ -22,5 +22,6 @@
 import org.openstreetmap.josm.command.DeleteCommand;
 import org.openstreetmap.josm.command.SequenceCommand;
-import org.openstreetmap.josm.data.coor.*;
+import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.BBox;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -103,5 +104,6 @@
 
     /**
-     * @returns Projection of the point to the heading vector in metres
+     * @return Projection of the point to the heading vector in metres
+     * @param p The point to project
      */
     private double projection1(EastNorth p) {
@@ -111,6 +113,7 @@
 
     /**
-     * @returns Projection of the point to the perpendicular of the heading
+     * @return Projection of the point to the perpendicular of the heading
      *          vector in metres
+     * @param p The point to project
      */
     private double projection2(EastNorth p) {
@@ -203,7 +206,7 @@
     }
 
-    private Node findNode(EastNorth en) {
+    private Node findNode(EastNorth pos) {
         DataSet ds = Main.main.getCurrentDataSet();
-        LatLon l = eastNorth2latlon(en);
+        LatLon l = eastNorth2latlon(pos);
         List<Node> nodes = ds.searchNodes(new BBox(l.lon() - 0.0000001, l.lat() - 0.0000001,
                 l.lon() + 0.0000001, l.lat() + 0.0000001));
@@ -221,7 +224,7 @@
 
     /**
-     * Returns a node with address tags under the building
+     * Returns a node with address tags under the building.
      *
-     * @return
+     * @return A node with address tags under the building.
      */
     private Node getAddressNode() {
@@ -299,22 +302,25 @@
         w.setKeys(ToolSettings.getTags());
         cmds.add(new AddCommand(w));
-        Node addrNode;
-        if (ToolSettings.PROP_USE_ADDR_NODE.get() && (addrNode = getAddressNode()) != null) {
-            for (Entry<String, String> entry : addrNode.getKeys().entrySet()) {
-                w.put(entry.getKey(), entry.getValue());
-            }
-            for (OsmPrimitive p : addrNode.getReferrers()) {
-                Relation r = (Relation) p;
-                Relation rnew = new Relation(r);
-                for (int i = 0; i < r.getMembersCount(); i++) {
-                    RelationMember member = r.getMember(i);
-                    if (member.getMember() == addrNode) {
-                        rnew.removeMember(i);
-                        rnew.addMember(i, new RelationMember(member.getRole(), w));
+
+        if (ToolSettings.PROP_USE_ADDR_NODE.get()) {
+            Node addrNode = getAddressNode();
+            if (addrNode != null) {
+                for (Entry<String, String> entry : addrNode.getKeys().entrySet()) {
+                    w.put(entry.getKey(), entry.getValue());
+                }
+                for (OsmPrimitive p : addrNode.getReferrers()) {
+                    Relation r = (Relation) p;
+                    Relation rnew = new Relation(r);
+                    for (int i = 0; i < r.getMembersCount(); i++) {
+                        RelationMember member = r.getMember(i);
+                        if (member.getMember() == addrNode) {
+                            rnew.removeMember(i);
+                            rnew.addMember(i, new RelationMember(member.getRole(), w));
+                        }
                     }
+                    cmds.add(new ChangeCommand(r, rnew));
                 }
-                cmds.add(new ChangeCommand(r, rnew));
-            }
-            cmds.add(new DeleteCommand(addrNode));
+                cmds.add(new DeleteCommand(addrNode));
+            }
         }
         Command c = new SequenceCommand(tr("Create building"), cmds);
Index: applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeAction.java
===================================================================
--- applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeAction.java	(revision 30010)
+++ applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeAction.java	(revision 30045)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package buildings_tools;
 
Index: applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeDialog.java
===================================================================
--- applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeDialog.java	(revision 30010)
+++ applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeDialog.java	(revision 30045)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package buildings_tools;
 
@@ -9,6 +10,6 @@
 
 import javax.swing.JButton;
+import javax.swing.JCheckBox;
 import javax.swing.JFormattedTextField;
-import javax.swing.JCheckBox;
 
 import org.openstreetmap.josm.tools.GBC;
@@ -53,5 +54,5 @@
     }
 
-    public double width() {
+    public final double width() {
         try {
             return NumberFormat.getInstance().parse(twidth.getText()).doubleValue();
@@ -69,9 +70,9 @@
     }
 
-    public boolean useAddr() {
+    public final boolean useAddr() {
         return caddr.isSelected();
     }
 
-    public void saveSettings() {
+    public final void saveSettings() {
         ToolSettings.setSizes(width(), lenstep());
         ToolSettings.setAddrDialog(useAddr());
Index: applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingsToolsPlugin.java
===================================================================
--- applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingsToolsPlugin.java	(revision 30010)
+++ applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingsToolsPlugin.java	(revision 30045)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package buildings_tools;
 
@@ -13,12 +14,12 @@
 
 public class BuildingsToolsPlugin extends Plugin {
-    public static Projection proj = Projections.getProjectionByCode("EPSG:3857"); // Mercator
+    public static final Projection MERCATOR = Projections.getProjectionByCode("EPSG:3857"); // Mercator
 
     public static EastNorth latlon2eastNorth(LatLon p) {
-        return proj.latlon2eastNorth(p);
+        return MERCATOR.latlon2eastNorth(p);
     }
 
     public static LatLon eastNorth2latlon(EastNorth p) {
-        return proj.eastNorth2latlon(p);
+        return MERCATOR.eastNorth2latlon(p);
     }
 
Index: applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java
===================================================================
--- applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java	(revision 30010)
+++ applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java	(revision 30045)
@@ -1,8 +1,8 @@
+// License: GPL. For details, see LICENSE file.
 package buildings_tools;
 
+import static buildings_tools.BuildingsToolsPlugin.latlon2eastNorth;
 import static org.openstreetmap.josm.tools.I18n.marktr;
 import static org.openstreetmap.josm.tools.I18n.tr;
-
-import static buildings_tools.BuildingsToolsPlugin.latlon2eastNorth;
 
 import java.awt.AWTEvent;
@@ -27,5 +27,5 @@
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.SelectionChangedListener;
-import org.openstreetmap.josm.data.coor.*;
+import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
@@ -46,6 +46,6 @@
     }
 
-    final private Cursor cursorCrosshair;
-    final private Cursor cursorJoinNode;
+    private final Cursor cursorCrosshair;
+    private final Cursor cursorJoinNode;
     private Cursor currCursor;
     private Cursor customCursor;
@@ -61,5 +61,5 @@
     private boolean isAltDown;
 
-    Building building = new Building();
+    final Building building = new Building();
 
     public DrawBuildingAction(MapFrame mapFrame) {
@@ -81,4 +81,5 @@
             return ImageProvider.getCursor("crosshair", "building");
         } catch (Exception e) {
+            Main.error(e);
         }
         return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
@@ -86,8 +87,7 @@
 
     /**
-     * Displays the given cursor instead of the normal one
+     * Displays the given cursor instead of the normal one.
      *
-     * @param Cursors
-     *            One of the available cursors
+     * @param c One of the available cursors
      */
     private void setCursor(final Cursor c) {
@@ -107,4 +107,5 @@
             currCursor = c;
         } catch (Exception e) {
+            Main.error(e);
         }
     }
@@ -118,10 +119,9 @@
         }
         dlg.saveValues();
-        String tmp;
-        tmp = dlg.getHouseNum();
-        if (tmp != null && tmp != "")
+        String tmp = dlg.getHouseNum();
+        if (tmp != null && !tmp.isEmpty())
             w.put("addr:housenumber", tmp);
         tmp = dlg.getStreetName();
-        if (tmp != null && tmp != "")
+        if (tmp != null && !tmp.isEmpty())
             w.put("addr:street", tmp);
     }
@@ -143,4 +143,5 @@
             Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK);
         } catch (SecurityException ex) {
+            Main.error(ex);
         }
     }
@@ -156,4 +157,5 @@
             Toolkit.getDefaultToolkit().removeAWTEventListener(this);
         } catch (SecurityException ex) {
+            Main.error(ex);
         }
         if (mode != Mode.None)
@@ -162,5 +164,5 @@
     }
 
-    public void cancelDrawing() {
+    public final void cancelDrawing() {
         mode = Mode.None;
         if (Main.map == null || Main.map.mapView == null)
@@ -192,6 +194,7 @@
 
         if (ev.getKeyCode() == KeyEvent.VK_ESCAPE && ev.getID() == KeyEvent.KEY_PRESSED) {
-            if (mode != Mode.None)
+            if (mode != Mode.None) {
                 ev.consume();
+            }
 
             cancelDrawing();
@@ -225,5 +228,6 @@
             building.setPlace(p, ToolSettings.getWidth(), ToolSettings.getLenStep(), isShiftDown);
             Main.map.statusLine.setDist(building.getLength());
-            return this.nextMode = ToolSettings.getWidth() == 0 ? Mode.DrawingWidth : Mode.None;
+            this.nextMode = ToolSettings.getWidth() == 0 ? Mode.DrawingWidth : Mode.None;
+            return this.nextMode;
         }
     }
@@ -258,14 +262,14 @@
         } else if (mode == Mode.DrawingAngFix) {
             nextMode = modeDrawingAngFix();
-        } else
+        } else {
             throw new AssertionError("Invalid drawing mode");
+        }
     }
 
     @Override
     public void paint(Graphics2D g, MapView mv, Bounds bbox) {
-        if (mode == Mode.None)
-            return;
-        if (building.getLength() == 0)
-            return;
+        if (mode == Mode.None || building.getLength() == 0) {
+            return;
+        }
 
         g.setColor(selectedColor);
@@ -307,6 +311,6 @@
             if (w != null && ToolSettings.isUsingAddr())
                 showAddrDialog(w);
-            if (ToolSettings.isAutoSelect() &&
-                    (Main.main.getCurrentDataSet().getSelected().isEmpty() || isShiftDown)) {
+            if (ToolSettings.isAutoSelect()
+                 && (Main.main.getCurrentDataSet().getSelected().isEmpty() || isShiftDown)) {
                 Main.main.getCurrentDataSet().setSelected(w);
             }
@@ -400,5 +404,5 @@
     }
 
-    public void updateSnap(Collection<? extends OsmPrimitive> newSelection) {
+    public final void updateSnap(Collection<? extends OsmPrimitive> newSelection) {
         building.clearAngleSnap();
         // update snap only if selection isn't too big
Index: applications/editors/josm/plugins/buildings_tools/src/buildings_tools/MyDialog.java
===================================================================
--- applications/editors/josm/plugins/buildings_tools/src/buildings_tools/MyDialog.java	(revision 30010)
+++ applications/editors/josm/plugins/buildings_tools/src/buildings_tools/MyDialog.java	(revision 30045)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package buildings_tools;
 
@@ -14,11 +15,11 @@
 import org.openstreetmap.josm.tools.GBC;
 
-public class MyDialog extends ExtendedDialog {
-    private static final String[] buttonTexts = new String[] { tr("OK"), tr("Cancel") };
-    private static final String[] buttonIcons = new String[] { "ok.png", "cancel.png" };
+public abstract class MyDialog extends ExtendedDialog {
+    private static final String[] BUTTON_TEXTS = new String[] {tr("OK"), tr("Cancel")};
+    private static final String[] BUTTON_ICONS = new String[] {"ok.png", "cancel.png"};
 
-    protected JPanel panel = new JPanel(new GridBagLayout());
+    protected final JPanel panel = new JPanel(new GridBagLayout());
 
-    protected void addLabelled(String str, Component c) {
+    protected final void addLabelled(String str, Component c) {
         JLabel label = new JLabel(str);
         panel.add(label, GBC.std());
@@ -28,7 +29,7 @@
 
     public MyDialog(String title) {
-        super(Main.parent, title, buttonTexts, true);
+        super(Main.parent, title, BUTTON_TEXTS, true);
         contentInsets = new Insets(15, 15, 5, 15);
-        setButtonIcons(buttonIcons);
+        setButtonIcons(BUTTON_ICONS);
 
         setContent(panel);
Index: applications/editors/josm/plugins/buildings_tools/src/buildings_tools/ToolSettings.java
===================================================================
--- applications/editors/josm/plugins/buildings_tools/src/buildings_tools/ToolSettings.java	(revision 30010)
+++ applications/editors/josm/plugins/buildings_tools/src/buildings_tools/ToolSettings.java	(revision 30045)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package buildings_tools;
 
@@ -13,10 +14,15 @@
 import org.openstreetmap.josm.data.preferences.BooleanProperty;
 
-public class ToolSettings {
-    public static BooleanProperty PROP_USE_ADDR_NODE = new BooleanProperty("buildings_tools.addrNode", false);
+public final class ToolSettings {
+
+    private ToolSettings() {
+        // Hide default constructor for utils classes
+    }
+
+    public static final BooleanProperty PROP_USE_ADDR_NODE = new BooleanProperty("buildings_tools.addrNode", false);
     private static double width = 0;
     private static double lenstep = 0;
     private static boolean useAddr;
-    private static final Map<String, String> tags = new HashMap<String, String>();
+    private static final Map<String, String> TAGS = new HashMap<String, String>();
     private static boolean autoSelect;
 
@@ -44,10 +50,10 @@
     public static Map<String, String> getTags() {
         loadTags();
-        return tags;
+        return TAGS;
     }
 
     public static void saveTags() {
-        ArrayList<String> values = new ArrayList<String>(tags.size() * 2);
-        for (Entry<String, String> entry : tags.entrySet()) {
+        ArrayList<String> values = new ArrayList<String>(TAGS.size() * 2);
+        for (Entry<String, String> entry : TAGS.entrySet()) {
             values.add(entry.getKey());
             values.add(entry.getValue());
@@ -57,14 +63,14 @@
 
     private static void loadTags() {
-        tags.clear();
+        TAGS.clear();
         Collection<String> values = Main.pref.getCollection("buildings_tools.tags",
-                Arrays.asList(new String[] { "building", "yes" }));
+                Arrays.asList(new String[] {"building", "yes"}));
         try {
             for (Iterator<String> iterator = values.iterator(); iterator.hasNext();) {
-                tags.put(iterator.next(), iterator.next());
+                TAGS.put(iterator.next(), iterator.next());
             }
         } catch (NoSuchElementException e) {
+            Main.warn(e);
         }
-
     }
 
