Index: /trunk/src/org/openstreetmap/josm/actions/FollowLineAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/FollowLineAction.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/actions/FollowLineAction.java	(revision 6104)
@@ -7,5 +7,4 @@
 import java.awt.event.KeyEvent;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
@@ -85,7 +84,5 @@
 
         Node newPoint = null;
-        Iterator<OsmPrimitive> i = referrers.iterator();
-        while (i.hasNext()) {
-            OsmPrimitive referrer = i.next();
+        for (OsmPrimitive referrer : referrers) {
             if (!referrer.getType().equals(OsmPrimitiveType.WAY)) { // Can't follow points or relations
                 continue;
Index: /trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java	(revision 6104)
@@ -133,6 +133,5 @@
     public Collection<DownloadTask> findDownloadTasks(final String url) {
         List<DownloadTask> result = new ArrayList<DownloadTask>();
-        for (int i = 0; i < downloadTasks.size(); i++) {
-            Class<? extends DownloadTask> taskClass = downloadTasks.get(i);
+        for (Class<? extends DownloadTask> taskClass : downloadTasks) {
             if (taskClass != null) {
                 try {
Index: /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 6104)
@@ -1670,9 +1670,9 @@
         private double getNearestAngle(double angle) {
             double delta,minDelta=1e5, bestAngle=0.0;
-            for (int i=0; i < snapAngles.length; i++) {
-                delta = getAngleDelta(angle,snapAngles[i]);
+            for (double snapAngle : snapAngles) {
+                delta = getAngleDelta(angle, snapAngle);
                 if (delta < minDelta) {
-                    minDelta=delta;
-                    bestAngle=snapAngles[i];
+                    minDelta = delta;
+                    bestAngle = snapAngle;
                 }
             }
Index: /trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 6104)
@@ -395,7 +395,5 @@
         // remove the objects from their parent relations
         //
-        Iterator<Relation> iterator = OsmPrimitive.getFilteredSet(OsmPrimitive.getReferrer(primitivesToDelete), Relation.class).iterator();
-        while (iterator.hasNext()) {
-            Relation cur = iterator.next();
+        for (Relation cur : OsmPrimitive.getFilteredSet(OsmPrimitive.getReferrer(primitivesToDelete), Relation.class)) {
             Relation rel = new Relation(cur);
             rel.removeMembersFor(primitivesToDelete);
Index: /trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/AutosaveTask.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/data/AutosaveTask.java	(revision 6104)
@@ -114,7 +114,7 @@
     private String getFileName(String layerName, int index) {
         String result = layerName;
-        for (int i=0; i<ILLEGAL_CHARACTERS.length; i++) {
-            result = result.replaceAll(Pattern.quote(String.valueOf(ILLEGAL_CHARACTERS[i])),
-                    '&' + String.valueOf((int)ILLEGAL_CHARACTERS[i]) + ';');
+        for (char illegalCharacter : ILLEGAL_CHARACTERS) {
+            result = result.replaceAll(Pattern.quote(String.valueOf(illegalCharacter)),
+                    '&' + String.valueOf((int) illegalCharacter) + ';');
         }
         if (index != 0) {
Index: /trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java	(revision 6104)
@@ -59,7 +59,6 @@
 
     protected void fireConflictRemoved() {
-        Iterator<IConflictListener> it = listeners.iterator();
-        while(it.hasNext()) {
-            it.next().onConflictsRemoved(this);
+        for (IConflictListener listener : listeners) {
+            listener.onConflictsRemoved(this);
         }
     }
Index: /trunk/src/org/openstreetmap/josm/data/osm/Way.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 6104)
@@ -151,6 +151,6 @@
 
         Node[] nodes = this.nodes;
-        for (int i=0; i<nodes.length; i++) {
-            if (nodes[i].equals(node))
+        for (Node n : nodes) {
+            if (n.equals(node))
                 return true;
         }
Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java	(revision 6104)
@@ -298,6 +298,6 @@
                 } else {
                     List<Way> waysToJoin = new ArrayList<Way>();
-                    for (Iterator<Long> it = wayIds.iterator(); it.hasNext(); ) {
-                        Way w = (Way) ds.getPrimitiveById(it.next(), OsmPrimitiveType.WAY);
+                    for (Long wayId : wayIds) {
+                        Way w = (Way) ds.getPrimitiveById(wayId, OsmPrimitiveType.WAY);
                         if (w != null && w.getNodesCount() > 0) { // fix #7173 (empty ways on purge)
                             waysToJoin.add(w);
Index: /trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java	(revision 6104)
@@ -160,6 +160,5 @@
             parts = new String[0];
         }
-        for (int i = 0; i < parts.length; i++) {
-            String part = parts[i];
+        for (String part : parts) {
             if (part.isEmpty() || part.charAt(0) != '+')
                 throw new ProjectionConfigurationException(tr("Parameter must begin with a ''+'' character (found ''{0}'')", part));
@@ -288,14 +287,14 @@
             throw new ProjectionConfigurationException(tr("Unexpected number of arguments for parameter ''towgs84'' (must be 3 or 7)"));
         List<Double> towgs84Param = new ArrayList<Double>();
-        for (int i = 0; i < numStr.length; i++) {
+        for (String str : numStr) {
             try {
-                towgs84Param.add(Double.parseDouble(numStr[i]));
+                towgs84Param.add(Double.parseDouble(str));
             } catch (NumberFormatException e) {
-                throw new ProjectionConfigurationException(tr("Unable to parse value of parameter ''towgs84'' (''{0}'')", numStr[i]));
+                throw new ProjectionConfigurationException(tr("Unable to parse value of parameter ''towgs84'' (''{0}'')", str));
             }
         }
         boolean isCentric = true;
-        for (int i = 0; i<towgs84Param.size(); i++) {
-            if (towgs84Param.get(i) != 0.0) {
+        for (Double param : towgs84Param) {
+            if (param != 0.0) {
                 isCentric = false;
                 break;
Index: /trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java	(revision 6104)
@@ -163,7 +163,7 @@
                 return this;
             else {
-                for (int i = 0; i < subGrid.length; i++) {
-                    if (subGrid[i].isCoordWithin(lon, lat))
-                        return subGrid[i].getSubGridForCoord(lon, lat);
+                for (NTV2SubGrid aSubGrid : subGrid) {
+                    if (aSubGrid.isCoordWithin(lon, lat))
+                        return aSubGrid.getSubGridForCoord(lon, lat);
                 }
                 return this;
Index: /trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java	(revision 6104)
@@ -85,6 +85,6 @@
                 List<Node> wNodes = r.getNodes();
                 coor = new ArrayList<LatLon>(wNodes.size());
-                for (int i = 0; i < wNodes.size(); i++) {
-                    coor.add(wNodes.get(i).getCoor());
+                for (Node wNode : wNodes) {
+                    coor.add(wNode.getCoor());
                 }
             }
@@ -110,6 +110,6 @@
         public RelationMembers(List<RelationMember> members) {
             this.members = new ArrayList<RelMember>(members.size());
-            for (int i = 0; i < members.size(); i++) {
-                this.members.add(new RelMember(members.get(i)));
+            for (RelationMember member : members) {
+                this.members.add(new RelMember(member));
             }
         }
Index: /trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java	(revision 6104)
@@ -193,6 +193,6 @@
         // Build the list of lat/lon
         List<LatLon> wLat = new ArrayList<LatLon>(wNodesToUse.size());
-        for (int i=0; i<wNodesToUse.size(); i++) {
-            wLat.add(wNodesToUse.get(i).getCoor());
+        for (Node node : wNodesToUse) {
+            wLat.add(node.getCoor());
         }
         // If this way has not direction-dependant keys, make sure the list is ordered the same for all ways (fix #8015)
Index: /trunk/src/org/openstreetmap/josm/data/validation/util/Entities.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/validation/util/Entities.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/data/validation/util/Entities.java	(revision 6104)
@@ -388,6 +388,6 @@
                         {
                             mapNameToValue = new HashMap<String, String>();
-                            for (int in = 0; in < ARRAY.length; ++in)
-                                mapNameToValue.put(ARRAY[in][0], ARRAY[in][1]);
+                            for (String[] pair : ARRAY)
+                                mapNameToValue.put(pair[0], pair[1]);
                         }
                         String value = mapNameToValue.get(entityContent);
Index: /trunk/src/org/openstreetmap/josm/gui/FileDrop.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/FileDrop.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/FileDrop.java	(revision 6104)
@@ -3,14 +3,32 @@
 package org.openstreetmap.josm.gui;
 
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
 import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.dnd.DropTargetEvent;
+import java.awt.dnd.DropTargetListener;
+import java.awt.event.HierarchyEvent;
+import java.awt.event.HierarchyListener;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
-import java.io.PrintStream;
 import java.io.Reader;
+import java.net.URI;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.EventObject;
 import java.util.List;
+import java.util.TooManyListenersException;
 
 import javax.swing.BorderFactory;
+import javax.swing.JComponent;
+import javax.swing.border.Border;
 
 import org.openstreetmap.josm.Main;
@@ -55,9 +73,10 @@
  * @author  rharder@users.sf.net
  * @version 1.0.1
+ * @since 1231
  */
 public class FileDrop
 {
-    private transient javax.swing.border.Border normalBorder;
-    private transient java.awt.dnd.DropTargetListener dropListener;
+    private transient Border normalBorder;
+    private transient DropTargetListener dropListener;
 
     /** Discover if the running JVM is modern enough to have drag and drop. */
@@ -65,10 +84,12 @@
 
     // Default border color
-    private static java.awt.Color defaultBorderColor = new java.awt.Color( 0f, 0f, 1f, 0.25f );
-
-    /* Constructor for JOSM file drop */
-    public FileDrop(final java.awt.Component c){
+    private static Color defaultBorderColor = new Color( 0f, 0f, 1f, 0.25f );
+
+    /** 
+     * Constructor for JOSM file drop 
+     * @param c The drop target
+     */
+    public FileDrop(final Component c){
         this(
-                null,  // Logging stream
                 c,     // Drop target
                 BorderFactory.createMatteBorder( 2, 2, 2, 2, defaultBorderColor ), // Drag border
@@ -76,5 +97,5 @@
                 new FileDrop.Listener(){
                     @Override
-                    public void filesDropped( java.io.File[] files ){
+                    public void filesDropped( File[] files ){
                         // start asynchronous loading of files
                         OpenFileAction.OpenFileTask task = new OpenFileAction.OpenFileTask(Arrays.asList(files), null);
@@ -87,166 +108,4 @@
 
     /**
-     * Constructs a {@link FileDrop} with a default light-blue border
-     * and, if <var>c</var> is a {@link java.awt.Container}, recursively
-     * sets all elements contained within as drop targets, though only
-     * the top level container will change borders.
-     *
-     * @param c Component on which files will be dropped.
-     * @param listener Listens for <tt>filesDropped</tt>.
-     * @since 1.0
-     */
-    public FileDrop(
-            final java.awt.Component c,
-            final Listener listener )
-    {   this( null,  // Logging stream
-            c,     // Drop target
-            javax.swing.BorderFactory.createMatteBorder( 2, 2, 2, 2, defaultBorderColor ), // Drag border
-            true, // Recursive
-            listener );
-    }   // end constructor
-
-    /**
-     * Constructor with a default border and the option to recursively set drop targets.
-     * If your component is a <tt>java.awt.Container</tt>, then each of its children
-     * components will also listen for drops, though only the parent will change borders.
-     *
-     * @param c Component on which files will be dropped.
-     * @param recursive Recursively set children as drop targets.
-     * @param listener Listens for <tt>filesDropped</tt>.
-     * @since 1.0
-     */
-    public FileDrop(
-            final java.awt.Component c,
-            final boolean recursive,
-            final Listener listener )
-    {   this( null,  // Logging stream
-            c,     // Drop target
-            javax.swing.BorderFactory.createMatteBorder( 2, 2, 2, 2, defaultBorderColor ), // Drag border
-            recursive, // Recursive
-            listener );
-    }   // end constructor
-
-    /**
-     * Constructor with a default border and debugging optionally turned on.
-     * With Debugging turned on, more status messages will be displayed to
-     * <tt>out</tt>. A common way to use this constructor is with
-     * <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for
-     * the parameter <tt>out</tt> will result in no debugging output.
-     *
-     * @param out PrintStream to record debugging info or null for no debugging.
-     * @param c Component on which files will be dropped.
-     * @param listener Listens for <tt>filesDropped</tt>.
-     * @since 1.0
-     */
-    public FileDrop(
-            final java.io.PrintStream out,
-            final java.awt.Component c,
-            final Listener listener )
-    {   this( out,  // Logging stream
-            c,    // Drop target
-            javax.swing.BorderFactory.createMatteBorder( 2, 2, 2, 2, defaultBorderColor ),
-            false, // Recursive
-            listener );
-    }   // end constructor
-
-    /**
-     * Constructor with a default border, debugging optionally turned on
-     * and the option to recursively set drop targets.
-     * If your component is a <tt>java.awt.Container</tt>, then each of its children
-     * components will also listen for drops, though only the parent will change borders.
-     * With Debugging turned on, more status messages will be displayed to
-     * <tt>out</tt>. A common way to use this constructor is with
-     * <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for
-     * the parameter <tt>out</tt> will result in no debugging output.
-     *
-     * @param out PrintStream to record debugging info or null for no debugging.
-     * @param c Component on which files will be dropped.
-     * @param recursive Recursively set children as drop targets.
-     * @param listener Listens for <tt>filesDropped</tt>.
-     * @since 1.0
-     */
-    public FileDrop(
-            final java.io.PrintStream out,
-            final java.awt.Component c,
-            final boolean recursive,
-            final Listener listener)
-    {   this( out,  // Logging stream
-            c,    // Drop target
-            javax.swing.BorderFactory.createMatteBorder( 2, 2, 2, 2, defaultBorderColor ), // Drag border
-            recursive, // Recursive
-            listener );
-    }   // end constructor
-
-    /**
-     * Constructor with a specified border
-     *
-     * @param c Component on which files will be dropped.
-     * @param dragBorder Border to use on <tt>JComponent</tt> when dragging occurs.
-     * @param listener Listens for <tt>filesDropped</tt>.
-     * @since 1.0
-     */
-    public FileDrop(
-            final java.awt.Component c,
-            final javax.swing.border.Border dragBorder,
-            final Listener listener)
-    {   this(
-            null,   // Logging stream
-            c,      // Drop target
-            dragBorder, // Drag border
-            false,  // Recursive
-            listener );
-    }   // end constructor
-
-    /**
-     * Constructor with a specified border and the option to recursively set drop targets.
-     * If your component is a <tt>java.awt.Container</tt>, then each of its children
-     * components will also listen for drops, though only the parent will change borders.
-     *
-     * @param c Component on which files will be dropped.
-     * @param dragBorder Border to use on <tt>JComponent</tt> when dragging occurs.
-     * @param recursive Recursively set children as drop targets.
-     * @param listener Listens for <tt>filesDropped</tt>.
-     * @since 1.0
-     */
-    public FileDrop(
-            final java.awt.Component c,
-            final javax.swing.border.Border dragBorder,
-            final boolean recursive,
-            final Listener listener)
-    {   this(
-            null,
-            c,
-            dragBorder,
-            recursive,
-            listener );
-    }   // end constructor
-
-    /**
-     * Constructor with a specified border and debugging optionally turned on.
-     * With Debugging turned on, more status messages will be displayed to
-     * <tt>out</tt>. A common way to use this constructor is with
-     * <tt>System.out</tt> or <tt>System.err</tt>. A <tt>null</tt> value for
-     * the parameter <tt>out</tt> will result in no debugging output.
-     *
-     * @param out PrintStream to record debugging info or null for no debugging.
-     * @param c Component on which files will be dropped.
-     * @param dragBorder Border to use on <tt>JComponent</tt> when dragging occurs.
-     * @param listener Listens for <tt>filesDropped</tt>.
-     * @since 1.0
-     */
-    public FileDrop(
-            final java.io.PrintStream out,
-            final java.awt.Component c,
-            final javax.swing.border.Border dragBorder,
-            final Listener listener)
-    {   this(
-            out,    // Logging stream
-            c,      // Drop target
-            dragBorder, // Drag border
-            false,  // Recursive
-            listener );
-    }   // end constructor
-
-    /**
      * Full constructor with a specified border and debugging optionally turned on.
      * With Debugging turned on, more status messages will be displayed to
@@ -255,15 +114,12 @@
      * the parameter <tt>out</tt> will result in no debugging output.
      *
-     * @param out PrintStream to record debugging info or null for no debugging.
      * @param c Component on which files will be dropped.
      * @param dragBorder Border to use on <tt>JComponent</tt> when dragging occurs.
      * @param recursive Recursively set children as drop targets.
      * @param listener Listens for <tt>filesDropped</tt>.
-     * @since 1.0
      */
     public FileDrop(
-            final java.io.PrintStream out,
-            final java.awt.Component c,
-            final javax.swing.border.Border dragBorder,
+            final Component c,
+            final Border dragBorder,
             final boolean recursive,
             final Listener listener)
@@ -272,35 +128,34 @@
         if( supportsDnD() )
         {   // Make a drop listener
-            dropListener = new java.awt.dnd.DropTargetListener()
+            dropListener = new DropTargetListener()
             {   @Override
-                public void dragEnter( java.awt.dnd.DropTargetDragEvent evt )
-            {       log( out, "FileDrop: dragEnter event." );
+                public void dragEnter( DropTargetDragEvent evt )
+            {       Main.debug("FileDrop: dragEnter event." );
 
             // Is this an acceptable drag event?
-            if( isDragOk( out, evt ) )
+            if( isDragOk( evt ) )
             {
                 // If it's a Swing component, set its border
-                if( c instanceof javax.swing.JComponent )
-                {   javax.swing.JComponent jc = (javax.swing.JComponent) c;
+                if( c instanceof JComponent )
+                {   JComponent jc = (JComponent) c;
                 normalBorder = jc.getBorder();
-                log( out, "FileDrop: normal border saved." );
+                Main.debug("FileDrop: normal border saved." );
                 jc.setBorder( dragBorder );
-                log( out, "FileDrop: drag border set." );
+                Main.debug("FileDrop: drag border set." );
                 }   // end if: JComponent
 
                 // Acknowledge that it's okay to enter
-                //evt.acceptDrag( java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE );
-                evt.acceptDrag( java.awt.dnd.DnDConstants.ACTION_COPY );
-                log( out, "FileDrop: event accepted." );
+                evt.acceptDrag( DnDConstants.ACTION_COPY );
+                Main.debug("FileDrop: event accepted." );
             }   // end if: drag ok
             else
             {   // Reject the drag event
                 evt.rejectDrag();
-                log( out, "FileDrop: event rejected." );
+                Main.debug("FileDrop: event rejected." );
             }   // end else: drag not ok
             }   // end dragEnter
 
             @Override
-            public void dragOver( java.awt.dnd.DropTargetDragEvent evt )
+            public void dragOver( DropTargetDragEvent evt )
             {   // This is called continually as long as the mouse is
                 // over the drag target.
@@ -308,20 +163,19 @@
 
             @Override
-            public void drop( java.awt.dnd.DropTargetDropEvent evt )
-            {   log( out, "FileDrop: drop event." );
+            public void drop( DropTargetDropEvent evt )
+            {   Main.debug("FileDrop: drop event." );
             try
             {   // Get whatever was dropped
-                java.awt.datatransfer.Transferable tr = evt.getTransferable();
+                Transferable tr = evt.getTransferable();
 
                 // Is it a file list?
-                if (tr.isDataFlavorSupported (java.awt.datatransfer.DataFlavor.javaFileListFlavor))
+                if (tr.isDataFlavorSupported (DataFlavor.javaFileListFlavor))
                 {
                     // Say we'll take it.
-                    //evt.acceptDrop ( java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE );
-                    evt.acceptDrop ( java.awt.dnd.DnDConstants.ACTION_COPY );
-                    log( out, "FileDrop: file list accepted." );
+                    evt.acceptDrop ( DnDConstants.ACTION_COPY );
+                    Main.debug("FileDrop: file list accepted." );
 
                     // Get a useful list
-                    List<?> fileList = (List<?>)tr.getTransferData(java.awt.datatransfer.DataFlavor.javaFileListFlavor);
+                    List<?> fileList = (List<?>)tr.getTransferData(DataFlavor.javaFileListFlavor);
 
                     // Convert list to array
@@ -335,5 +189,5 @@
                     // Mark that drop is completed.
                     evt.getDropTargetContext().dropComplete(true);
-                    log( out, "FileDrop: drop complete." );
+                    Main.debug("FileDrop: drop complete." );
                 }   // end if: file list
                 else // this section will check for a reader flavor.
@@ -343,22 +197,21 @@
                     DataFlavor[] flavors = tr.getTransferDataFlavors();
                     boolean handled = false;
-                    for (int zz = 0; zz < flavors.length; zz++) {
-                        if (flavors[zz].isRepresentationClassReader()) {
+                    for (DataFlavor flavor : flavors) {
+                        if (flavor.isRepresentationClassReader()) {
                             // Say we'll take it.
-                            //evt.acceptDrop ( java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE );
-                            evt.acceptDrop(java.awt.dnd.DnDConstants.ACTION_COPY);
-                            log(out, "FileDrop: reader accepted.");
-
-                            Reader reader = flavors[zz].getReaderForText(tr);
+                            evt.acceptDrop(DnDConstants.ACTION_COPY);
+                            Main.debug("FileDrop: reader accepted.");
+
+                            Reader reader = flavor.getReaderForText(tr);
 
                             BufferedReader br = new BufferedReader(reader);
 
-                            if(listener != null) {
-                                listener.filesDropped(createFileArray(br, out));
+                            if (listener != null) {
+                                listener.filesDropped(createFileArray(br));
                             }
 
                             // Mark that drop is completed.
                             evt.getDropTargetContext().dropComplete(true);
-                            log(out, "FileDrop: drop complete.");
+                            Main.debug("FileDrop: drop complete.");
                             handled = true;
                             break;
@@ -366,5 +219,5 @@
                     }
                     if(!handled){
-                        log( out, "FileDrop: not a file list or reader - abort." );
+                        Main.debug("FileDrop: not a file list or reader - abort." );
                         evt.rejectDrop();
                     }
@@ -372,12 +225,12 @@
                 }   // end else: not a file list
             }   // end try
-            catch ( java.io.IOException io)
-            {   log( out, "FileDrop: IOException - abort:" );
-            io.printStackTrace( out );
+            catch ( IOException io)
+            {   Main.warn("FileDrop: IOException - abort:" );
+            io.printStackTrace();
             evt.rejectDrop();
             }   // end catch IOException
-            catch (java.awt.datatransfer.UnsupportedFlavorException ufe)
-            {   log( out, "FileDrop: UnsupportedFlavorException - abort:" );
-            ufe.printStackTrace( out );
+            catch (UnsupportedFlavorException ufe)
+            {   Main.warn("FileDrop: UnsupportedFlavorException - abort:" );
+            ufe.printStackTrace();
             evt.rejectDrop();
             }   // end catch: UnsupportedFlavorException
@@ -385,8 +238,8 @@
             {
                 // If it's a Swing component, reset its border
-                if( c instanceof javax.swing.JComponent )
-                {   javax.swing.JComponent jc = (javax.swing.JComponent) c;
+                if( c instanceof JComponent )
+                {   JComponent jc = (JComponent) c;
                 jc.setBorder( normalBorder );
-                log( out, "FileDrop: normal border restored." );
+                Main.debug("FileDrop: normal border restored." );
                 }   // end if: JComponent
             }   // end finally
@@ -394,26 +247,26 @@
 
             @Override
-            public void dragExit( java.awt.dnd.DropTargetEvent evt )
-            {   log( out, "FileDrop: dragExit event." );
+            public void dragExit( DropTargetEvent evt )
+            {   Main.debug("FileDrop: dragExit event." );
             // If it's a Swing component, reset its border
-            if( c instanceof javax.swing.JComponent )
-            {   javax.swing.JComponent jc = (javax.swing.JComponent) c;
+            if( c instanceof JComponent )
+            {   JComponent jc = (JComponent) c;
             jc.setBorder( normalBorder );
-            log( out, "FileDrop: normal border restored." );
+            Main.debug("FileDrop: normal border restored." );
             }   // end if: JComponent
             }   // end dragExit
 
             @Override
-            public void dropActionChanged( java.awt.dnd.DropTargetDragEvent evt )
-            {   log( out, "FileDrop: dropActionChanged event." );
+            public void dropActionChanged( DropTargetDragEvent evt )
+            {   Main.debug("FileDrop: dropActionChanged event." );
             // Is this an acceptable drag event?
-            if( isDragOk( out, evt ) )
-            {   //evt.acceptDrag( java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE );
-                evt.acceptDrag( java.awt.dnd.DnDConstants.ACTION_COPY );
-                log( out, "FileDrop: event accepted." );
+            if( isDragOk( evt ) )
+            {
+                evt.acceptDrag( DnDConstants.ACTION_COPY );
+                Main.debug("FileDrop: event accepted." );
             }   // end if: drag ok
             else
             {   evt.rejectDrag();
-            log( out, "FileDrop: event rejected." );
+            Main.debug("FileDrop: event rejected." );
             }   // end else: drag not ok
             }   // end dropActionChanged
@@ -421,8 +274,8 @@
 
             // Make the component (and possibly children) drop targets
-            makeDropTarget( out, c, recursive );
+            makeDropTarget( c, recursive );
         }   // end if: supports dnd
         else
-        {   log( out, "FileDrop: Drag and drop is not supported with this JVM" );
+        {   Main.info("FileDrop: Drag and drop is not supported with this JVM" );
         }   // end else: does not support DnD
     }   // end constructor
@@ -446,20 +299,20 @@
     // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
     private static String ZERO_CHAR_STRING = "" + (char)0;
-    private static File[] createFileArray(BufferedReader bReader, PrintStream out)
+    private static File[] createFileArray(BufferedReader bReader)
     {
         try {
-            java.util.List<File> list = new java.util.ArrayList<File>();
-            java.lang.String line = null;
+            List<File> list = new ArrayList<File>();
+            String line = null;
             while ((line = bReader.readLine()) != null) {
                 try {
                     // kde seems to append a 0 char to the end of the reader
-                    if(ZERO_CHAR_STRING.equals(line)) {
+                    if (ZERO_CHAR_STRING.equals(line)) {
                         continue;
                     }
 
-                    java.io.File file = new java.io.File(new java.net.URI(line));
+                    File file = new File(new URI(line));
                     list.add(file);
                 } catch (Exception ex) {
-                    log(out, "Error with " + line + ": " + ex.getMessage());
+                    Main.warn("Error with " + line + ": " + ex.getMessage());
                 }
             }
@@ -467,5 +320,5 @@
             return list.toArray(new File[list.size()]);
         } catch (IOException ex) {
-            log(out, "FileDrop: IOException");
+            Main.warn("FileDrop: IOException");
         }
         return new File[0];
@@ -473,47 +326,47 @@
     // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
 
-    private void makeDropTarget( final java.io.PrintStream out, final java.awt.Component c, boolean recursive )
+    private void makeDropTarget( final Component c, boolean recursive )
     {
         // Make drop target
-        final java.awt.dnd.DropTarget dt = new java.awt.dnd.DropTarget();
+        final DropTarget dt = new DropTarget();
         try
         {   dt.addDropTargetListener( dropListener );
         }   // end try
-        catch( java.util.TooManyListenersException e )
+        catch( TooManyListenersException e )
         {   e.printStackTrace();
-        log(out, "FileDrop: Drop will not work due to previous error. Do you have another listener attached?" );
+        Main.warn("FileDrop: Drop will not work due to previous error. Do you have another listener attached?" );
         }   // end catch
 
         // Listen for hierarchy changes and remove the drop target when the parent gets cleared out.
-        c.addHierarchyListener( new java.awt.event.HierarchyListener()
+        c.addHierarchyListener( new HierarchyListener()
         {   @Override
-            public void hierarchyChanged( java.awt.event.HierarchyEvent evt )
-        {   log( out, "FileDrop: Hierarchy changed." );
-        java.awt.Component parent = c.getParent();
+            public void hierarchyChanged( HierarchyEvent evt )
+        {   Main.debug("FileDrop: Hierarchy changed." );
+        Component parent = c.getParent();
         if( parent == null )
         {   c.setDropTarget( null );
-        log( out, "FileDrop: Drop target cleared from component." );
+        Main.debug("FileDrop: Drop target cleared from component." );
         }   // end if: null parent
         else
-        {   new java.awt.dnd.DropTarget(c, dropListener);
-        log( out, "FileDrop: Drop target added to component." );
+        {   new DropTarget(c, dropListener);
+        Main.debug("FileDrop: Drop target added to component." );
         }   // end else: parent not null
         }   // end hierarchyChanged
         }); // end hierarchy listener
         if( c.getParent() != null ) {
-            new java.awt.dnd.DropTarget(c, dropListener);
+            new DropTarget(c, dropListener);
         }
 
-        if( recursive && (c instanceof java.awt.Container ) )
+        if( recursive && (c instanceof Container ) )
         {
             // Get the container
-            java.awt.Container cont = (java.awt.Container) c;
+            Container cont = (Container) c;
 
             // Get it's components
-            java.awt.Component[] comps = cont.getComponents();
+            Component[] comps = cont.getComponents();
 
             // Set it's components as listeners also
-            for( int i = 0; i < comps.length; i++ ) {
-                makeDropTarget( out, comps[i], recursive );
+            for (Component comp : comps) {
+                makeDropTarget( comp, recursive);
             }
         }   // end if: recursively set components as listener
@@ -521,9 +374,9 @@
 
     /** Determine if the dragged data is a file list. */
-    private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt )
+    private boolean isDragOk( final DropTargetDragEvent evt )
     {   boolean ok = false;
 
     // Get data flavors being dragged
-    java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
+    DataFlavor[] flavors = evt.getCurrentDataFlavors();
 
     // See if any of the flavors are a file list
@@ -534,5 +387,5 @@
         // Is the flavor a file list?
         final DataFlavor curFlavor = flavors[i];
-        if( curFlavor.equals( java.awt.datatransfer.DataFlavor.javaFileListFlavor ) ||
+        if( curFlavor.equals( DataFlavor.javaFileListFlavor ) ||
                 curFlavor.isRepresentationClassReader()){
             ok = true;
@@ -542,24 +395,14 @@
     }   // end while: through flavors
 
-    // If logging is enabled, show data flavors
-    if( out != null )
-    {   if( flavors.length == 0 ) {
-        log( out, "FileDrop: no data flavors." );
+    // show data flavors
+    if( flavors.length == 0 ) {
+        Main.debug("FileDrop: no data flavors." );
     }
     for( i = 0; i < flavors.length; i++ ) {
-        log( out, flavors[i].toString() );
+        Main.debug(flavors[i].toString() );
     }
-    }   // end if: logging enabled
 
     return ok;
     }   // end isDragOk
-
-    /** Outputs <tt>message</tt> to <tt>out</tt> if it's not null. */
-    private static void log( java.io.PrintStream out, String message )
-    {   // Log message if requested
-        if( out != null ) {
-            out.println( message );
-        }
-    }   // end log
 
     /**
@@ -571,8 +414,8 @@
      *
      * @param c The component to unregister as a drop target
-     * @since 1.0
+     * @return {@code true} if at least one item has been removed, {@code false} otherwise 
      */
-    public static boolean remove( java.awt.Component c)
-    {   return remove( null, c, true );
+    public static boolean remove( Component c)
+    {   return remove( c, true );
     }   // end remove
 
@@ -582,22 +425,20 @@
      * components after you've set up the drag-and-drop.
      *
-     * @param out Optional {@link java.io.PrintStream} for logging drag and drop messages
      * @param c The component to unregister
      * @param recursive Recursively unregister components within a container
-     * @since 1.0
+     * @return {@code true} if at least one item has been removed, {@code false} otherwise
      */
-    public static boolean remove( java.io.PrintStream out, java.awt.Component c, boolean recursive )
+    public static boolean remove( Component c, boolean recursive )
     {   // Make sure we support dnd.
-        if( supportsDnD() )
-        {   log( out, "FileDrop: Removing drag-and-drop hooks." );
-        c.setDropTarget( null );
-        if( recursive && ( c instanceof java.awt.Container ) )
-        {   java.awt.Component[] comps = ((java.awt.Container)c).getComponents();
-        for( int i = 0; i < comps.length; i++ ) {
-            remove( out, comps[i], recursive );
-        }
-        return true;
-        }   // end if: recursive
-        else return false;
+        if (supportsDnD()) {
+            Main.debug("FileDrop: Removing drag-and-drop hooks.");
+            c.setDropTarget(null);
+            if (recursive && (c instanceof Container)) {
+                for (Component comp : ((Container) c).getComponents()) {
+                    remove(comp, recursive);
+                }
+                return true;
+            }   // end if: recursive
+            else return false;
         }   // end if: supports DnD
         else return false;
@@ -618,6 +459,4 @@
      *      ...
      * </pre></code>
-     *
-     * @since 1.1
      */
     public static interface Listener {
@@ -627,7 +466,6 @@
          *
          * @param files An array of <tt>File</tt>s that were dropped.
-         * @since 1.0
-         */
-        public abstract void filesDropped( java.io.File[] files );
+         */
+        public abstract void filesDropped( File[] files );
 
     }   // end inner-interface Listener
@@ -647,7 +485,7 @@
      * @version 1.2
      */
-    public static class Event extends java.util.EventObject {
-
-        private java.io.File[] files;
+    public static class Event extends EventObject {
+
+        private File[] files;
 
         /**
@@ -658,7 +496,6 @@
          * @param files The array of files that were dropped
          * @param source The event source
-         * @since 1.1
-         */
-        public Event( java.io.File[] files, Object source ) {
+         */
+        public Event( File[] files, Object source ) {
             super( source );
             this.files = files;
@@ -670,7 +507,6 @@
          *
          * @return array of files that were dropped
-         * @since 1.1
-         */
-        public java.io.File[] getFiles() {
+         */
+        public File[] getFiles() {
             return files;
         }   // end getFiles
@@ -722,11 +558,9 @@
      * @version 1.2
      */
-    public static class TransferableObject implements java.awt.datatransfer.Transferable
+    public static class TransferableObject implements Transferable
     {
         /**
          * The MIME type for {@link #DATA_FLAVOR} is
          * <tt>application/x-net.iharder.dnd.TransferableObject</tt>.
-         *
-         * @since 1.1
          */
         public final static String MIME_TYPE = "application/x-net.iharder.dnd.TransferableObject";
@@ -738,14 +572,12 @@
          * and the MIME type
          * <tt>application/x-net.iharder.dnd.TransferableObject</tt>.
-         *
-         * @since 1.1
-         */
-        public final static java.awt.datatransfer.DataFlavor DATA_FLAVOR =
-            new java.awt.datatransfer.DataFlavor( FileDrop.TransferableObject.class, MIME_TYPE );
+         */
+        public final static DataFlavor DATA_FLAVOR =
+            new DataFlavor( FileDrop.TransferableObject.class, MIME_TYPE );
 
         private Fetcher fetcher;
         private Object data;
 
-        private java.awt.datatransfer.DataFlavor customFlavor;
+        private DataFlavor customFlavor;
 
         /**
@@ -757,9 +589,8 @@
          *
          * @param data The data to transfer
-         * @since 1.1
          */
         public TransferableObject( Object data )
         {   this.data = data;
-        this.customFlavor = new java.awt.datatransfer.DataFlavor( data.getClass(), MIME_TYPE );
+            this.customFlavor = new DataFlavor( data.getClass(), MIME_TYPE );
         }   // end constructor
 
@@ -772,5 +603,4 @@
          * @see Fetcher
          * @param fetcher The {@link Fetcher} that will return the data object
-         * @since 1.1
          */
         public TransferableObject( Fetcher fetcher )
@@ -789,9 +619,8 @@
          * @param dataClass The {@link java.lang.Class} to use in the custom data flavor
          * @param fetcher The {@link Fetcher} that will return the data object
-         * @since 1.1
          */
         public TransferableObject(Class<?> dataClass, Fetcher fetcher )
         {   this.fetcher = fetcher;
-        this.customFlavor = new java.awt.datatransfer.DataFlavor( dataClass, MIME_TYPE );
+        this.customFlavor = new DataFlavor( dataClass, MIME_TYPE );
         }   // end constructor
 
@@ -802,7 +631,6 @@
          *
          * @return The custom data flavor for the encapsulated object
-         * @since 1.1
-         */
-        public java.awt.datatransfer.DataFlavor getCustomDataFlavor()
+         */
+        public DataFlavor getCustomDataFlavor()
         {   return customFlavor;
         }   // end getCustomDataFlavor
@@ -815,22 +643,21 @@
          * second the default {@link #DATA_FLAVOR} associated with
          * {@link TransferableObject}, and third the
-         * {@link java.awt.datatransfer.DataFlavor.stringFlavor}.
+         * {@link java.awt.datatransfer.DataFlavor#stringFlavor}.
          *
          * @return An array of supported data flavors
-         * @since 1.1
          */
         @Override
-        public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
+        public DataFlavor[] getTransferDataFlavors()
         {
             if( customFlavor != null )
-                return new java.awt.datatransfer.DataFlavor[]
+                return new DataFlavor[]
                                                             {   customFlavor,
                     DATA_FLAVOR,
-                    java.awt.datatransfer.DataFlavor.stringFlavor
+                    DataFlavor.stringFlavor
                                                             };  // end flavors array
             else
-                return new java.awt.datatransfer.DataFlavor[]
+                return new DataFlavor[]
                                                             {   DATA_FLAVOR,
-                    java.awt.datatransfer.DataFlavor.stringFlavor
+                    DataFlavor.stringFlavor
                                                             };  // end flavors array
         }   // end getTransferDataFlavors
@@ -845,9 +672,8 @@
          * @param flavor The data flavor for the data to return
          * @return The dropped data
-         * @since 1.1
          */
         @Override
-        public Object getTransferData( java.awt.datatransfer.DataFlavor flavor )
-        throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
+        public Object getTransferData( DataFlavor flavor )
+        throws UnsupportedFlavorException, IOException
         {
             // Native object
@@ -856,9 +682,9 @@
 
             // String
-            if( flavor.equals( java.awt.datatransfer.DataFlavor.stringFlavor ) )
+            if( flavor.equals( DataFlavor.stringFlavor ) )
                 return fetcher == null ? data.toString() : fetcher.getObject().toString();
 
                 // We can't do anything else
-                throw new java.awt.datatransfer.UnsupportedFlavorException(flavor);
+                throw new UnsupportedFlavorException(flavor);
         }   // end getTransferData
 
@@ -869,8 +695,7 @@
          * @param flavor The data flavor to check
          * @return Whether or not the flavor is supported
-         * @since 1.1
          */
         @Override
-        public boolean isDataFlavorSupported( java.awt.datatransfer.DataFlavor flavor )
+        public boolean isDataFlavorSupported( DataFlavor flavor )
         {
             // Native object
@@ -879,5 +704,5 @@
 
             // String
-            if( flavor.equals( java.awt.datatransfer.DataFlavor.stringFlavor ) )
+            if( flavor.equals( DataFlavor.stringFlavor ) )
                 return true;
 
@@ -897,5 +722,4 @@
          *
          * @author Robert Harder
-         * @since 1.1
          */
         public static interface Fetcher
@@ -906,5 +730,4 @@
              *
              * @return The dropped object
-             * @since 1.1
              */
             public abstract Object getObject();
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java	(revision 6104)
@@ -16,5 +16,4 @@
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Set;
@@ -382,7 +381,6 @@
                     getSize()
             );
-            Iterator<ListDataListener> it = listeners.iterator();
-            while(it.hasNext()) {
-                it.next().contentsChanged(evt);
+            for (ListDataListener listener : listeners) {
+                listener.contentsChanged(evt);
             }
         }
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java	(revision 6104)
@@ -391,7 +391,7 @@
     protected void setContentVisible(boolean visible) {
         Component[] comps = getComponents();
-        for(int i=0; i<comps.length; i++) {
-            if (comps[i] != titleBar && (!visible || comps[i] != buttonsPanel || buttonHiding != ButtonHiddingType.ALWAYS_HIDDEN)) {
-                comps[i].setVisible(visible);
+        for (Component comp : comps) {
+            if (comp != titleBar && (!visible || comp != buttonsPanel || buttonHiding != ButtonHiddingType.ALWAYS_HIDDEN)) {
+                comp.setVisible(visible);
             }
         }
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 6104)
@@ -26,9 +26,6 @@
 import java.util.Collections;
 import java.util.EnumSet;
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
@@ -773,12 +770,10 @@
                 return primitives;
             ArrayList<OsmPrimitive> ret = new ArrayList<OsmPrimitive>();
-            Iterator<OsmPrimitive> it = primitives.iterator();
-            while(it.hasNext()) {
-                OsmPrimitive primitive = it.next();
+            for (OsmPrimitive primitive : primitives) {
                 if (primitive instanceof Relation && getRelation() != null && getRelation().equals(primitive)) {
                     warnOfCircularReferences(primitive);
                     continue;
                 }
-                if (isPotentialDuplicate(primitive))  {
+                if (isPotentialDuplicate(primitive)) {
                     if (confirmAddingPrimitive(primitive)) {
                         ret.add(primitive);
Index: /trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java	(revision 6104)
@@ -49,7 +49,7 @@
     protected void registerBoundingBoxBuilder() {
         BoundingBoxBuilder bboxbuilder = new BoundingBoxBuilder();
-        for (int i = 0;i < latlon.length; i++) {
-            latlon[i].addFocusListener(bboxbuilder);
-            latlon[i].addActionListener(bboxbuilder);
+        for (JosmTextField ll : latlon) {
+            ll.addFocusListener(bboxbuilder);
+            ll.addActionListener(bboxbuilder);
         }
     }
Index: /trunk/src/org/openstreetmap/josm/gui/io/ActionFlagsTableCell.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/ActionFlagsTableCell.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/io/ActionFlagsTableCell.java	(revision 6104)
@@ -55,6 +55,5 @@
 
         ActionMap am = getActionMap();
-        for(int i=0; i<checkBoxes.length; i++) {
-            final JCheckBox b = checkBoxes[i];
+        for (final JCheckBox b : checkBoxes) {
             add(b, GBC.eol().fill(GBC.HORIZONTAL));
             b.setPreferredSize(new Dimension(b.getPreferredSize().width, 19));
Index: /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 6104)
@@ -274,8 +274,7 @@
         images = new GeorefImage[dax][day];
         if (old != null) {
-            for (int i=0; i<old.length; i++) {
-                for (int k=0; k<old[i].length; k++) {
-                    GeorefImage o = old[i][k];
-                    images[modulo(o.getXIndex(),dax)][modulo(o.getYIndex(),day)] = old[i][k];
+            for (GeorefImage[] row : old) {
+                for (GeorefImage image : row) {
+                    images[modulo(image.getXIndex(), dax)][modulo(image.getYIndex(), day)] = image;
                 }
             }
Index: /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java	(revision 6104)
@@ -34,5 +34,4 @@
 import java.util.Date;
 import java.util.Hashtable;
-import java.util.Iterator;
 import java.util.List;
 import java.util.TimeZone;
@@ -452,7 +451,5 @@
         Collection<Layer> layerLst = Main.map.mapView.getAllLayers();
         GpxDataWrapper defaultItem = null;
-        Iterator<Layer> iterLayer = layerLst.iterator();
-        while (iterLayer.hasNext()) {
-            Layer cur = iterLayer.next();
+        for (Layer cur : layerLst) {
             if (cur instanceof GpxLayer) {
                 GpxLayer curGpx = (GpxLayer) cur;
Index: /trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java	(revision 6104)
@@ -91,5 +91,5 @@
             }
             String names = null;
-            for (int i = 0; i < sel.length; i++) {
+            for (File file : sel) {
                 if (names == null) {
                     names = " (";
@@ -97,5 +97,5 @@
                     names += ", ";
                 }
-                names += sel[i].getName();
+                names += file.getName();
             }
             if (names != null) {
@@ -107,6 +107,6 @@
             double firstStartTime = sel[0].lastModified() / 1000.0 - AudioUtil.getCalibratedDuration(sel[0]);
             Markers m = new Markers();
-            for (int i = 0; i < sel.length; i++) {
-                importAudio(sel[i], ml, firstStartTime, m);
+            for (File file : sel) {
+                importAudio(file, ml, firstStartTime, m);
             }
             Main.main.addLayer(ml);
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 6104)
@@ -11,5 +11,4 @@
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -135,6 +134,5 @@
             StyleList styleList = getStyles().generateStyles(virtualNode, 0.5, null, false).a;
             if (styleList != null) {
-                for (Iterator<ElemStyle> it = styleList.iterator(); it.hasNext(); ) {
-                    ElemStyle style = it.next();
+                for (ElemStyle style : styleList) {
                     if (style instanceof NodeElemStyle) {
                         MapImage mapImage = ((NodeElemStyle) style).mapImage;
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java	(revision 6104)
@@ -514,6 +514,7 @@
                 Set<String> acceptedEulas = new HashSet<String>();
 
-                outer: for (int i = 0; i < lines.length; i++) {
-                    ImageryInfo info = defaultModel.getRow(lines[i]);
+                outer:
+                for (int line : lines) {
+                    ImageryInfo info = defaultModel.getRow(line);
 
                     // Check if an entry with exactly the same values already
Index: /trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java	(revision 6104)
@@ -132,6 +132,5 @@
             List<Changeset> ret = new ArrayList<Changeset>();
             int i=0;
-            for (Iterator<Integer> it = ids.iterator(); it.hasNext(); ) {
-                int id = it.next();
+            for (int id : ids) {
                 if (id <= 0) {
                     continue;
@@ -143,5 +142,5 @@
                 if (in == null)
                     return null;
-                monitor.indeterminateSubTask(tr("({0}/{1}) Downloading changeset {2} ...", i,ids.size(), id));
+                monitor.indeterminateSubTask(tr("({0}/{1}) Downloading changeset {2} ...", i, ids.size(), id));
                 List<Changeset> changesets = OsmChangesetParser.parse(in, monitor.createSubTaskMonitor(1, true));
                 if (changesets == null || changesets.isEmpty()) {
Index: /trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java	(revision 6104)
@@ -338,6 +338,6 @@
             if (Main.main.getCurrentDataSet() != null) {
                 Collection<OsmPrimitive> s = Main.main.getCurrentDataSet().getSelected();
-                for (int j = 0; j < keyValue.length; j++) {
-                    Main.main.undoRedo.add(new ChangePropertyCommand(s, keyValue[j][0], keyValue[j][1]));
+                for (String[] row : keyValue) {
+                    Main.main.undoRedo.add(new ChangePropertyCommand(s, row[0], row[1]));
                 }
             }
Index: /trunk/src/org/openstreetmap/josm/tools/FallbackDateParser.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/FallbackDateParser.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/tools/FallbackDateParser.java	(revision 6104)
@@ -43,6 +43,6 @@
         // Build a list of candidate date parsers.
         dateParsers = new ArrayList<DateFormat>(formats.length);
-        for (int i = 0; i < formats.length; i++) {
-            dateParsers.add(new SimpleDateFormat(formats[i]));
+        for (String format : formats) {
+            dateParsers.add(new SimpleDateFormat(format));
         }
 
Index: /trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 6104)
@@ -281,10 +281,9 @@
         if( path.exists() ) {
             File[] files = path.listFiles();
-            for(int i=0; i<files.length; i++) {
-                if(files[i].isDirectory()) {
-                    deleteDirectory(files[i]);
-                }
-                else {
-                    files[i].delete();
+            for (File file : files) {
+                if (file.isDirectory()) {
+                    deleteDirectory(file);
+                } else {
+                    file.delete();
                 }
             }
Index: /trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java	(revision 6103)
+++ /trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java	(revision 6104)
@@ -296,6 +296,5 @@
                 .getLocalGraphicsEnvironment();
         GraphicsDevice[] gs = ge.getScreenDevices();
-        for (int j = 0; j < gs.length; j++) {
-            GraphicsDevice gd = gs[j];
+        for (GraphicsDevice gd : gs) {
             if (gd.getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
                 virtualBounds = virtualBounds.union(gd.getDefaultConfiguration().getBounds());
@@ -346,14 +345,12 @@
         int intersect = 0;
         Rectangle bounds = null;
-        for (int j = 0; j < gs.length; j++) {
-            GraphicsDevice gd = gs[j];
+        for (GraphicsDevice gd : gs) {
             if (gd.getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
                 Rectangle b = gd.getDefaultConfiguration().getBounds();
-                if (b.height > 0 && b.width/b.height >= 3) /* multiscreen with wrong definition */
-                {
+                if (b.height > 0 && b.width / b.height >= 3) /* multiscreen with wrong definition */ {
                     b.width /= 2;
                     Rectangle is = b.intersection(g);
-                    int s = is.width*is.height;
-                    if(bounds == null || intersect < s) {
+                    int s = is.width * is.height;
+                    if (bounds == null || intersect < s) {
                         intersect = s;
                         bounds = b;
@@ -362,15 +359,13 @@
                     b.x += b.width;
                     is = b.intersection(g);
-                    s = is.width*is.height;
-                    if(bounds == null || intersect < s) {
+                    s = is.width * is.height;
+                    if (bounds == null || intersect < s) {
                         intersect = s;
                         bounds = b;
                     }
-                }
-                else
-                {
+                } else {
                     Rectangle is = b.intersection(g);
-                    int s = is.width*is.height;
-                    if(bounds == null || intersect < s) {
+                    int s = is.width * is.height;
+                    if (bounds == null || intersect < s) {
                         intersect = s;
                         bounds = b;
