Index: /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java
===================================================================
--- /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java	(revision 21801)
+++ /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java	(revision 21802)
@@ -37,33 +37,37 @@
 
 @SuppressWarnings("serial")
-public class DrawBuildingAction extends MapMode 
-implements MapViewPaintable, AWTEventListener, SelectionChangedListener {
-	enum Mode {None, Drawing, DrawingWidth, DrawingAngFix}
+public class DrawBuildingAction extends MapMode
+		implements MapViewPaintable, AWTEventListener, SelectionChangedListener {
+	enum Mode {
+		None, Drawing, DrawingWidth, DrawingAngFix
+	}
+
 	final private Cursor cursorCrosshair;
 	final private Cursor cursorJoinNode;
 	private Cursor currCursor;
-	
+
 	private Mode mode = Mode.None;
 	private Mode nextMode = Mode.None;
-	
+
 	private Color selectedColor;
 	private Point mousePos;
 	private Point drawStartPos;
-	
+
 	Building building = new Building();
-	
+
 	public DrawBuildingAction(MapFrame mapFrame) {
-		super(tr("Draw buildings"),"building",tr("Draw buildings"),
+		super(tr("Draw buildings"), "building", tr("Draw buildings"),
 				Shortcut.registerShortcut("mapmode:buildings",
-						tr("Mode: {0}", tr("Draw buildings")),
-						KeyEvent.VK_W, Shortcut.GROUP_EDIT),
-				mapFrame,getCursor());
-		
+				tr("Mode: {0}", tr("Draw buildings")),
+				KeyEvent.VK_W, Shortcut.GROUP_EDIT),
+				mapFrame, getCursor());
+
 		cursorCrosshair = getCursor();
 		cursorJoinNode = ImageProvider.getCursor("crosshair", "joinnode");
 		currCursor = cursorCrosshair;
-		
+
 		selectedColor = Main.pref.getColor(marktr("selected"), Color.red);
 	}
+
 	private static Cursor getCursor() {
 		try {
@@ -73,10 +77,13 @@
 		return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
 	}
+
 	/**
 	 * Displays the given cursor instead of the normal one
-	 * @param Cursors One of the available cursors
+	 * 
+	 * @param Cursors
+	 *            One of the available cursors
 	 */
 	private void setCursor(final Cursor c) {
-		if(currCursor.equals(c))
+		if (currCursor.equals(c))
 			return;
 		try {
@@ -85,5 +92,5 @@
 				public void run() {
 					// Don't change cursor when mode has changed already
-					if(!(Main.map.mapMode instanceof DrawBuildingAction))
+					if (!(Main.map.mapMode instanceof DrawBuildingAction))
 						return;
 					Main.map.mapView.setCursor(c);
@@ -91,6 +98,8 @@
 			});
 			currCursor = c;
-		} catch(Exception e) {}
-	}
+		} catch (Exception e) {
+		}
+	}
+
 	private static void showAddrDialog(Way w) {
 		AddressDialog dlg = new AddressDialog();
@@ -100,11 +109,14 @@
 			String tmp;
 			tmp = dlg.getHouseNum();
-			if (tmp!=null&&tmp!="") w.put("addr:housenumber",tmp);
+			if (tmp != null && tmp != "")
+				w.put("addr:housenumber", tmp);
 			tmp = dlg.getStreetName();
-			if (tmp!=null&&tmp!="") w.put("addr:street",tmp);
-		}
-	}
-
-	@Override public void enterMode() {
+			if (tmp != null && tmp != "")
+				w.put("addr:street", tmp);
+		}
+	}
+
+	@Override
+	public void enterMode() {
 		super.enterMode();
 		if (getCurrentDataSet() == null) {
@@ -120,8 +132,10 @@
 		try {
 			Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK);
-		} catch (SecurityException ex) { }
-	}
-
-	@Override public void exitMode() {
+		} catch (SecurityException ex) {
+		}
+	}
+
+	@Override
+	public void exitMode() {
 		super.exitMode();
 		Main.map.mapView.removeMouseListener(this);
@@ -131,16 +145,18 @@
 		try {
 			Toolkit.getDefaultToolkit().removeAWTEventListener(this);
-		} catch (SecurityException ex) { }
-		if (mode!=Mode.None) Main.map.mapView.repaint();
+		} catch (SecurityException ex) {
+		}
+		if (mode != Mode.None)
+			Main.map.mapView.repaint();
 		mode = Mode.None;
 	}
-	
+
 	public void cancelDrawing() {
 		mode = Mode.None;
-		if(Main.map == null || Main.map.mapView == null)
+		if (Main.map == null || Main.map.mapView == null)
 			return;
 		Main.map.statusLine.setHeading(-1);
-  		Main.map.statusLine.setAngle(-1);
-  		building.reset();
+		Main.map.statusLine.setAngle(-1);
+		building.reset();
 		Main.map.mapView.repaint();
 		updateStatusLine();
@@ -148,15 +164,16 @@
 
 	public void eventDispatched(AWTEvent arg0) {
-		if (!(arg0 instanceof KeyEvent)) return;
-		KeyEvent ev = (KeyEvent)arg0;
+		if (!(arg0 instanceof KeyEvent))
+			return;
+		KeyEvent ev = (KeyEvent) arg0;
 		if (ev.getKeyCode() == KeyEvent.VK_ESCAPE)
 			cancelDrawing();
 	}
-	
+
 	private EastNorth getPoint(MouseEvent e) {
 		Node n;
 		if (e.isControlDown()) {
 			n = null;
-		} else { 
+		} else {
 			n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isUsablePredicate);
 		}
@@ -167,5 +184,5 @@
 		}
 	}
-	
+
 	private Mode modeDrawing(MouseEvent e) {
 		EastNorth p = getPoint(e);
@@ -175,7 +192,7 @@
 		} else {
 			building.setPlace(p, ToolSettings.getWidth(),
-					ToolSettings.getLenStep(),e.isShiftDown());
+					ToolSettings.getLenStep(), e.isShiftDown());
 			Main.map.statusLine.setDist(building.getLength());
-			return this.nextMode = ToolSettings.getWidth() == 0? Mode.DrawingWidth : Mode.None;
+			return this.nextMode = ToolSettings.getWidth() == 0 ? Mode.DrawingWidth : Mode.None;
 		}
 	}
@@ -208,24 +225,24 @@
 			throw new AssertionError("Invalid drawing mode");
 	}
-	
-	public void paint(Graphics2D g, MapView mv,Bounds bbox)
-	{
-		if (mode == Mode.None) return;
-		if (building.getLength() == 0) return;
-		
+
+	public void paint(Graphics2D g, MapView mv, Bounds bbox) {
+		if (mode == Mode.None)
+			return;
+		if (building.getLength() == 0)
+			return;
+
 		g.setColor(selectedColor);
 		g.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
-		
+
 		building.paint(g, mv);
-		
+
 		g.setStroke(new BasicStroke(1));
 
 	}
-	
-	private void drawingStart(MouseEvent e)
-	{
+
+	private void drawingStart(MouseEvent e) {
 		mousePos = e.getPoint();
 		drawStartPos = mousePos;
-		
+
 		Node n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isUsablePredicate);
 		if (n == null) {
@@ -247,5 +264,5 @@
 		}
 	}
-	
+
 	private void drawingFinish() {
 		if (building.getLength() != 0) {
@@ -257,7 +274,10 @@
 	}
 
-	@Override public void mousePressed(MouseEvent e) {
-		if (e.getButton() != MouseEvent.BUTTON1) return;
-		if(!Main.map.mapView.isActiveLayerDrawable()) return;		
+	@Override
+	public void mousePressed(MouseEvent e) {
+		if (e.getButton() != MouseEvent.BUTTON1)
+			return;
+		if (!Main.map.mapView.isActiveLayerDrawable())
+			return;
 
 		if (mode == Mode.None)
@@ -265,13 +285,18 @@
 	}
 
-	@Override public void mouseDragged(MouseEvent e) {
+	@Override
+	public void mouseDragged(MouseEvent e) {
 		processMouseEvent(e);
 		updCursor();
-		if (mode!=Mode.None) Main.map.mapView.repaint();
-	}
-
-	@Override public void mouseReleased(MouseEvent e) {
-		if (e.getButton() != MouseEvent.BUTTON1) return;
-		if(!Main.map.mapView.isActiveLayerDrawable()) return;
+		if (mode != Mode.None)
+			Main.map.mapView.repaint();
+	}
+
+	@Override
+	public void mouseReleased(MouseEvent e) {
+		if (e.getButton() != MouseEvent.BUTTON1)
+			return;
+		if (!Main.map.mapView.isActiveLayerDrawable())
+			return;
 		boolean dragged = true;
 		if (drawStartPos != null)
@@ -279,45 +304,62 @@
 		drawStartPos = null;
 
-		if (mode == Mode.Drawing && !dragged) return;
-		if (mode == Mode.None) return;
+		if (mode == Mode.Drawing && !dragged)
+			return;
+		if (mode == Mode.None)
+			return;
 
 		drawingAdvance(e);
 	}
-	
+
 	private void updCursor() {
-		if (mousePos==null) return;
+		if (mousePos == null)
+			return;
 		Node n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isUsablePredicate);
-		if (n != null) setCursor(cursorJoinNode); else setCursor(cursorCrosshair);
-
-	}
-	@Override public void mouseMoved(MouseEvent e) {
-		if(!Main.map.mapView.isActiveLayerDrawable()) return;
+		if (n != null)
+			setCursor(cursorJoinNode);
+		else
+			setCursor(cursorCrosshair);
+
+	}
+
+	@Override
+	public void mouseMoved(MouseEvent e) {
+		if (!Main.map.mapView.isActiveLayerDrawable())
+			return;
 		processMouseEvent(e);
 		updCursor();
-		if (mode!=Mode.None) Main.map.mapView.repaint();
-	}
-
-	@Override public String getModeHelpText() {
-		if (mode==Mode.None) return tr("Point on the corner of the building to start drawing");
-		if (mode==Mode.Drawing) return tr("Point on opposite end of the building");
-		if (mode==Mode.DrawingWidth) return tr("Set width of the building");
+		if (mode != Mode.None)
+			Main.map.mapView.repaint();
+	}
+
+	@Override
+	public String getModeHelpText() {
+		if (mode == Mode.None)
+			return tr("Point on the corner of the building to start drawing");
+		if (mode == Mode.Drawing)
+			return tr("Point on opposite end of the building");
+		if (mode == Mode.DrawingWidth)
+			return tr("Set width of the building");
 		return "";
 	}
 
-	@Override public boolean layerIsSupported(Layer l) {
+	@Override
+	public boolean layerIsSupported(Layer l) {
 		return l instanceof OsmDataLayer;
 	}
-	
+
 	public void updateConstraint(Collection<? extends OsmPrimitive> newSelection) {
 		building.disableAngConstraint();
-		if (newSelection.size()!=2)return;
-   		Object[] arr = newSelection.toArray();
-   		if (!(arr[0] instanceof Node&&arr[1] instanceof Node)) return;
-   		EastNorth p1,p2;
-   		p1=latlon2eastNorth(((Node)arr[0]).getCoor());
-   		p2=latlon2eastNorth(((Node)arr[1]).getCoor());
-   		building.setAngConstraint(p1.heading(p2));
-	}
-	
+		if (newSelection.size() != 2)
+			return;
+		Object[] arr = newSelection.toArray();
+		if (!(arr[0] instanceof Node && arr[1] instanceof Node))
+			return;
+		EastNorth p1, p2;
+		p1 = latlon2eastNorth(((Node) arr[0]).getCoor());
+		p2 = latlon2eastNorth(((Node) arr[1]).getCoor());
+		building.setAngConstraint(p1.heading(p2));
+	}
+
 	public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
 		updateConstraint(newSelection);
