Index: /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 5511)
+++ /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 5512)
@@ -110,4 +110,5 @@
 
     private Shortcut backspaceShortcut;
+    private BackSpaceAction backspaceAction;
     private final Shortcut snappingShortcut;
 
@@ -118,12 +119,15 @@
     public DrawAction(MapFrame mapFrame) {
         super(tr("Draw"), "node/autonode", tr("Draw nodes"),
-            Shortcut.registerShortcut("mapmode:draw", tr("Mode: {0}", tr("Draw")), KeyEvent.VK_A, Shortcut.DIRECT),
-            mapFrame, ImageProvider.getCursor("crosshair", null));
+                Shortcut.registerShortcut("mapmode:draw", tr("Mode: {0}", tr("Draw")), KeyEvent.VK_A, Shortcut.DIRECT),
+                mapFrame, ImageProvider.getCursor("crosshair", null));
 
         snappingShortcut = Shortcut.registerShortcut("mapmode:drawanglesnapping",
-            tr("Mode: Draw Angle snapping"), KeyEvent.VK_TAB, Shortcut.DIRECT);
+                tr("Mode: Draw Angle snapping"), KeyEvent.VK_TAB, Shortcut.DIRECT);
         snapChangeAction = new SnapChangeAction();
         snapCheckboxMenuItem = addMenuItem();
         snapHelper.setMenuCheckBox(snapCheckboxMenuItem);
+        backspaceShortcut = Shortcut.registerShortcut("mapmode:backspace",
+                tr("Backspace in Add mode"), KeyEvent.VK_BACK_SPACE, Shortcut.DIRECT);
+        backspaceAction = new BackSpaceAction();
         cursorJoinNode = ImageProvider.getCursor("crosshair", "joinnode");
         cursorJoinWay = ImageProvider.getCursor("crosshair", "joinway");
@@ -207,5 +211,5 @@
         snapCheckboxMenuItem.getAction().setEnabled(true);
 
-         timer = new Timer(0, new ActionListener() {
+        timer = new Timer(0, new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent ae) {
@@ -218,7 +222,5 @@
         });
         Main.map.statusLine.getAnglePanel().addMouseListener(snapHelper.anglePopupListener);
-        backspaceShortcut = Shortcut.registerShortcut("mapmode:backspace",
-            tr("Backspace in Add mode"), KeyEvent.VK_BACK_SPACE, Shortcut.DIRECT);
-        Main.registerActionShortcut(new BackSpaceAction(), backspaceShortcut);
+        Main.registerActionShortcut(backspaceAction, backspaceShortcut);
 
         Main.map.mapView.addMouseListener(this);
@@ -242,8 +244,8 @@
         Main.map.mapView.removeTemporaryLayer(this);
         DataSet.removeSelectionListener(this);
-        Main.unregisterShortcut(backspaceShortcut);
+        Main.unregisterActionShortcut(backspaceAction, backspaceShortcut);
         snapHelper.unsetFixedMode();
         snapCheckboxMenuItem.getAction().setEnabled(false);
-        
+
         Main.map.statusLine.getAnglePanel().removeMouseListener(snapHelper.anglePopupListener);
         Main.map.statusLine.activateAnglePanel(false);
@@ -274,6 +276,7 @@
             if (snappingShortcut.isEvent(e) || (useRepeatedShortcut && getShortcut().isEvent(e))) {
                 Component focused = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
-                if (SwingUtilities.getWindowAncestor(focused) instanceof JFrame)
+                if (SwingUtilities.getWindowAncestor(focused) instanceof JFrame) {
                     processKeyEvent(e);
+                }
             }
         } //  toggle angle snapping
@@ -289,7 +292,7 @@
     private Timer timer;
     void processKeyEvent(KeyEvent e) {
-        if (!snappingShortcut.isEvent(e) && !(useRepeatedShortcut && getShortcut().isEvent(e))) 
-            return;
-        
+        if (!snappingShortcut.isEvent(e) && !(useRepeatedShortcut && getShortcut().isEvent(e)))
+            return;
+
         if (e.getID() == KeyEvent.KEY_PRESSED) {
             if (timer.isRunning()) {
@@ -413,5 +416,5 @@
 
         ArrayList<Way> reuseWays = new ArrayList<Way>(),
-        replacedWays = new ArrayList<Way>();
+                replacedWays = new ArrayList<Way>();
         boolean newNode = false;
         Node n = null;
@@ -461,9 +464,9 @@
             if (n.getCoor().isOutSideWorld()) {
                 JOptionPane.showMessageDialog(
-                    Main.parent,
-                    tr("Cannot add a node outside of the world."),
-                    tr("Warning"),
-                    JOptionPane.WARNING_MESSAGE
-                );
+                        Main.parent,
+                        tr("Cannot add a node outside of the world."),
+                        tr("Warning"),
+                        JOptionPane.WARNING_MESSAGE
+                        );
                 return;
             }
@@ -473,5 +476,5 @@
                 // Insert the node into all the nearby way segments
                 List<WaySegment> wss = Main.map.mapView.getNearestWaySegments(
-                    Main.map.mapView.getPoint(n), OsmPrimitive.isSelectablePredicate);
+                        Main.map.mapView.getPoint(n), OsmPrimitive.isSelectablePredicate);
                 if (snapHelper.isActive()) {
                     tryToMoveNodeOnIntersection(wss,n);
@@ -804,5 +807,7 @@
 
         determineCurrentBaseNodeAndPreviousNode(selection);
-        if (previousNode == null) snapHelper.noSnapNow();
+        if (previousNode == null) {
+            snapHelper.noSnapNow();
+        }
 
         if (currentBaseNode == null || currentBaseNode == currentMouseNode)
@@ -811,9 +816,9 @@
 
         double curHdg = Math.toDegrees(currentBaseNode.getEastNorth()
-            .heading(currentMouseEastNorth));
+                .heading(currentMouseEastNorth));
         double baseHdg=-1;
         if (previousNode != null) {
             baseHdg =  Math.toDegrees(previousNode.getEastNorth()
-                .heading(currentBaseNode.getEastNorth()));
+                    .heading(currentBaseNode.getEastNorth()));
         }
 
@@ -869,10 +874,13 @@
             if (selectedNode == selectedWay.getNode(0)){
                 currentBaseNode = selectedNode;
-                if (selectedWay.getNodesCount()>1) previousNode = selectedWay.getNode(1);
+                if (selectedWay.getNodesCount()>1) {
+                    previousNode = selectedWay.getNode(1);
+                }
             }
             if (selectedNode == selectedWay.lastNode()) {
                 currentBaseNode = selectedNode;
-                if (selectedWay.getNodesCount()>1)
+                if (selectedWay.getNodesCount()>1) {
                     previousNode = selectedWay.getNode(selectedWay.getNodesCount()-2);
+                }
             }
         }
@@ -1018,5 +1026,7 @@
         if (snapHelper.dir2!=null && currentBaseNode!=null) {
             EastNorth xPoint = Geometry.getSegmentSegmentIntersection(p1, p2, snapHelper.dir2, currentBaseNode.getEastNorth());
-            if (xPoint!=null) n.setEastNorth(xPoint);
+            if (xPoint!=null) {
+                n.setEastNorth(xPoint);
+            }
         }
     }
@@ -1027,5 +1037,5 @@
      * done in redrawIfRequired. This means, calling addHighlighting() without redrawIfRequired()
      * will leave the data in an inconsistent state.
-     * 
+     *
      * The status bar derives its information from oldHighlights, so in order to update the status
      * bar both addHighlighting() and repaintIfRequired() are needed, since former fills newHighlights
@@ -1079,8 +1089,8 @@
         // sanity checks
         if (Main.map.mapView == null || mousePos == null
-        // don't draw line if we don't know where from or where to
-        || currentBaseNode == null || currentMouseEastNorth == null
-        // don't draw line if mouse is outside window
-        || !Main.map.mapView.getBounds().contains(mousePos))
+                // don't draw line if we don't know where from or where to
+                || currentBaseNode == null || currentMouseEastNorth == null
+                // don't draw line if mouse is outside window
+                || !Main.map.mapView.getBounds().contains(mousePos))
             return;
 
@@ -1088,5 +1098,5 @@
         snapHelper.drawIfNeeded(g2,mv);
         if (!drawHelperLine || wayIsFinished || shift)
-          return;
+            return;
 
         if (!snapHelper.isActive()) { // else use color and stoke from  snapHelper.draw
@@ -1205,7 +1215,6 @@
         if (currentBaseNode != null && !ds.getSelected().isEmpty()) {
             Way continueFrom = getWayForNode(currentBaseNode);
-            if (alt && continueFrom != null) {
+            if (alt && continueFrom != null)
                 return Collections.<OsmPrimitive>singleton(continueFrom);
-            }
         }
         return ds.getSelected();
@@ -1250,5 +1259,7 @@
             }
             // select last added node - maybe we will continue drawing from it
-            if (n!=null) getCurrentDataSet().addSelected(n);
+            if (n!=null) {
+                getCurrentDataSet().addSelected(n);
+            }
         }
     }
@@ -1299,5 +1310,5 @@
 
             Collection<String> angles = Main.pref.getCollection("draw.anglesnap.angles",
-                Arrays.asList("0","30","45","60","90","120","135","150","180"));
+                    Arrays.asList("0","30","45","60","90","120","135","150","180"));
 
             snapAngles = new double[2*angles.size()];
@@ -1325,10 +1336,10 @@
 
             highlightColor = Main.pref.getColor(marktr("draw angle snap highlight"),
-                new Color(Color.ORANGE.getRed(),Color.ORANGE.getGreen(),Color.ORANGE.getBlue(),128));
+                    new Color(Color.ORANGE.getRed(),Color.ORANGE.getGreen(),Color.ORANGE.getBlue(),128));
             highlightStroke = new BasicStroke(10, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
 
             float dash1[] = { 4.0f };
             helperStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT,
-                BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f);
+                    BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f);
         }
 
@@ -1411,6 +1422,10 @@
             if (snapOn && (activeBaseHeading>=0)) {
                 angle = curHeading - activeBaseHeading;
-                if (angle < 0) angle+=360;
-                if (angle > 360) angle=0;
+                if (angle < 0) {
+                    angle+=360;
+                }
+                if (angle > 360) {
+                    angle=0;
+                }
 
                 double nearestAngle;
@@ -1455,6 +1470,10 @@
             if (baseHeading >=0 ) { // there is previous line segment with some heading
                 angle = hdg - baseHeading;
-                if (angle < 0) angle+=360;
-                if (angle > 360) angle=0;
+                if (angle < 0) {
+                    angle+=360;
+                }
+                if (angle > 360) {
+                    angle=0;
+                }
             }
             showStatusInfo(angle, hdg, distance, isSnapOn());
@@ -1504,6 +1523,8 @@
                     Way w = selectedWays.iterator().next();
                     Collection <EastNorth> pointsToProject = new ArrayList<EastNorth>();
-                    if (w.getNodesCount()<1000) for (Node n: w.getNodes()) {
-                        pointsToProject.add(n.getEastNorth());
+                    if (w.getNodesCount()<1000) {
+                        for (Node n: w.getNodes()) {
+                            pointsToProject.add(n.getEastNorth());
+                        }
                     }
                     if (customBaseHeading >=0 ) {
@@ -1544,6 +1565,10 @@
             double hdg = segmentPoint1.heading(segmentPoint2);
             hdg=Math.toDegrees(hdg);
-            if (hdg<0) hdg+=360;
-            if (hdg>360) hdg-=360;
+            if (hdg<0) {
+                hdg+=360;
+            }
+            if (hdg>360) {
+                hdg-=360;
+            }
             //fixed=true;
             //absoluteFix=true;
@@ -1554,6 +1579,7 @@
             if (snapOn) {
                 // turn off snapping if we are in fixed mode or no actile snapping line exist
-                if (fixed || !active) { snapOn=false; unsetFixedMode(); }
-                else setFixedMode();
+                if (fixed || !active) { snapOn=false; unsetFixedMode(); } else {
+                    setFixedMode();
+                }
             } else {
                 snapOn=true;
@@ -1609,6 +1635,7 @@
                 }
             }
-            if (Math.abs(bestAngle-360) < 1e-3)
+            if (Math.abs(bestAngle-360) < 1e-3) {
                 bestAngle=0;
+            }
             return bestAngle;
         }
@@ -1623,8 +1650,9 @@
 
         private void unFixOrTurnOff() {
-            if (absoluteFix)
+            if (absoluteFix) {
                 unsetFixedMode();
-            else
+            } else {
                 toggleSnapping();
+            }
         }
 
@@ -1706,5 +1734,5 @@
         public SnapChangeAction() {
             super(tr("Angle snapping"), "anglesnap",
-                tr("Switch angle snapping mode while drawing"), null, false);
+                    tr("Switch angle snapping mode while drawing"), null, false);
             putValue("help", ht("/Action/Draw/AngleSnap"));
         }
@@ -1712,5 +1740,7 @@
         @Override
         public void actionPerformed(ActionEvent e) {
-            if (snapHelper!=null) snapHelper.toggleSnapping();
+            if (snapHelper!=null) {
+                snapHelper.toggleSnapping();
+            }
         }
     }
Index: /trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/AutosaveTask.java	(revision 5511)
+++ /trunk/src/org/openstreetmap/josm/data/AutosaveTask.java	(revision 5512)
@@ -68,5 +68,5 @@
 
     private final DataSetListenerAdapter datasetAdapter = new DataSetListenerAdapter(this);
-    private Set<DataSet> changedDatasets = new HashSet<DataSet>();
+    private final Set<DataSet> changedDatasets = new HashSet<DataSet>();
     private final List<AutosaveLayerInfo> layersInfo = new ArrayList<AutosaveLayerInfo>();
     private Timer timer;
@@ -163,5 +163,5 @@
             info.layerName = info.layer.getName();
         }
-        if (changedDatasets.contains(info.layer.data)) {
+        if (changedDatasets.remove(info.layer.data)) {
             File file = getNewLayerFile(info);
             if (file != null) {
