Index: /applications/editors/josm/plugins/FastDraw/.checkstyle
===================================================================
--- /applications/editors/josm/plugins/FastDraw/.checkstyle	(revision 32548)
+++ /applications/editors/josm/plugins/FastDraw/.checkstyle	(revision 32548)
@@ -0,0 +1,28 @@
+<?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="src/com"/>
+    <filter-data value="src/gnu"/>
+    <filter-data value="src/javax"/>
+    <filter-data value="src/oauth"/>
+    <filter-data value="src/org/apache"/>
+    <filter-data value="src/org/glassfish"/>
+    <filter-data value="src/org/jdesktop"/>
+    <filter-data value="src/org/openstreetmap/gui"/>
+    <filter-data value="src/org/openstreetmap/josm/gui/mappaint/mapcss/parsergen"/>
+    <filter-data value="src/org/w3"/>
+    <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/FastDraw/.project
===================================================================
--- /applications/editors/josm/plugins/FastDraw/.project	(revision 32547)
+++ /applications/editors/josm/plugins/FastDraw/.project	(revision 32548)
@@ -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/FastDraw/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- /applications/editors/josm/plugins/FastDraw/.settings/org.eclipse.jdt.ui.prefs	(revision 32548)
+++ /applications/editors/josm/plugins/FastDraw/.settings/org.eclipse.jdt.ui.prefs	(revision 32548)
@@ -0,0 +1,60 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
Index: /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java
===================================================================
--- /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java	(revision 32547)
+++ /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java	(revision 32548)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.plugins.fastdraw;
 
@@ -25,4 +26,5 @@
         clear();
     }
+
     public void setMv(MapView mv) {
         this.mv = mv;
@@ -35,14 +37,14 @@
     double getLength() {
         List<LatLon> pts = getPoints();
-        Iterator<LatLon> it1,it2;
-        LatLon pp1,pp2;
-        if (pts.size()<2) return 0;
-        it1=pts.listIterator(0);
-        it2=pts.listIterator(1);
-        double len=0;
+        Iterator<LatLon> it1, it2;
+        LatLon pp1, pp2;
+        if (pts.size() < 2) return 0;
+        it1 = pts.listIterator(0);
+        it2 = pts.listIterator(1);
+        double len = 0;
         for (int i = 0; i < pts.size() - 1; i++) {
-                pp1 = it1.next();
-                pp2 = it2.next();
-                len+=pp1.greatCircleDistance(pp2);
+            pp1 = it1.next();
+            pp2 = it2.next();
+            len += pp1.greatCircleDistance(pp2);
         }
         return len;
@@ -50,22 +52,22 @@
 
     LinkedList<LatLon> getPoints() {
-        if (simplePoints!=null) return simplePoints; else return points;
+        if (simplePoints != null) return simplePoints; else return points;
     }
 
     boolean wasSimplified() {
-        return (simplePoints!=null && simplePoints.size()>0);
+        return (simplePoints != null && simplePoints.size() > 0);
     }
 
     int findClosestPoint(Point p, double d) {
-        double x=p.x, y=p.y;
-        int n=points.size();
-        int idx=-1;
-        double dist,minD=1e10;
-        for (int i=0;i<n;i++) {
-            dist = Math.sqrt(getPoint(points.get(i)).distanceSq(x,y));
-            if (dist<d && dist<minD) {
-                idx=i;
-                minD=dist;
-            };
+        double x = p.x, y = p.y;
+        int n = points.size();
+        int idx = -1;
+        double dist, minD = 1e10;
+        for (int i = 0; i < n; i++) {
+            dist = Math.sqrt(getPoint(points.get(i)).distanceSq(x, y));
+            if (dist < d && dist < minD) {
+                idx = i;
+                minD = dist;
+            }
         }
         return idx;
@@ -74,16 +76,16 @@
     void clear() {
         points.clear();
-        used=null;
-        lastIdx=0;
-        closedFlag=false;
+        used = null;
+        lastIdx = 0;
+        closedFlag = false;
         fixed.clear();
-        simplePoints=null;
+        simplePoints = null;
     }
 
     void undo() {
         //if (points.size() > 0) points.removeLast();
-        if (lastIdx>0 && lastIdx<points.size()){
-        points.remove(lastIdx);
-        lastIdx--;
+        if (lastIdx > 0 && lastIdx < points.size()) {
+            points.remove(lastIdx);
+            lastIdx--;
         }
     }
@@ -103,11 +105,11 @@
 
     void addLast(LatLon coor) {
-        if (closedFlag && lastIdx>points.size()-1) return;
-        if (lastIdx>=points.size()-1) {
+        if (closedFlag && lastIdx > points.size()-1) return;
+        if (lastIdx >= points.size()-1) {
             //
             if (points.isEmpty() || !coor.equals(points.getLast())) {
                 points.addLast(coor);
-                if (points.size()>1) lastIdx++;
-                }
+                if (points.size() > 1) lastIdx++;
+            }
         } else {
             // insert point into midlle of the line
@@ -120,5 +122,5 @@
 
     Point getLastPoint() {
-        if (lastIdx<points.size()) return getPoint(points.get(lastIdx));
+        if (lastIdx < points.size()) return getPoint(points.get(lastIdx));
         else return null;
     }
@@ -129,5 +131,5 @@
 
     int getSimplePointsCount() {
-        if (simplePoints!=null)return simplePoints.size(); else return -1;
+        if (simplePoints != null) return simplePoints.size(); else return -1;
     }
 
@@ -135,13 +137,13 @@
      * Increase epsilon to fit points count in maxPKM point per 1 km
      */
-    double autoSimplify(double initEpsilon,double ekf,int k,double maxPKM) {
-        double e=initEpsilon;
-        if (e<1e-3) e=1e-3;
-        if (ekf<1+1e-2) ekf=1.01;
+    double autoSimplify(double initEpsilon, double ekf, int k, double maxPKM) {
+        double e = initEpsilon;
+        if (e < 1e-3) e = 1e-3;
+        if (ekf < 1+1e-2) ekf = 1.01;
         simplify(e);
-        while (getNodesPerKm(k)>maxPKM && e<1e3) {
-             e=e*ekf;
-             simplify(e);
-             //System.out.printf("eps=%f n=%d\n", e,simplePoints.size());
+        while (getNodesPerKm(k) > maxPKM && e < 1e3) {
+            e = e*ekf;
+            simplify(e);
+            //System.out.printf("eps=%f n=%d\n", e,simplePoints.size());
         }
         return e;
@@ -217,11 +219,11 @@
      */
     public double pointLineDistance(Point p1, Point p2, Point p3) {
-        double x0 = p1.x;        double y0 = p1.y;
-        double x1 = p2.x;        double y1 = p2.y;
-        double x2 = p3.x;        double y2 = p3.y;
+        double x0 = p1.x; double y0 = p1.y;
+        double x1 = p2.x; double y1 = p2.y;
+        double x2 = p3.x; double y2 = p3.y;
         if (x2 == x1 && y2 == y1) {
             return Math.hypot(x1 - x0, y1 - y0);
         } else {
-            return Math.abs((x2-x1)*(y1-y0)-(x1-x0)*(y2-y1))/Math.hypot(x2 - x1,y2 - y1);
+            return Math.abs((x2-x1)*(y1-y0)-(x1-x0)*(y2-y1))/Math.hypot(x2 - x1, y2 - y1);
         }
     }
@@ -229,6 +231,7 @@
     void closeLine() {
         points.add(points.getFirst());
-        closedFlag=true;
-    }
+        closedFlag = true;
+    }
+
     boolean isClosed() {
         return closedFlag;
@@ -236,28 +239,30 @@
 
     void deleteNode(int idx) {
-        if (idx<=lastIdx) lastIdx--;
+        if (idx <= lastIdx) lastIdx--;
         fixed.remove(points.get(idx));
         points.remove(idx);
     }
+
     void tryToDeleteSegment(Point p) {
-        if (points.size()<3) return;
+        if (points.size() < 3) return;
 
         LatLon start;
         start = findBigSegment(p);
-        ListIterator<LatLon> it= points.listIterator();
+        ListIterator<LatLon> it = points.listIterator();
         LatLon pp;
-        boolean f=false;
-        int i=0,idx=-1;
+        boolean f = false;
+        int i = 0, idx = -1;
         while (it.hasNext()) {
-            pp=it.next();
-            if (f &&(fixed.contains(pp))) {
+            pp = it.next();
+            if (f && (fixed.contains(pp))) {
                 // if end of line fragment reached
-                lastIdx=idx;
+                lastIdx = idx;
                 return;
-            }if (f &&(!it.hasNext())) {
+            }
+            if (f && !it.hasNext()) {
                 // if end of whole line reached
-                closedFlag=false;
+                closedFlag = false;
                 it.remove();
-                lastIdx=points.size()-1;
+                lastIdx = points.size()-1;
                 return;
             }
@@ -265,47 +270,51 @@
             // if we are deleting this segment
             if (f) it.remove();
-            if (pp == start) {f=true;idx=i;} // next node should be removed
+            if (pp == start) {
+                f = true;
+                idx = i;
+            } // next node should be removed
             i++;
         }
-        lastIdx=points.size()-1;
-        }
+        lastIdx = points.size()-1;
+    }
 
     /** find starting point of the polyline line fragment close to p
      *  line fragment = segments between two fixed (green) nodes
-     * @param p
-     * @return
      */
     LatLon findBigSegment(Point p) {
-        if (points.size()<2) return null;
+        if (points.size() < 2) return null;
         Iterator<LatLon> it1 = points.listIterator(0);
         Iterator<LatLon> it2 = points.listIterator(1);
-        Point p1,p2;
-        LatLon pp1,pp2,start=null;
-        start=points.getFirst();
+        Point p1, p2;
+        LatLon pp1, pp2, start = null;
+        start = points.getFirst();
         do {
-        pp1=it1.next();
-        pp2=it2.next();
-        p1 = getPoint(pp1);
-        p2 = getPoint(pp2);
-        // maintain segment start end end
-        if (fixed.contains(pp1) ) { start=pp1; }
-        if (pointSegmentDistance(p,p1,p2) < 5) {
-            return start;
-        }
+            pp1 = it1.next();
+            pp2 = it2.next();
+            p1 = getPoint(pp1);
+            p2 = getPoint(pp2);
+            // maintain segment start end end
+            if (fixed.contains(pp1)) {
+                start = pp1;
+            }
+            if (pointSegmentDistance(p, p1, p2) < 5) {
+                return start;
+            }
         } while (it2.hasNext());
         return null;
-
     }
 
     private double pointSegmentDistance(Point p, Point p1, Point p2) {
-        double a,b,x,y,l,kt,kn,dist;
-        x=p.x-p1.x; y=p.y-p1.y;
-        a=p2.x-p1.x; b=p2.y-p1.y;
-        l=Math.hypot(a,b);
-        if (l==0) return Math.hypot(x, y); // p1 = p2
-        kt=(x*a+y*b)/l;
-        kn=Math.abs((-x*b+y*a)/l);
-        if (kt>=0 && kt<l) dist=kn; else {
-            dist=Math.min(Math.hypot(x, y), Math.hypot(x-a, y-b));
+        double a, b, x, y, l, kt, kn, dist;
+        x = p.x-p1.x;
+        y = p.y-p1.y;
+        a = p2.x-p1.x;
+        b = p2.y-p1.y;
+        l = Math.hypot(a, b);
+        if (l == 0) return Math.hypot(x, y); // p1 = p2
+        kt = (x*a+y*b)/l;
+        kn = Math.abs((-x*b+y*a)/l);
+        if (kt >= 0 && kt < l) dist = kn; else {
+            dist = Math.min(Math.hypot(x, y), Math.hypot(x-a, y-b));
         }
         return dist;
@@ -313,13 +322,13 @@
 
     void clearSimplifiedVersion() {
-        simplePoints=null;
+        simplePoints = null;
     }
 
     boolean isLastPoint(int i) {
-        return (lastIdx==i);
+        return (lastIdx == i);
     }
 
     void moveToTheEnd() {
-        lastIdx=points.size()-1;
+        lastIdx = points.size()-1;
     }
 
@@ -341,7 +350,7 @@
         }
         if (fixed.contains(dragged)) {
-                fixed.remove(dragged);
-                fixed.add(coor);
-         }
+            fixed.remove(dragged);
+            fixed.add(coor);
+        }
     }
 
@@ -353,38 +362,41 @@
     public double getNodesPerKm(int k) {
         List<LatLon> pts = simplePoints;
-        if (!wasSimplified()) pts=points;
-        int n=pts.size();
-        if (n<2) return 0;
-        if (k<2) k=2;
-        if (k>n) k=n;
-
-        LatLon pp1, pp2=null;
-        Iterator<LatLon> it1,it2;
-        it1=pts.listIterator(0);
-        it2=pts.listIterator(1);
-        double lens[]=new double[n];
+        if (!wasSimplified()) pts = points;
+        int n = pts.size();
+        if (n < 2) return 0;
+        if (k < 2) k = 2;
+        if (k > n) k = n;
+
+        LatLon pp1, pp2 = null;
+        Iterator<LatLon> it1, it2;
+        it1 = pts.listIterator(0);
+        it2 = pts.listIterator(1);
+        double[] lens = new double[n];
         for (int i = 0; i < n-1; i++) {
-                pp1 = it1.next();
-                //p1 = getPoint(pp1);
-                pp2 = it2.next();
-                //p2 =sa getPoint(pp2);
-                lens[i]=pp1.greatCircleDistance(pp2);
-            }
-        double pkm=0,maxpkm=0;
-        double len=0;
-        int seg=0; // averaged segments counts
+            pp1 = it1.next();
+            //p1 = getPoint(pp1);
+            pp2 = it2.next();
+            //p2 =sa getPoint(pp2);
+            lens[i] = pp1.greatCircleDistance(pp2);
+        }
+        double pkm = 0, maxpkm = 0;
+        double len = 0;
+        int seg = 0; // averaged segments counts
         for (int i = 1; i < n; i++) {
-                len+=lens[i-1]; // add next next point
-                // remove old segment
-                if (i>k) {seg=k; len-=lens[i-k-1];} else seg=i;
-                if (i>=k || i==n-1) {
-                    // len is length of points[i-windowSize] .. points[i]
-                    if (len>0) pkm = seg / len * 1000;
-                    //System.out.println("i="+i+" pkm="+len+" pkm="+pkm);
-                    if (pkm > maxpkm) maxpkm=pkm;
-                }
-            }
+            len += lens[i-1]; // add next next point
+            // remove old segment
+            if (i > k) {
+                seg = k;
+                len -= lens[i-k-1];
+            } else
+                seg = i;
+            if (i >= k || i == n-1) {
+                // len is length of points[i-windowSize] .. points[i]
+                if (len > 0) pkm = seg / len * 1000;
+                //System.out.println("i="+i+" pkm="+len+" pkm="+pkm);
+                if (pkm > maxpkm) maxpkm = pkm;
+            }
+        }
         return Math.round(maxpkm);
-
     }
 
@@ -392,4 +404,3 @@
         return points.size();
     }
-
 }
Index: /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java
===================================================================
--- /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java	(revision 32547)
+++ /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java	(revision 32548)
@@ -1,10 +1,13 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.plugins.fastdraw;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.Color;
 import java.awt.Stroke;
 import java.io.IOException;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.util.GuiHelper;
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 public class FDSettings {
@@ -15,5 +18,5 @@
     public Color COLOR_EDITEDFRAGMENT;
     public Color COLOR_SIMPLIFIED;
-    
+
     public double maxDist;
     public double epsilonMult;
@@ -22,5 +25,5 @@
     public double minPixelsBetweenPoints;
     /// Initial tolerance for Douglas-Pecker algorithm
-    public double startingEps;    
+    public double startingEps;
     /// Maximum number of points per 1 km of way
     public double maxPointsPerKm;
@@ -28,7 +31,7 @@
     public boolean drawLastSegment;
     // snap to nodes
-    public boolean snapNodes; 
+    public boolean snapNodes;
     // add fixed foints on mouse click
-    public boolean fixedClick; 
+    public boolean fixedClick;
     // add fixed foints on spacebar
     public boolean fixedSpacebar;
@@ -46,5 +49,5 @@
     public int dotSize;
     public int bigDotSize;
-    
+
     public void loadPrefs() {
         COLOR_DELETE = Main.pref.getColor("fastdraw.color.delete", Color.red);
@@ -54,12 +57,12 @@
         COLOR_SELECTEDFRAGMENT = Main.pref.getColor("fastdraw.color.select", Color.blue);
         COLOR_SIMPLIFIED = Main.pref.getColor("fastdraw.color.simplified", Color.orange);
-        
+
         normalStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.normal", "2"));
         deleteStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.delete", "3"));
         simplifiedStroke = GuiHelper.getCustomizedStroke(Main.pref.get("fastdraw.stroke.simplified", "2"));
-        
+
         bigDotSize = Main.pref.getInteger("fastdraw.point.bigsize", 7);
         dotSize = Main.pref.getInteger("fastdraw.point.normalsize", 5);
-        
+
         maxDist = Main.pref.getDouble("fastdraw.maxdist", 5);
         epsilonMult = Main.pref.getDouble("fastdraw.epsilonmult", 1.1);
@@ -73,5 +76,5 @@
         fixedClick = Main.pref.getBoolean("fastdraw.fixedclick", false);
         fixedSpacebar = Main.pref.getBoolean("fastdraw.fixedspacebar", false);
-        drawClosed =  Main.pref.getBoolean("fastdraw.drawclosed", false);
+        drawClosed = Main.pref.getBoolean("fastdraw.drawclosed", false);
         simplifyMode = Main.pref.getInteger("fastdraw.simplifymode", 0) % 3;
         allowEditExistingWays = Main.pref.getBoolean("fastdraw.alloweditexisting", false);
@@ -81,22 +84,24 @@
 
     public void savePrefs() {
-         Main.pref.putDouble("fastdraw.maxdist", maxDist);
-         Main.pref.putDouble("fastdraw.epsilonmult", epsilonMult);
-         //Main.pref.putDouble("fastdraw.deltasearch", deltaLatLon);
-         Main.pref.putDouble("fastdraw.mindelta",minPixelsBetweenPoints);
-         Main.pref.putDouble("fastdraw.startingEps",startingEps);
-         Main.pref.putDouble("fastdraw.maxpkm",maxPointsPerKm);
-         Main.pref.putInteger("fastdraw.pkmblocksize",pkmBlockSize);
-         Main.pref.put("fastdraw.drawlastsegment",drawLastSegment);
-         Main.pref.put("fastdraw.snapnodes", snapNodes);
-         Main.pref.put("fastdraw.fixedclick", fixedClick);
-         Main.pref.put("fastdraw.fixedspacebar", fixedSpacebar);
-         Main.pref.put("fastdraw.drawclosed", drawClosed);
-         Main.pref.putInteger("fastdraw.simplifymode", simplifyMode);
-         Main.pref.put("fastdraw.autotags", autoTags);
-         Main.pref.put("fastdraw.alloweditexisting", allowEditExistingWays);
-         try {Main.pref.save();} catch (IOException e) {
-             System.err.println(tr("Can not save preferences"));
-         }
+        Main.pref.putDouble("fastdraw.maxdist", maxDist);
+        Main.pref.putDouble("fastdraw.epsilonmult", epsilonMult);
+        //Main.pref.putDouble("fastdraw.deltasearch", deltaLatLon);
+        Main.pref.putDouble("fastdraw.mindelta", minPixelsBetweenPoints);
+        Main.pref.putDouble("fastdraw.startingEps", startingEps);
+        Main.pref.putDouble("fastdraw.maxpkm", maxPointsPerKm);
+        Main.pref.putInteger("fastdraw.pkmblocksize", pkmBlockSize);
+        Main.pref.put("fastdraw.drawlastsegment", drawLastSegment);
+        Main.pref.put("fastdraw.snapnodes", snapNodes);
+        Main.pref.put("fastdraw.fixedclick", fixedClick);
+        Main.pref.put("fastdraw.fixedspacebar", fixedSpacebar);
+        Main.pref.put("fastdraw.drawclosed", drawClosed);
+        Main.pref.putInteger("fastdraw.simplifymode", simplifyMode);
+        Main.pref.put("fastdraw.autotags", autoTags);
+        Main.pref.put("fastdraw.alloweditexisting", allowEditExistingWays);
+        try {
+            Main.pref.save();
+        } catch (IOException e) {
+            System.err.println(tr("Can not save preferences"));
+        }
     }
 }
Index: /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java
===================================================================
--- /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java	(revision 32547)
+++ /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java	(revision 32548)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.plugins.fastdraw;
 
@@ -28,15 +29,15 @@
 public class FastDrawConfigDialog extends ExtendedDialog {
 
-    private final JLabel label1=new JLabel(tr("Epsilon multiplier"));
-    private final JLabel label2=new JLabel(tr("Starting Epsilon"));
-    private final JLabel label3=new JLabel(tr("Max points count per 1 km"));
-    private final JLabel label4=new JLabel(/* I18n: Combobox to select what a press to return key does */ tr("Enter key mode"));
-    private final JLabel label5=new JLabel(tr("Auto add tags"));
-    private final JFormattedTextField text1=new JFormattedTextField(NumberFormat.getInstance());
-    private final JFormattedTextField text2=new  JFormattedTextField(NumberFormat.getInstance());
-    private final JFormattedTextField text3=new  JFormattedTextField(NumberFormat.getInstance());
-    private final JComboBox<String> combo1=new JComboBox<>(new String[]{tr("Autosimplify"),
-        tr("Simplify with initial epsilon"),tr("Save as is")});
-    private final JCheckBox snapCb=new JCheckBox(tr("Snap to nodes"));
+    private final JLabel label1 = new JLabel(tr("Epsilon multiplier"));
+    private final JLabel label2 = new JLabel(tr("Starting Epsilon"));
+    private final JLabel label3 = new JLabel(tr("Max points count per 1 km"));
+    private final JLabel label4 = new JLabel(/* I18n: Combobox to select what a press to return key does */ tr("Enter key mode"));
+    private final JLabel label5 = new JLabel(tr("Auto add tags"));
+    private final JFormattedTextField text1 = new JFormattedTextField(NumberFormat.getInstance());
+    private final JFormattedTextField text2 = new JFormattedTextField(NumberFormat.getInstance());
+    private final JFormattedTextField text3 = new JFormattedTextField(NumberFormat.getInstance());
+    private final JComboBox<String> combo1 = new JComboBox<>(new String[]{tr("Autosimplify"),
+            tr("Simplify with initial epsilon"), tr("Save as is")});
+    private final JCheckBox snapCb = new JCheckBox(tr("Snap to nodes"));
     private final JCheckBox fixedClickCb = new JCheckBox(tr("Add fixed points on click"));
     private final JCheckBox fixedSpaceCb = new JCheckBox(tr("Add fixed points on spacebar"));
@@ -47,7 +48,7 @@
 
     public FastDrawConfigDialog(FDSettings settings) {
-        super(Main.parent,tr("FastDraw configuration"),new String[] {tr("Ok"), tr("Cancel")});
+        super(Main.parent, tr("FastDraw configuration"), new String[] {tr("Ok"), tr("Cancel")});
         this.settings = settings;
-        
+
         JPanel all = new JPanel();
         GridBagLayout layout = new GridBagLayout();
@@ -57,5 +58,5 @@
             public void actionPerformed(ActionEvent e) {
                 String s = Utils.getClipboardContent();
-                if (TextTagParser.getValidatedTagsFromText(s)!=null) {
+                if (TextTagParser.getValidatedTagsFromText(s) != null) {
                     addTags.setText(s);
                 }
@@ -63,31 +64,31 @@
         });
         pasteButton.setToolTipText(tr("Try copying tags from properties table"));
-        
+
         ArrayList<String> history = new ArrayList<>(Main.pref.getCollection("fastdraw.tags-history"));
         while (history.remove("")) { };
         addTags.setPossibleItems(history);
-        
-        all.add(label1,GBC.std().insets(10,0,0,0));
-        all.add(text1, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
-        all.add(label2,GBC.std().insets(10,0,0,0));
-        all.add(text2, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
-        all.add(label3,GBC.std().insets(10,0,0,0));
-        all.add(text3, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
-        all.add(label4,GBC.std().insets(10,0,0,0));
-        all.add(combo1, GBC.eop().fill(GBC.HORIZONTAL).insets(5,0,0,5));
-        
-        all.add(label5,GBC.std().insets(10,0,0,0));
-        all.add(pasteButton, GBC.eop().insets(0,0,0,5));
-        
-        all.add(addTags, GBC.eop().fill(GBC.HORIZONTAL).insets(10,0,5,10));
-        
-        all.add(snapCb,GBC.eop().insets(20,0,0,0));
-        
-        all.add(fixedClickCb,GBC.eop().insets(20,0,0,0));
-        all.add(fixedSpaceCb,GBC.eop().insets(20,0,0,0));
-        all.add(drawClosedCb,GBC.eop().insets(20,0,0,0));
-        
-        all.add(allowEditExistingWaysCb,GBC.eop().insets(20,0,0,0));
-        
+
+        all.add(label1, GBC.std().insets(10, 0, 0, 0));
+        all.add(text1, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 5));
+        all.add(label2, GBC.std().insets(10, 0, 0, 0));
+        all.add(text2, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 5));
+        all.add(label3, GBC.std().insets(10, 0, 0, 0));
+        all.add(text3, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 5));
+        all.add(label4, GBC.std().insets(10, 0, 0, 0));
+        all.add(combo1, GBC.eop().fill(GBC.HORIZONTAL).insets(5, 0, 0, 5));
+
+        all.add(label5, GBC.std().insets(10, 0, 0, 0));
+        all.add(pasteButton, GBC.eop().insets(0, 0, 0, 5));
+
+        all.add(addTags, GBC.eop().fill(GBC.HORIZONTAL).insets(10, 0, 5, 10));
+
+        all.add(snapCb, GBC.eop().insets(20, 0, 0, 0));
+
+        all.add(fixedClickCb, GBC.eop().insets(20, 0, 0, 0));
+        all.add(fixedSpaceCb, GBC.eop().insets(20, 0, 0, 0));
+        all.add(drawClosedCb, GBC.eop().insets(20, 0, 0, 0));
+
+        all.add(allowEditExistingWaysCb, GBC.eop().insets(20, 0, 0, 0));
+
         addTags.setText(settings.autoTags);
         text1.setValue(settings.epsilonMult);
@@ -100,5 +101,5 @@
         allowEditExistingWaysCb.setSelected(settings.allowEditExistingWays);
         combo1.setSelectedIndex(settings.simplifyMode);
-        
+
         setContent(all, false);
         setButtonIcons(new String[] {"ok.png", "cancel.png"});
@@ -116,14 +117,14 @@
         if (getValue() == 1) {
             try {
-                settings.epsilonMult=NumberFormat.getInstance().parse(text1.getText()).doubleValue();
-                settings.startingEps=NumberFormat.getInstance().parse(text2.getText()).doubleValue();
-                settings.maxPointsPerKm=NumberFormat.getInstance().parse(text3.getText()).doubleValue();
-                settings.snapNodes=snapCb.isSelected();
-                settings.fixedClick=fixedClickCb.isSelected();
-                settings.fixedSpacebar=fixedSpaceCb.isSelected();
-                settings.allowEditExistingWays=allowEditExistingWaysCb.isSelected();
-                settings.drawClosed=drawClosedCb.isSelected();
-                settings.simplifyMode=combo1.getSelectedIndex();
-                settings.autoTags=addTags.getText();
+                settings.epsilonMult = NumberFormat.getInstance().parse(text1.getText()).doubleValue();
+                settings.startingEps = NumberFormat.getInstance().parse(text2.getText()).doubleValue();
+                settings.maxPointsPerKm = NumberFormat.getInstance().parse(text3.getText()).doubleValue();
+                settings.snapNodes = snapCb.isSelected();
+                settings.fixedClick = fixedClickCb.isSelected();
+                settings.fixedSpacebar = fixedSpaceCb.isSelected();
+                settings.allowEditExistingWays = allowEditExistingWaysCb.isSelected();
+                settings.drawClosed = drawClosedCb.isSelected();
+                settings.simplifyMode = combo1.getSelectedIndex();
+                settings.autoTags = addTags.getText();
                 if (!settings.autoTags.isEmpty()) {
                     addTags.addCurrentItemToHistory();
@@ -132,11 +133,9 @@
                 settings.savePrefs();
             } catch (ParseException e) {
-              JOptionPane.showMessageDialog(Main.parent,
-                  tr("Can not read settings"));
+                JOptionPane.showMessageDialog(Main.parent,
+                        tr("Can not read settings"));
             }
         }
         return result;
-        
     }
-    
 }
Index: /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
===================================================================
--- /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java	(revision 32547)
+++ /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java	(revision 32548)
@@ -1,8 +1,3 @@
-/*
- * Licence: GPL v2 or later
- * Author:  Alexei Kasatkin, 2011
- * Thanks to authors of BuildingTools, ImproveWayAccuracy and LakeWalker
- * for good sample code
- */
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.plugins.fastdraw;
 
@@ -52,10 +47,11 @@
 import org.openstreetmap.josm.tools.TextTagParser;
 
-class FastDrawingMode extends MapMode implements MapViewPaintable,
-        KeyPressReleaseListener, ModifierListener {
-    private static final String SIMPLIFYMODE_MESSAGE=
+class FastDrawingMode extends MapMode implements MapViewPaintable, KeyPressReleaseListener, ModifierListener {
+    // CHECKSTYLE.OFF: LineLength
+    private static final String SIMPLIFYMODE_MESSAGE =
             tr("Q=Options, Enter=save, Ctrl-Enter=save with tags, Up/Down=tune");
-    private static final String DRAWINGMODE_MESSAGE=
-    tr("Click or Click&drag to continue, Ctrl-Click to add fixed node, Shift-Click to delete, Enter to simplify or save, Ctrl-Shift-Click to start new line");
+    private static final String DRAWINGMODE_MESSAGE =
+            tr("Click or Click&drag to continue, Ctrl-Click to add fixed node, Shift-Click to delete, Enter to simplify or save, Ctrl-Shift-Click to start new line");
+    // CHECKSTYLE.ON: LineLength
 
     private FDSettings settings;
@@ -75,16 +71,16 @@
     private LatLon highlightedFragmentStart;
     private int nearestPointIndex;
-    private int dragNode=-1;
+    private int dragNode = -1;
     private List<Node> oldNodes;
-    
+
     private boolean lineWasSaved;
     private boolean deltaChanged;
     private Way oldWay;
-    
+
     FastDrawingMode(MapFrame mapFrame) {
-        super(tr("FastDrawing"), "turbopen.png", tr("Fast drawing mode"), 
-		Shortcut.registerShortcut("mapmode:fastdraw", tr("Mode: {0}", tr("Fast drawing mode")), KeyEvent.VK_F, Shortcut.SHIFT)
-		,mapFrame, Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
-        line=new DrawnPolyLine();
+        super(tr("FastDrawing"), "turbopen.png", tr("Fast drawing mode"),
+                Shortcut.registerShortcut("mapmode:fastdraw", tr("Mode: {0}", tr("Fast drawing mode")), KeyEvent.VK_F, Shortcut.SHIFT),
+                mapFrame, Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+        line = new DrawnPolyLine();
         cursorDraw = ImageProvider.getCursor("crosshair", null);
         cursorCtrl = ImageProvider.getCursor("crosshair", "fixed");
@@ -96,5 +92,5 @@
     }
 
-// <editor-fold defaultstate="collapsed" desc="Event listeners">
+    // <editor-fold defaultstate="collapsed" desc="Event listeners">
 
     @Override
@@ -102,13 +98,13 @@
         if (!isEnabled()) return;
         super.enterMode();
-        lineWasSaved=false;
-        settings=new FDSettings();
+        lineWasSaved = false;
+        settings = new FDSettings();
         settings.loadPrefs();
         settings.savePrefs();
 
-        eps=settings.startingEps;
+        eps = settings.startingEps;
         mv = Main.map.mapView;
         line.setMv(mv);
-        
+
         if (getLayerManager().getEditDataSet() == null) return;
 
@@ -116,5 +112,5 @@
         Main.map.mapView.addMouseMotionListener(this);
         Main.map.mapView.addTemporaryLayer(this);
-        
+
         Main.map.keyDetector.addKeyListener(this);
         Main.map.keyDetector.addModifierListener(this);
@@ -130,5 +126,5 @@
 
         Main.map.mapView.removeTemporaryLayer(this);
-        
+
         Main.map.keyDetector.removeKeyListener(this);
         Main.map.keyDetector.removeModifierListener(this);
@@ -149,10 +145,10 @@
     }
 
-    private final ArrayList<Point> fixedPoints =new ArrayList<>(3000); // tamporyrary storate for paint
-    
+    private final ArrayList<Point> fixedPoints = new ArrayList<>(3000); // temporary storate for paint
+
     //////////    Event listener methods
     @Override
     public void paint(Graphics2D g, MapView mv, Bounds bbox) {
-        LinkedList<LatLon> pts=line.getPoints();
+        LinkedList<LatLon> pts = line.getPoints();
         if (pts.isEmpty()) return;
 
@@ -163,5 +159,5 @@
             g.setStroke(settings.normalStroke);
         }
-        
+
         int bigDotSize = settings.bigDotSize;
 
@@ -171,13 +167,13 @@
         g.setColor(settings.COLOR_FIXED);
         g.fillOval(p1.x - bigDotSize/2, p1.y - bigDotSize/2, bigDotSize, bigDotSize);
-        Color lineColor,initLineColor;
-        initLineColor = line.wasSimplified() ? settings.COLOR_SIMPLIFIED: settings.COLOR_NORMAL;
+        Color lineColor, initLineColor;
+        initLineColor = line.wasSimplified() ? settings.COLOR_SIMPLIFIED : settings.COLOR_NORMAL;
         lineColor = initLineColor;
-        int rp,dp;
-        dp=line.wasSimplified() ? settings.bigDotSize : settings.dotSize;  rp=dp/2;
+        int rp, dp;
+        dp = line.wasSimplified() ? settings.bigDotSize : settings.dotSize; rp = dp/2;
         if (pts.size() > 1) {
-            Iterator<LatLon> it1,it2;
-            it1=pts.listIterator(0);
-            it2=pts.listIterator(1);
+            Iterator<LatLon> it1, it2;
+            it1 = pts.listIterator(0);
+            it2 = pts.listIterator(1);
             fixedPoints.clear();
             for (int i = 0; i < pts.size() - 1; i++) {
@@ -186,10 +182,14 @@
                 pp2 = it2.next();
                 p2 = line.getPoint(pp2);
-                if (shift && highlightedFragmentStart==pp1 && nearestPointIndex<0) {lineColor=settings.COLOR_SELECTEDFRAGMENT;}
-                if (!shift && line.isLastPoint(i)) { lineColor=settings.COLOR_EDITEDFRAGMENT; }
+                if (shift && highlightedFragmentStart == pp1 && nearestPointIndex < 0) {
+                    lineColor = settings.COLOR_SELECTEDFRAGMENT;
+                }
+                if (!shift && line.isLastPoint(i)) {
+                    lineColor = settings.COLOR_EDITEDFRAGMENT;
+                }
                 g.setColor(lineColor);
                 g.drawLine(p1.x, p1.y, p2.x, p2.y);
-                if (line.isFixed(pp2)) { 
-                    lineColor=initLineColor;
+                if (line.isFixed(pp2)) {
+                    lineColor = initLineColor;
                     fixedPoints.add(p2);
                 } else {
@@ -197,19 +197,19 @@
                 }
                 if (!drawing) {
-                    if (!line.wasSimplified() && nearestPointIndex==i+1 ) {
-                    if (shift) {
-                        // highlight node to delete
-                        g.setStroke(settings.deleteStroke);
-                        g.setColor(settings.COLOR_DELETE);
-                        g.drawLine(p2.x - 5, p2.y - 5,p2.x + 5, p2.y + 5);
-                        g.drawLine(p2.x - 5, p2.y + 5,p2.x + 5, p2.y - 5);
-                        g.setStroke(settings.normalStroke);
-                    } else if (ctrl) {
-                        // highlight node to toggle fixation
-                        g.setStroke(settings.deleteStroke);
-                        g.setColor( line.isFixed(pp2) ? settings.COLOR_NORMAL: settings.COLOR_FIXED);
-                        g.fillOval(p2.x - bigDotSize/2-2, p2.y - bigDotSize/2-2, bigDotSize+4, bigDotSize+4);
-                        g.setStroke(settings.normalStroke);
-                    } 
+                    if (!line.wasSimplified() && nearestPointIndex == i+1) {
+                        if (shift) {
+                            // highlight node to delete
+                            g.setStroke(settings.deleteStroke);
+                            g.setColor(settings.COLOR_DELETE);
+                            g.drawLine(p2.x - 5, p2.y - 5, p2.x + 5, p2.y + 5);
+                            g.drawLine(p2.x - 5, p2.y + 5, p2.x + 5, p2.y - 5);
+                            g.setStroke(settings.normalStroke);
+                        } else if (ctrl) {
+                            // highlight node to toggle fixation
+                            g.setStroke(settings.deleteStroke);
+                            g.setColor(line.isFixed(pp2) ? settings.COLOR_NORMAL : settings.COLOR_FIXED);
+                            g.fillOval(p2.x - bigDotSize/2-2, p2.y - bigDotSize/2-2, bigDotSize+4, bigDotSize+4);
+                            g.setStroke(settings.normalStroke);
+                        }
                     }
                 }
@@ -220,20 +220,19 @@
             }
         }
-        if (settings.drawLastSegment && !drawing && dragNode<0  && !shift && 
-                nearestPointIndex<=0 && !line.wasSimplified()) {
+        if (settings.drawLastSegment && !drawing && dragNode < 0 && !shift &&
+                nearestPointIndex <= 0 && !line.wasSimplified()) {
             // draw line to current point
             g.setColor(lineColor);
-            Point lp=line.getLastPoint();
-            Point mp=mv.getMousePosition();
-            if (lp!=null && mp!=null) g.drawLine(lp.x,lp.y,mp.x,mp.y);
+            Point lp = line.getLastPoint();
+            Point mp = mv.getMousePosition();
+            if (lp != null && mp != null) g.drawLine(lp.x, lp.y, mp.x, mp.y);
         }
         if (deltaChanged) {
             g.setColor(lineColor);
-            Point lp=line.getLastPoint();
-            int r=(int) settings.minPixelsBetweenPoints;
-            if (lp!=null) g.drawOval(lp.x-r,lp.y-r,2*r,2*r);
-        }
-    }
-
+            Point lp = line.getLastPoint();
+            int r = (int) settings.minPixelsBetweenPoints;
+            if (lp != null) g.drawOval(lp.x-r, lp.y-r, 2*r, 2*r);
+        }
+    }
 
     @Override
@@ -242,13 +241,13 @@
         if (e.getButton() != MouseEvent.BUTTON1) return;
         updateKeyModifiers(e);
-        
+
         requestFocusInMapView();
 
-        int idx=line.findClosestPoint(e.getPoint(),settings.maxDist);
-        if (idx==0 && !line.isClosed()) {
+        int idx = line.findClosestPoint(e.getPoint(), settings.maxDist);
+        if (idx == 0 && !line.isClosed()) {
             line.closeLine();
             // the way should become closed
-            drawing=false;
-            dragNode=0;
+            drawing = false;
+            dragNode = 0;
             updateCursor();
             return;
@@ -256,11 +255,18 @@
         autoCloseIfNeeded();
 
-        if (ctrl && shift) {newDrawing();repaint();return;}
+        if (ctrl && shift) {
+            newDrawing();
+            repaint();
+            return;
+        }
         if (!ctrl && shift) {
-            if (idx>=0) {line.deleteNode(idx); nearestPointIndex=-1;}
-            else line.tryToDeleteSegment(e.getPoint());
+            if (idx >= 0) {
+                line.deleteNode(idx);
+                nearestPointIndex = -1;
+            } else
+                line.tryToDeleteSegment(e.getPoint());
             return;
         }
-        if (idx>=0) {
+        if (idx >= 0) {
             if (ctrl) {
                 // toggle fixed point
@@ -268,8 +274,8 @@
             }
             // node dragging
-            dragNode=idx;
+            dragNode = idx;
             return;
         }
-        startDrawing(e.getPoint(),settings.fixedClick);
+        startDrawing(e.getPoint(), settings.fixedClick);
     }
 
@@ -277,5 +283,5 @@
         //if (line.isClosed()) { setStatusLine(tr(SIMPLIFYMODE_MESSAGE));return;  }
         drawing = true;
-        if (line.wasSimplified()) { 
+        if (line.wasSimplified()) {
             // new line started after simplification
             // we need to save old line
@@ -288,8 +294,8 @@
         if (settings.snapNodes) { // find existing node near point and use it
             Node nd1 = getNearestNode(point, settings.maxDist);
-            if (nd1!=null) {
+            if (nd1 != null) {
                 // found node, make it fixed point of the line
                 //System.out.println("node "+nd1);
-                p=nd1.getCoor();
+                p = nd1.getCoor();
                 line.fixPoint(p);
             }
@@ -298,5 +304,5 @@
         line.addLast(p);
         if (ctrl || fixFlag) line.fixPoint(p);
-        
+
         setStatusLine(tr("Please move the mouse to draw new way"));
         repaint();
@@ -308,10 +314,10 @@
         stopDrawing();
     }
-    
+
     private void stopDrawing() {
         if (!isEnabled()) return;
         dragNode = -1;
         drawing = false;
-        highlightedFragmentStart=null;
+        highlightedFragmentStart = null;
         if (!line.isClosed()) setStatusLine(DRAWINGMODE_MESSAGE);
         updateCursor();
@@ -328,27 +334,27 @@
         if (!isEnabled()) return;
         updateKeyModifiers(e);
-        deltaChanged=false;
+        deltaChanged = false;
         Node nd1 = getNearestNode(e.getPoint(), settings.maxDist);
-        boolean nearSomeNode2=nd1!=null;
-        boolean needRepaint=false;
-        if (nearSomeNode!=nearSomeNode2) {
-            nearSomeNode=nearSomeNode2;
+        boolean nearSomeNode2 = nd1 != null;
+        boolean needRepaint = false;
+        if (nearSomeNode != nearSomeNode2) {
+            nearSomeNode = nearSomeNode2;
             updateCursor();
-            needRepaint=true;
-        }
-
-        int nearestIdx2=line.findClosestPoint(e.getPoint(),settings.maxDist);
+            needRepaint = true;
+        }
+
+        int nearestIdx2 = line.findClosestPoint(e.getPoint(), settings.maxDist);
         if (nearestPointIndex != nearestIdx2) {
-            nearestPointIndex=nearestIdx2;
+            nearestPointIndex = nearestIdx2;
             updateCursor();
-            needRepaint=true;
+            needRepaint = true;
         }
         if (settings.drawLastSegment) {
-            needRepaint=true;
-        }
-        
+            needRepaint = true;
+        }
+
         if (!drawing) {
-            if (dragNode>=0) {
-                line.moveNode(dragNode,getLatLon(e));
+            if (dragNode >= 0) {
+                line.moveNode(dragNode, getLatLon(e));
                 repaint();
                 return;
@@ -357,11 +363,11 @@
             if (shift && nearestPointIndex == -1) {
                 // find line fragment to highlight
-                LatLon h2=line.findBigSegment(e.getPoint());
-                if (highlightedFragmentStart!=h2) {
-                    highlightedFragmentStart=h2;
-                    needRepaint=true;
-                }
-            }
-            
+                LatLon h2 = line.findBigSegment(e.getPoint());
+                if (highlightedFragmentStart != h2) {
+                    highlightedFragmentStart = h2;
+                    needRepaint = true;
+                }
+            }
+
             if (needRepaint) {
                 repaint();
@@ -372,10 +378,12 @@
 
         // do not draw points close to existing points - we do not want self-intersections
-        if (nearestPointIndex>=0) { return; }
+        if (nearestPointIndex >= 0) {
+            return;
+        }
 
         Point lastP = line.getLastPoint(); // last point of line fragment being edited
 
         // free mouse-drawing
-        if (nearSomeNode){
+        if (nearSomeNode) {
             if (settings.snapNodes && Math.hypot(e.getX() - lastP.x, e.getY() - lastP.y) > 1e-2) {
                 line.addFixed(nd1.getCoor()); // snap to node coords
@@ -405,8 +413,8 @@
                 line.clearSimplifiedVersion();
                 repaint();
-                eps=settings.startingEps;
+                eps = settings.startingEps;
             }
             back();
-        break;
+            break;
         case KeyEvent.VK_ENTER:
             e.consume();
@@ -415,13 +423,13 @@
                 //line.simplify(eps);
                 switch(settings.simplifyMode) {
-                    case 0: //case 1:
-                        eps = line.autoSimplify(settings.startingEps, settings.epsilonMult, 
-                        settings.pkmBlockSize, settings.maxPointsPerKm);
-                        break;
-                    case 1: //case 2: case 3:
-                        line.simplify(eps);
-                        break;
-                }
-                if (settings.simplifyMode==2) {
+                case 0: //case 1:
+                    eps = line.autoSimplify(settings.startingEps, settings.epsilonMult,
+                            settings.pkmBlockSize, settings.maxPointsPerKm);
+                    break;
+                case 1: //case 2: case 3:
+                    line.simplify(eps);
+                    break;
+                }
+                if (settings.simplifyMode == 2) {
                     // autosave
                     saveAsWay(true);
@@ -430,6 +438,8 @@
                     showSimplifyHint();
                 }
-            } else {saveAsWay(true);}
-        break;
+            } else {
+                saveAsWay(true);
+            }
+            break;
         case KeyEvent.VK_DOWN:
             if (ctrl || shift || alt) return;
@@ -438,5 +448,5 @@
             if (line.wasSimplified()) changeEpsilon(settings.epsilonMult);
             else changeDelta(1/1.1);
-        break;
+            break;
         case KeyEvent.VK_UP:
             if (ctrl || shift || alt) return;
@@ -445,17 +455,17 @@
             if (line.wasSimplified()) changeEpsilon(1/settings.epsilonMult);
             else changeDelta(1.1);
-        break;
+            break;
         case KeyEvent.VK_ESCAPE:
             e.consume();
             Point lastPoint = line.getLastPoint();
             if (!line.isClosed()) line.moveToTheEnd();
-            if (lastPoint==null || lastPoint.equals(line.getLastPoint())) {
-                 if (line.getPoints().size()>5) {
+            if (lastPoint == null || lastPoint.equals(line.getLastPoint())) {
+                if (line.getPoints().size() > 5) {
                     boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog(
-                       "delete_drawn_line", Main.parent,
-                       tr("Are you sure you do not want to save the line containing {0} points?",
-                            line.getPoints().size()), tr("Delete confirmation"),
-                       JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_OPTION );
-                    if(!answer) break;
+                            "delete_drawn_line", Main.parent,
+                            tr("Are you sure you do not want to save the line containing {0} points?",
+                                    line.getPoints().size()), tr("Delete confirmation"),
+                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_OPTION);
+                    if (!answer) break;
                 }
                 newDrawing(); // stop drawing
@@ -463,13 +473,13 @@
                 Main.map.selectSelectTool(false);
             }
-        break;
-        
+            break;
+
         case KeyEvent.VK_I:
-           JOptionPane.showMessageDialog(Main.parent,
-                tr("{0} m - length of the line\n{1} nodes\n{2} points per km (maximum)\n{3} points per km (average)",
-                line.getLength(),line.getPoints().size(),line.getNodesPerKm(settings.pkmBlockSize),
-                line.getNodesPerKm(1000000)),
-                tr("Line information"),JOptionPane.INFORMATION_MESSAGE);
-        break;            
+            JOptionPane.showMessageDialog(Main.parent,
+                    tr("{0} m - length of the line\n{1} nodes\n{2} points per km (maximum)\n{3} points per km (average)",
+                            line.getLength(), line.getPoints().size(), line.getNodesPerKm(settings.pkmBlockSize),
+                            line.getNodesPerKm(1000000)),
+                    tr("Line information"), JOptionPane.INFORMATION_MESSAGE);
+            break;
         case KeyEvent.VK_Q:
             // less details
@@ -477,23 +487,23 @@
             new FastDrawConfigDialog(settings).showDialog();
             if (line.wasSimplified()) {
-                eps = line.autoSimplify(settings.startingEps, settings.epsilonMult, settings.pkmBlockSize,settings.maxPointsPerKm);
+                eps = line.autoSimplify(settings.startingEps, settings.epsilonMult, settings.pkmBlockSize, settings.maxPointsPerKm);
                 showSimplifyHint();
             }
             repaint();
-        break;
+            break;
         case KeyEvent.VK_SPACE:
             e.consume();
             if (!drawing) {
                 Point p = Main.map.mapView.getMousePosition();
-                if (p!=null) startDrawing(p,settings.fixedSpacebar);
-            }
-        break;
-        }
-    }
-    
+                if (p != null) startDrawing(p, settings.fixedSpacebar);
+            }
+            break;
+        }
+    }
+
     @Override
     public void doKeyReleased(KeyEvent keyEvent) {
         //System.out.println("released "+keyEvent);
-        if (keyEvent.getKeyCode()==KeyEvent.VK_SPACE) stopDrawing();
+        if (keyEvent.getKeyCode() == KeyEvent.VK_SPACE) stopDrawing();
         updateCursor();
     }
@@ -504,5 +514,5 @@
         updateCursor();
     }
-    
+
     @Override
     protected void updateStatusLine() {
@@ -510,25 +520,25 @@
         Main.map.statusLine.repaint();
     }
-// </editor-fold>
-
-// <editor-fold defaultstate="collapsed" desc="Different action helper methods">
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Different action helper methods">
     public void newDrawing() {
-        oldWay=null; oldNodes=null;
-        eps=settings.startingEps;
+        oldWay = null; oldNodes = null;
+        eps = settings.startingEps;
         line.clear();
     }
-    
+
     private void saveAsWay(boolean autoExit) {
-        List<LatLon> pts=line.getPoints();
+        List<LatLon> pts = line.getPoints();
         int n = pts.size();
         if (n < 2) return; //do not save oversimplified lines
-        if (line.isClosed() && n==2) return;
-        if (line.isClosed() && n==3) pts.remove(2); // two-point way can not be closed
+        if (line.isClosed() && n == 2) return;
+        if (line.isClosed() && n == 3) pts.remove(2); // two-point way can not be closed
 
         Collection<Command> cmds = new LinkedList<>();
         int i = 0;
-        
+
         Way w;
-        if (oldWay==null) {
+        if (oldWay == null) {
             w = new Way();
         } else {
@@ -536,16 +546,16 @@
             w.setNodes(new ArrayList<Node>()); // nodes will be created frosm scratch
         }
-        
-        LatLon first=pts.get(0);
-        Node firstNode=null;
+
+        LatLon first = pts.get(0);
+        Node firstNode = null;
 
         for (LatLon p : pts) {
             Node nd = Main.map.mapView.getNearestNode(line.getPoint(p), OsmPrimitive.isSelectablePredicate);
             // there may be a node with the same coords!
-            
-            if (nd!=null && p.greatCircleDistance(nd.getCoor())>0.01) nd=null;
-            if (nd==null) {
-                if (i>0 && p.equals(first)) {
-                    nd=firstNode;
+
+            if (nd != null && p.greatCircleDistance(nd.getCoor()) > 0.01) nd = null;
+            if (nd == null) {
+                if (i > 0 && p.equals(first)) {
+                    nd = firstNode;
                 } else {
                     nd = new Node(p);
@@ -558,6 +568,6 @@
                 return;
             }
-            if (i==0) {
-                firstNode=nd;
+            if (i == 0) {
+                firstNode = nd;
             }
             w.addNode(nd);
@@ -566,5 +576,5 @@
         if (ctrl) {
             // paste tags - from ctrl-shift-v
-            Set <OsmPrimitive> ts = new HashSet<>();
+            Set<OsmPrimitive> ts = new HashSet<>();
             ts.add(w);
             TagPaster tp = new TagPaster(Main.pasteBuffer.getDirectlyAdded(), ts);
@@ -580,13 +590,13 @@
             }
         }
-        if (oldWay!=null) {
+        if (oldWay != null) {
             List<Node> nodes = w.getNodes();
             cmds.add(new ChangeCommand(oldWay, w));
             for (Node nd: oldNodes) {
-                // node from old way but not in new way 
+                // node from old way but not in new way
                 if (!nodes.contains(nd)) {
                     List<OsmPrimitive> refs = nd.getReferrers();
                     // does someone need this node? if no-delete it.
-                    if (refs.size()==1 && !nd.isDeleted() && nd.isUsable() && !nd.isTagged()) cmds.add(new DeleteCommand(nd));
+                    if (refs.size() == 1 && !nd.isDeleted() && nd.isUsable() && !nd.isTagged()) cmds.add(new DeleteCommand(nd));
                 }
             }
@@ -613,7 +623,7 @@
     void changeEpsilon(double k) {
         //System.out.println(tr("Eps={0}", eps));
-        eps*=k;
+        eps *= k;
         line.simplify(eps);
-        /* I18N: Eps = Epsilon, the tolerance parameter */ 
+        /* I18N: Eps = Epsilon, the tolerance parameter */
         showSimplifyHint();
         repaint();
@@ -621,12 +631,11 @@
 
     void changeDelta(double k) {
-        settings.minPixelsBetweenPoints*=k;
-        deltaChanged=true;
-        
-        setStatusLine(tr("min distance={0} px ({1} m)",(int)settings.minPixelsBetweenPoints,
+        settings.minPixelsBetweenPoints *= k;
+        deltaChanged = true;
+
+        setStatusLine(tr("min distance={0} px ({1} m)", (int) settings.minPixelsBetweenPoints,
                 mv.getDist100Pixel()/100*settings.minPixelsBetweenPoints));
         repaint();
     }
-
 
     /*private Node findClosestNode(LatLon p, double d) {
@@ -648,12 +657,12 @@
 
     private void loadFromWay(Way w) {
-        
+
         Object[] nodes = w.getNodes().toArray();
-        int n=nodes.length;
+        int n = nodes.length;
         if (w.isClosed()) n--;
-        for (int i=0;i<n;i++) {
-            Node nd=(Node) nodes[i];
+        for (int i = 0; i < n; i++) {
+            Node nd = (Node) nodes[i];
             List<OsmPrimitive> refs = nd.getReferrers();
-            if (refs.size()>1 || nd.isTagged()) {
+            if (refs.size() > 1 || nd.isTagged()) {
                 line.addFixed(nd.getCoor());
             } else {
@@ -667,21 +676,21 @@
 
     private void setStatusLine(String tr) {
-        statusText=tr;
+        statusText = tr;
         updateStatusLine();
     }
 
     private void showSimplifyHint() {
-            setStatusLine(tr("Eps={0}, {1} points, {2} p/km", 
-                eps, line.getSimplePointsCount(),line.getNodesPerKm(settings.pkmBlockSize))+" "
-            +SIMPLIFYMODE_MESSAGE);
-    }
-    
+        setStatusLine(tr("Eps={0}, {1} points, {2} p/km",
+                eps, line.getSimplePointsCount(), line.getNodesPerKm(settings.pkmBlockSize))+" "
+                +SIMPLIFYMODE_MESSAGE);
+    }
+
     private void updateCursor() {
         if (shift) Main.map.mapView.setCursor(cursorShift); else
-        if (line.isClosed() || (nearestPointIndex==0)) Main.map.mapView.setCursor(cursorReady); else
-        if (ctrl) Main.map.mapView.setCursor(cursorCtrl); else
-        if (nearSomeNode && settings.snapNodes) Main.map.mapView.setCursor(cursorCtrl); else
-        if (drawing) Main.map.mapView.setCursor(cursorDrawing); else
-        Main.map.mapView.setCursor(cursorDraw);
+            if (line.isClosed() || (nearestPointIndex == 0)) Main.map.mapView.setCursor(cursorReady); else
+                if (ctrl) Main.map.mapView.setCursor(cursorCtrl); else
+                    if (nearSomeNode && settings.snapNodes) Main.map.mapView.setCursor(cursorCtrl); else
+                        if (drawing) Main.map.mapView.setCursor(cursorDrawing); else
+                            Main.map.mapView.setCursor(cursorDraw);
     }
 
@@ -689,14 +698,14 @@
         Main.map.mapView.repaint();
     }
-    
+
     private void tryToLoadWay() {
         updateCursor();
         Collection<Way> selectedWays = Main.getLayerManager().getEditDataSet().getSelectedWays();
-        if (selectedWays!=null // if there is a selection
-            && selectedWays.size()==1 // and one way is selected
-            && line.getPoints().size()==0) /* and ther is no already drawn line */ {
+        if (selectedWays != null // if there is a selection
+                && selectedWays.size() == 1 // and one way is selected
+                && line.getPoints().size() == 0) /* and ther is no already drawn line */ {
             // we can start drawing new way starting from old one
             Way w = selectedWays.iterator().next();
-            
+
             if (w.isNew() || settings.allowEditExistingWays) loadFromWay(w);
         }
@@ -704,16 +713,16 @@
 
     private void autoCloseIfNeeded() {
-        if (settings.drawClosed && line.getPointCount()>1 && !line.isClosed()) {
+        if (settings.drawClosed && line.getPointCount() > 1 && !line.isClosed()) {
             line.closeLine();
         }
     }
-// </editor-fold>
-
-// <editor-fold defaultstate="collapsed" desc="Helper functions">
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Helper functions">
 
     private Node getNearestNode(Point point, double maxDist) {
-       Node nd = Main.map.mapView.getNearestNode(point, OsmPrimitive.isSelectablePredicate);
-       if (nd!=null && line.getPoint(nd.getCoor()).distance(point)<=maxDist) return nd;
-       else return null;
+        Node nd = Main.map.mapView.getNearestNode(point, OsmPrimitive.isSelectablePredicate);
+        if (nd != null && line.getPoint(nd.getCoor()).distance(point) <= maxDist) return nd;
+        else return null;
     }
 
@@ -721,5 +730,4 @@
         return mv.getLatLon(e.getX(), e.getY());
     }
-// </editor-fold>
-
+    // </editor-fold>
 }
Index: /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingPlugin.java
===================================================================
--- /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingPlugin.java	(revision 32547)
+++ /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingPlugin.java	(revision 32548)
@@ -1,9 +1,5 @@
-/*
- * Licence: GPL v2 or later
- * Author:  Alexei Kasatkin, 2011
- * Ideas: Kotelnikov, Michael Barabanov (ticket #3840)
- */
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins.fastdraw;
 
-package org.openstreetmap.josm.plugins.fastdraw;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.IconToggleButton;
@@ -11,4 +7,5 @@
 import org.openstreetmap.josm.plugins.Plugin;
 import org.openstreetmap.josm.plugins.PluginInformation;
+
 public class FastDrawingPlugin extends Plugin {
 
