Index: /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java
===================================================================
--- /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java	(revision 12777)
+++ /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java	(revision 12778)
@@ -40,7 +40,7 @@
  */
 public class UploadDataGui extends javax.swing.JFrame {
- 
- String tagging;   
- String Descriptionfield;  
+
+ String tagging;
+ String Descriptionfield;
  String urlDescription;
  String urlTags;
@@ -48,10 +48,10 @@
  String PassWord;
  //GpxData gpxData;
-         
+
         public static final String API_VERSION = "0.5";
         private static final String BASE64_ENC = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
         private static final String BOUNDARY = "----------------------------d10f7aa230e8";
         private static final String LINE_END = "\r\n";
-     
+
         boolean dfield;
         boolean taggy;
@@ -60,9 +60,9 @@
         boolean pass;
         boolean publicheck;
-     
+
         DateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmss");
-        Date date = new Date();    
+        Date date = new Date();
         String datename = dateFormat.format(date);
-  
+
     /** Creates new form UploadDataGui */
     public UploadDataGui() {
@@ -70,5 +70,5 @@
     }
 
-  
+
     /** This method is called from within the constructor to
      * initialize the form.
@@ -142,35 +142,35 @@
 
 
-	
-	Container contentPane = getContentPane();
-	contentPane.setLayout(new GridBagLayout());
-	GridBagConstraints c = new GridBagConstraints();
-
-	c.gridx = 0;
-	c.gridy = 0;
-	c.gridwidth = 2;
-	c.fill = 1;
-	contentPane.add(OutputDisplay, c);
-
-	c.gridwidth = 1;
-	c.gridy = 1;
-	contentPane.add(jLabel3, c);
-	c.gridx = 1;
-	contentPane.add(tagfield, c);
-
-	c.gridy = 2; c.gridx = 0;
-	contentPane.add(jLabel1, c);
-	c.gridx = 1;
-	contentPane.add(descriptionfield, c);
-
-	c.gridy = 3; c.gridx = 0;
-	contentPane.add(jLabel2, c);
-	c.gridx = 1;
-	contentPane.add(PublicTrace, c);
-
-	c.gridy = 4; c.gridx = 0;
-	contentPane.add(CancelButton, c);
-	c.gridx = 1;
-	contentPane.add(OkButton, c);
+
+    Container contentPane = getContentPane();
+    contentPane.setLayout(new GridBagLayout());
+    GridBagConstraints c = new GridBagConstraints();
+
+    c.gridx = 0;
+    c.gridy = 0;
+    c.gridwidth = 2;
+    c.fill = 1;
+    contentPane.add(OutputDisplay, c);
+
+    c.gridwidth = 1;
+    c.gridy = 1;
+    contentPane.add(jLabel3, c);
+    c.gridx = 1;
+    contentPane.add(tagfield, c);
+
+    c.gridy = 2; c.gridx = 0;
+    contentPane.add(jLabel1, c);
+    c.gridx = 1;
+    contentPane.add(descriptionfield, c);
+
+    c.gridy = 3; c.gridx = 0;
+    contentPane.add(jLabel2, c);
+    c.gridx = 1;
+    contentPane.add(PublicTrace, c);
+
+    c.gridy = 4; c.gridx = 0;
+    contentPane.add(CancelButton, c);
+    c.gridx = 1;
+    contentPane.add(OkButton, c);
 
         pack();
@@ -181,15 +181,15 @@
 public void upload(String username, String password, String Descriptionfield, String tagging , GpxData gpxData ) throws IOException {
         OutputDisplay.setText("Starting to upload selected file to openstreetmap.org");
-    
+
     try {
-        
+
         urlDescription = Descriptionfield.replaceAll("\\.;&?,/","_");
         if (urlDescription == null || urlDescription.length() == 0) {
              OutputDisplay.setText("No description provided .Please provide some description . For the time being ignore the exception error ");
-           
+
         }
            urlTags = tagging.replaceAll("\\\\.;&?,/","_");
-      
-       
+
+
         URL url = new URL("http://www.openstreetmap.org/api/" + API_VERSION + "/gpx/create");
             System.err.println("url: " + url);
@@ -212,14 +212,14 @@
         writeContentDisposition(out, "public", "1");
            } else {
-        writeContentDisposition(out, "public", "0");   
+        writeContentDisposition(out, "public", "0");
            }
         out.writeBytes("--" + BOUNDARY + "--" + LINE_END);
         out.flush();
-      
+
         int returnCode = connect.getResponseCode();
             String returnMsg = connect.getResponseMessage();
             System.err.println(returnCode);
             OutputDisplay.setText(returnMsg);
-        if (returnCode != 200) {  
+        if (returnCode != 200) {
             if (connect.getHeaderField("Error") != null)
                returnMsg += "\n" + connect.getHeaderField("Error");
@@ -228,11 +228,11 @@
         out.close();
         connect.disconnect();
-       
-        } catch(UnsupportedEncodingException ignore) { 
+
+        } catch(UnsupportedEncodingException ignore) {
         } catch (MalformedURLException e) {
                 OutputDisplay.setText("Cant Upload .");
                 e.printStackTrace();
     }
-  
+
 }
 
@@ -246,9 +246,9 @@
 
 private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
-     GpxData gpxData; 
-       
-        UserName  =  Main.pref.get("osm-server.username");   
+     GpxData gpxData;
+
+        UserName  =  Main.pref.get("osm-server.username");
         PassWord =   Main.pref.get("osm-server.password");
-        
+
         if(Main.map == null || Main.map.mapView == null ||Main.map.mapView.getActiveLayer() == null ||
                 !(Main.map.mapView.getActiveLayer() instanceof GpxLayer)){
@@ -260,10 +260,10 @@
         gpxData = ((GpxLayer)Main.map.mapView.getActiveLayer()).data;
                 System.out.println(Descriptionfield);
-        try { 
+        try {
                 upload(UserName,PassWord,Descriptionfield ,tagging ,gpxData) ;
         } catch (IOException ex) {
                 Logger.getLogger(UploadDataGui.class.getName()).log(Level.SEVERE, null, ex);
-    }     
-    
+    }
+
 }//GEN-LAST:event_OkButtonActionPerformed
 
@@ -276,5 +276,5 @@
     if (evt.getStateChange() == ItemEvent.SELECTED) {
         publicheck = true;
-         
+
     }
 }//GEN-LAST:event_PublicTraceItemStateChanged
@@ -284,5 +284,5 @@
      JTextField Descsel = (JTextField)evt.getSource();
         Descriptionfield =  Descsel.getText();
-    
+
 }//GEN-LAST:event_descriptionfieldFocusLost
 
@@ -291,5 +291,5 @@
      JTextField Tagsel = (JTextField)evt.getSource();
         tagging =  Tagsel.getText();
-    
+
 }//GEN-LAST:event_tagfieldFocusLost
 
@@ -300,9 +300,9 @@
         out.writeBytes(LINE_END);
         out.writeBytes(value + LINE_END);
-        
+
     }
 
     private void writeContentDispositionGpxData(DataOutputStream out, String name, GpxData gpxData ) throws IOException {
-    
+
         out.writeBytes("--" + BOUNDARY + LINE_END);
         out.writeBytes("Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + datename +".gpx" + "\"" + LINE_END);
@@ -310,13 +310,13 @@
         out.writeBytes("Content-Type: application/octet-stream" + LINE_END);
         out.writeBytes(LINE_END);
-          
+
         OutputDisplay.setText("Transferring data to server");
             new GpxWriter(out).write(gpxData);
         out.flush();
-        out.writeBytes(LINE_END); 
-     
-    }
-    
- // Taken from Christof Dallermassal java class :  
+        out.writeBytes(LINE_END);
+
+    }
+
+ // Taken from Christof Dallermassal java class :
 public String encodeBase64(String s) {
         StringBuilder out = new StringBuilder();
@@ -328,8 +328,8 @@
             out.append(l>1 ? BASE64_ENC.charAt((buf.charAt(1) & 0x0f) << 2 | (l==2 ? 0 : (buf.charAt(2) & 0xc0) >> 6)) : '=');
             out.append(l>2 ? BASE64_ENC.charAt(buf.charAt(2) & 0x3f) : '=');
-           
+
         }
         return out.toString();
-        }    
+        }
 
     // Variables declaration - do not modify//GEN-BEGIN:variables
Index: /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java
===================================================================
--- /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java	(revision 12778)
@@ -2,5 +2,5 @@
  *  Copyright by Subhodip Biswas
  *  This program is free software and licensed under GPL.
- * 
+ *
  */
 
Index: /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojDialog.java
===================================================================
--- /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojDialog.java	(revision 12777)
+++ /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojDialog.java	(revision 12778)
@@ -1,4 +1,4 @@
 // License: GPL. Copyright 2007 by Christian Gallioz (aka khris78)
-// Parts of code from Geotagged plugin (by Rob Neild) 
+// Parts of code from Geotagged plugin (by Rob Neild)
 // and the core JOSM source code (by Immanuel Scholz and others)
 
@@ -34,8 +34,8 @@
     private ImageDisplay imgDisplay = new ImageDisplay();
     private boolean centerView = false;
-    
+
     // Only one instance of that class
     static private AgpifojDialog INSTANCE = null;
-    
+
     public static AgpifojDialog getInstance() {
         if (INSTANCE == null) {
@@ -51,17 +51,17 @@
             throw new IllegalStateException("Agpifoj dialog should not be instanciated twice !");
         }
-        
+
         INSTANCE = this;
-        
+
         JPanel content = new JPanel();
         content.setLayout(new BorderLayout());
 
         content.add(imgDisplay, BorderLayout.CENTER);
-        
+
         JPanel buttons = new JPanel();
         buttons.setLayout(new FlowLayout());
-        
+
         JButton button;
-        
+
         Dimension buttonDim = new Dimension(26,26);
         button = new JButton();
@@ -72,5 +72,5 @@
         button.setPreferredSize(buttonDim);
         buttons.add(button);
-        
+
         button = new JButton();
         button.setIcon(ImageProvider.get("dialogs", "delete"));
@@ -80,5 +80,5 @@
         button.setPreferredSize(buttonDim);
         buttons.add(button);
-        
+
         button = new JButton();
         button.setIcon(ImageProvider.get("dialogs", "next"));
@@ -88,5 +88,5 @@
         button.setPreferredSize(buttonDim);
         buttons.add(button);
-        
+
         JToggleButton tb = new JToggleButton();
         tb.setIcon(ImageProvider.get("dialogs", "centreview"));
@@ -96,5 +96,5 @@
         tb.setPreferredSize(buttonDim);
         buttons.add(tb);
-        
+
         button = new JButton();
         button.setIcon(ImageProvider.get("dialogs", "zoom-best-fit"));
@@ -104,9 +104,9 @@
         button.setPreferredSize(buttonDim);
         buttons.add(button);
-        
+
         content.add(buttons, BorderLayout.SOUTH);
 
         add(content, BorderLayout.CENTER);
-        
+
     }
 
@@ -120,5 +120,5 @@
                 currentLayer.showPreviousPhoto();
             }
-            
+
         } else if (COMMAND_CENTERVIEW.equals(e.getActionCommand())) {
             centerView = ((JToggleButton) e.getSource()).isSelected();
@@ -126,8 +126,8 @@
                 Main.map.mapView.zoomTo(currentEntry.pos, Main.map.mapView.getScale());
             }
-            
+
         } else if (COMMAND_ZOOM.equals(e.getActionCommand())) {
             imgDisplay.zoomBestFitOrOne();
-            
+
         } else if (COMMAND_REMOVE.equals(e.getActionCommand())) {
             if (currentLayer != null) {
@@ -135,5 +135,5 @@
             }
         }
-        
+
     }
 
@@ -144,5 +144,5 @@
     private AgpifojLayer currentLayer = null;
     private ImageEntry currentEntry = null;
-    
+
     public void displayImage(AgpifojLayer layer, ImageEntry entry) {
         synchronized(this) {
@@ -151,5 +151,5 @@
                 return;
             }
-        
+
             if (centerView && Main.map != null && entry != null && entry.pos != null) {
                 Main.map.mapView.zoomTo(entry.pos, Main.map.mapView.getScale());
@@ -159,5 +159,5 @@
             currentEntry = entry;
         }
-        
+
         if (entry != null) {
             imgDisplay.setImage(entry.file);
Index: /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java
===================================================================
--- /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java	(revision 12778)
@@ -1,4 +1,4 @@
 // License: GPL. Copyright 2007 by Christian Gallioz (aka khris78)
-// Parts of code from Geotagged plugin (by Rob Neild) 
+// Parts of code from Geotagged plugin (by Rob Neild)
 // and the core JOSM source code (by Immanuel Scholz and others)
 
@@ -48,10 +48,10 @@
 
     List<ImageEntry> data;
-    
+
     private Icon icon = ImageProvider.get("dialogs/agpifoj-marker");
     private Icon selectedIcon = ImageProvider.get("dialogs/agpifoj-marker-selected");
-    
+
     private int currentPhoto = -1;
-    
+
     /*
      * Stores info about each image
@@ -83,7 +83,7 @@
 
     /** Loads a set of images, while displaying a dialog that indicates what the plugin is currently doing.
-     * In facts, this object is instantiated with a list of files. These files may be JPEG files or 
-     * directories. In case of directories, they are scanned to find all the images they contain. 
-     * Then all the images that have be found are loaded as ImageEntry instances. 
+     * In facts, this object is instantiated with a list of files. These files may be JPEG files or
+     * directories. In case of directories, they are scanned to find all the images they contain.
+     * Then all the images that have be found are loaded as ImageEntry instances.
      */
     private static final class Loader extends PleaseWaitRunnable {
@@ -93,5 +93,5 @@
         private final File[] selection;
         private HashSet<String> loadedDirectories = new HashSet<String>();
-        
+
         public Loader(File[] selection) {
             super(tr("Extracting GPS locations from EXIF"));
@@ -108,9 +108,9 @@
                 errorMessage += tr("One of the selected files was null !!!");
             }
-            
+
             if (cancelled) {
                 return;
             }
-            
+
             Main.pleaseWaitDlg.currentAction.setText(tr("Read photos..."));
 
@@ -121,5 +121,5 @@
             Main.pleaseWaitDlg.progress.setMaximum(files.size());
             Main.pleaseWaitDlg.progress.setValue(progress);
-            
+
             for (File f : files) {
 
@@ -149,16 +149,16 @@
         }
 
-        private void addRecursiveFiles(List<File> files, File[] sel) { 
+        private void addRecursiveFiles(List<File> files, File[] sel) {
             boolean nullFile = false;
-            
+
             for (File f : sel) {
-                
+
                 if(cancelled) {
                     break;
                 }
-                
+
                 if (f == null) {
                     nullFile = true;
-                    
+
                 } else if (f.isDirectory()) {
                     String canonical = null;
@@ -167,8 +167,8 @@
                     } catch (IOException e) {
                         e.printStackTrace();
-                        errorMessage += tr("Unable to get canonical path for directory {0}\n", 
+                        errorMessage += tr("Unable to get canonical path for directory {0}\n",
                                            f.getAbsolutePath());
                     }
-                    
+
                     if (canonical == null || loadedDirectories.contains(canonical)) {
                         continue;
@@ -176,5 +176,5 @@
                         loadedDirectories.add(canonical);
                     }
-                    
+
                     File[] children = f.listFiles(AgpifojPlugin.JPEG_FILE_FILTER);
                     if (children != null) {
@@ -189,10 +189,10 @@
                         errorMessage += tr("Error while getting files from directory {0}\n", f.getPath());
                     }
-                    
+
                 } else {
                       files.add(f);
                 }
             }
-            
+
             if (nullFile) {
                 throw new NullPointerException();
@@ -251,5 +251,5 @@
     @Override
     public Component[] getMenuEntries() {
-        
+
         JMenuItem correlateItem = new JMenuItem(tr("Correlate to GPX"), ImageProvider.get("dialogs/gpx2img"));
         correlateItem.addActionListener(new CorrelateGpxWithImages(this));
@@ -283,12 +283,12 @@
         AgpifojLayer l = (AgpifojLayer) from;
 
-        ImageEntry selected = null; 
+        ImageEntry selected = null;
         if (l.currentPhoto >= 0) {
             selected = l.data.get(l.currentPhoto);
         }
-        
+
         data.addAll(l.data);
         Collections.sort(data);
-        
+
         // Supress the double photos.
         if (data.size() > 1) {
@@ -304,5 +304,5 @@
             }
         }
-        
+
         if (selected != null) {
             for (int i = 0; i < data.size() ; i++) {
@@ -314,7 +314,7 @@
             }
         }
-        
+
         name = l.name;
-        
+
     }
 
@@ -324,5 +324,5 @@
         int iconWidth = icon.getIconWidth() / 2;
         int iconHeight = icon.getIconHeight() / 2;
-        
+
         for (ImageEntry e : data) {
             if (e.pos != null) {
@@ -331,10 +331,10 @@
                 Rectangle r = new Rectangle(p.x - iconWidth,
                                             p.y - iconHeight,
-                                            icon.getIconWidth(), 
+                                            icon.getIconWidth(),
                                             icon.getIconHeight());
                 icon.paintIcon(mv, g, r.x, r.y);
             }
         }
-        
+
         // Draw the selection on top of the other pictures.
         if (currentPhoto >= 0 && currentPhoto < data.size()) {
@@ -346,5 +346,5 @@
                 Rectangle r = new Rectangle(p.x - selectedIcon.getIconWidth() / 2,
                                             p.y - selectedIcon.getIconHeight() / 2,
-                                            selectedIcon.getIconWidth(), 
+                                            selectedIcon.getIconWidth(),
                                             selectedIcon.getIconHeight());
                 selectedIcon.paintIcon(mv, g, r.x, r.y);
@@ -361,5 +361,5 @@
     /*
      * Extract gps from image exif
-     * 
+     *
      * If successful, fills in the LatLon and EastNorth attributes of passed in
      * image;
@@ -414,5 +414,5 @@
         }
     }
-    
+
     public void showNextPhoto() {
         if (data != null && data.size() > 0) {
@@ -427,5 +427,5 @@
         Main.main.map.repaint();
     }
-    
+
     public void showPreviousPhoto() {
         if (data != null && data.size() > 0) {
@@ -440,5 +440,5 @@
         Main.main.map.repaint();
     }
-    
+
     public void removeCurrentPhoto() {
         if (data != null && data.size() > 0 && currentPhoto >= 0 && currentPhoto < data.size()) {
@@ -455,5 +455,5 @@
         Main.main.map.repaint();
     }
-    
+
     private MouseAdapter mouseAdapter = null;
 
@@ -481,7 +481,7 @@
                         continue;
                     Point p = Main.map.mapView.getPoint(e.pos);
-                    Rectangle r = new Rectangle(p.x - icon.getIconWidth() / 2, 
-                                                p.y - icon.getIconHeight() / 2, 
-                                                icon.getIconWidth(), 
+                    Rectangle r = new Rectangle(p.x - icon.getIconWidth() / 2,
+                                                p.y - icon.getIconHeight() / 2,
+                                                icon.getIconWidth(),
                                                 icon.getIconHeight());
                     if (r.contains(ev.getPoint())) {
Index: /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojPlugin.java
===================================================================
--- /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojPlugin.java	(revision 12778)
@@ -1,4 +1,4 @@
 // License: GPL. Copyright 2007 by Christian Gallioz (aka khris78)
-// Parts of code from Geotagged plugin (by Rob Neild) 
+// Parts of code from Geotagged plugin (by Rob Neild)
 // and the core JOSM source code (by Immanuel Scholz and others)
 
@@ -23,8 +23,8 @@
 
 public class AgpifojPlugin extends Plugin {
-    
-    static class JpegFileFilter extends javax.swing.filechooser.FileFilter 
+
+    static class JpegFileFilter extends javax.swing.filechooser.FileFilter
                                         implements java.io.FileFilter {
-        
+
         @Override public boolean accept(File f) {
             if (f.isDirectory()) {
@@ -40,7 +40,7 @@
         }
     };
-    
+
     static final JpegFileFilter JPEG_FILE_FILTER = new JpegFileFilter();
-    
+
     private class Action extends JosmAction {
 
@@ -59,18 +59,18 @@
             fc.setAcceptAllFileFilterUsed(false);
             fc.setFileFilter(JPEG_FILE_FILTER);
-            
+
             fc.showOpenDialog(Main.parent);
-            
+
             File[] sel = fc.getSelectedFiles();
             if (sel == null || sel.length == 0) {
                 return;
             }
-            
+
             Main.pref.put("tagimages.lastdirectory", fc.getCurrentDirectory().getPath());
-            
+
             AgpifojLayer.create(sel);
         }
     }
-    
+
     public AgpifojPlugin() {
         MainMenu.add(Main.main.menu.fileMenu, new Action());
Index: /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java
===================================================================
--- /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java	(revision 12777)
+++ /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java	(revision 12778)
@@ -1,4 +1,4 @@
 // License: GPL. Copyright 2007 by Christian Gallioz (aka khris78)
-// Parts of code from Geotagged plugin (by Rob Neild) 
+// Parts of code from Geotagged plugin (by Rob Neild)
 // and the core JOSM source code (by Immanuel Scholz and others)
 
@@ -64,5 +64,5 @@
 import org.xml.sax.SAXException;
 
-/** This class displays the window to select the GPX file and the offset (timezone + delta). 
+/** This class displays the window to select the GPX file and the offset (timezone + delta).
  * Then it correlates the images of the layer with that GPX file.
  */
@@ -76,23 +76,23 @@
         long offset;
     }
-    
+
     AgpifojLayer yLayer = null;
-    
+
     private static class GpxDataWrapper {
         String name;
         GpxData data;
         File file;
-        
+
         public GpxDataWrapper(String name, GpxData data, File file) {
             this.name = name;
-            this.data = data; 
+            this.data = data;
             this.file = file;
         }
-        
+
         public String toString() {
             return name;
         }
     }
-    
+
     Vector gpxLst = new Vector();
     JPanel panel = null;
@@ -103,10 +103,10 @@
     JRadioButton rbUntaggedImg = null;
     JRadioButton rbNoExifImg = null;
-    
-    /** This class is called when the user doesn't find the GPX file he needs in the files that have 
+
+    /** This class is called when the user doesn't find the GPX file he needs in the files that have
      * been loaded yet. It displays a FileChooser dialog to select the GPX file to be loaded.
-     */ 
+     */
     private class LoadGpxDataActionListener implements ActionListener {
-        
+
         public void actionPerformed(ActionEvent arg0) {
             JFileChooser fc = new JFileChooser(Main.pref.get("lastDirectory"));
@@ -118,5 +118,5 @@
                 @Override public boolean accept(File f) {
                     return (f.isDirectory()
-                            || f .getName().toLowerCase().endsWith(".gpx") 
+                            || f .getName().toLowerCase().endsWith(".gpx")
                             || f.getName().toLowerCase().endsWith(".gpx.gz"));
                 }
@@ -129,17 +129,17 @@
             if (sel == null)
                 return;
-            
+
             try {
                 panel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-                
+
                 Main.pref.put("lastDirectory", sel.getPath());
-                
+
                 for (int i = gpxLst.size() - 1 ; i >= 0 ; i--) {
                     if (gpxLst.get(i) instanceof GpxDataWrapper) {
-                        GpxDataWrapper wrapper = (GpxDataWrapper) gpxLst.get(i); 
+                        GpxDataWrapper wrapper = (GpxDataWrapper) gpxLst.get(i);
                         if (sel.equals(wrapper.file)) {
                             cbGpx.setSelectedIndex(i);
                             if (!sel.getName().equals(wrapper.name)) {
-                                JOptionPane.showMessageDialog(Main.parent, 
+                                JOptionPane.showMessageDialog(Main.parent,
                                         tr("File {0} is loaded yet under the name \"{1}\"", sel.getName(), wrapper.name));
                             }
@@ -154,9 +154,9 @@
                         iStream = new GZIPInputStream(new FileInputStream(sel));
                     } else {
-                        iStream = new FileInputStream(sel); 
+                        iStream = new FileInputStream(sel);
                     }
                     data = new GpxReader(iStream, sel).data;
                     data.storageFile = sel;
-               
+
                 } catch (SAXException x) {
                     x.printStackTrace();
@@ -168,5 +168,5 @@
                     return;
                 }
-                
+
                 loadedGpxData.add(data);
                 if (gpxLst.get(0) instanceof String) {
@@ -180,9 +180,9 @@
         }
     }
-    
-    /** This action listener is called when the user has a photo of the time of his GPS receiver. It 
+
+    /** This action listener is called when the user has a photo of the time of his GPS receiver. It
      * displays the list of photos of the layer, and upon selection displays the selected photo.
-     * From that photo, the user can key in the time of the GPS. 
-     * Then values of timezone and delta are set. 
+     * From that photo, the user can key in the time of the GPS.
+     * Then values of timezone and delta are set.
      * @author chris
      *
@@ -195,5 +195,5 @@
         ImageDisplay imgDisp;
         JList imgList;
-        
+
         public void actionPerformed(ActionEvent arg0) {
             SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
@@ -203,14 +203,14 @@
             panel.add(new JLabel(tr("<html>Take a photo of your GPS receiver while it displays the time.<br>"
                                     + "Display that photo here.<br>"
-                                    + "And then, simply capture the time you read on the photo and select a timezone<hr></html>")), 
+                                    + "And then, simply capture the time you read on the photo and select a timezone<hr></html>")),
                                     BorderLayout.NORTH);
-            
+
             imgDisp = new ImageDisplay();
             imgDisp.setPreferredSize(new Dimension(300, 225));
             panel.add(imgDisp, BorderLayout.CENTER);
-            
+
             JPanel panelTf = new JPanel();
             panelTf.setLayout(new GridBagLayout());
-            
+
             GridBagConstraints gc = new GridBagConstraints();
             gc.gridx = gc.gridy = 0;
@@ -227,5 +227,5 @@
             gc.gridwidth = 2;
             panelTf.add(lbExifTime, gc);
-            
+
             gc.gridx = 0;
             gc.gridy = 1;
@@ -247,5 +247,5 @@
             gc.weightx = 0.2;
             panelTf.add(new JLabel(tr(" [dd/mm/yyyy hh:mm:ss]")), gc);
-            
+
             gc.gridx = 0;
             gc.gridy = 2;
@@ -255,11 +255,11 @@
             gc.anchor = GridBagConstraints.WEST;
             panelTf.add(new JLabel(tr("I'm in the timezone of: ")), gc);
-            
+
             Vector vtTimezones = new Vector<String>();
             String[] tmp = TimeZone.getAvailableIDs();
-            
+
             for (String tzStr : tmp) {
                 TimeZone tz = TimeZone.getTimeZone(tzStr);
-                 
+
                 String tzDesc = new StringBuffer(tzStr).append(" (")
                                         .append(formatTimezone(tz.getRawOffset() / 3600000.0))
@@ -267,9 +267,9 @@
                 vtTimezones.add(tzDesc);
             }
-            
+
             Collections.sort(vtTimezones);
-            
+
             cbTimezones = new JComboBox(vtTimezones);
-            
+
             String tzId = Main.pref.get("tagimages.timezoneid", "");
             TimeZone defaultTz;
@@ -279,9 +279,9 @@
                 defaultTz = TimeZone.getTimeZone(tzId);
             }
-            
+
             cbTimezones.setSelectedItem(new StringBuffer(defaultTz.getID()).append(" (")
                     .append(formatTimezone(defaultTz.getRawOffset() / 3600000.0))
                     .append(')').toString());
-            
+
             gc.gridx = 1;
             gc.weightx = 1.0;
@@ -289,10 +289,10 @@
             gc.fill = GridBagConstraints.HORIZONTAL;
             panelTf.add(cbTimezones, gc);
-            
+
             panel.add(panelTf, BorderLayout.SOUTH);
 
             JPanel panelLst = new JPanel();
             panelLst.setLayout(new BorderLayout());
-            
+
             imgList = new JList(new AbstractListModel() {
                 public Object getElementAt(int i) {
@@ -312,9 +312,9 @@
                     Date date = yLayer.data.get(index).time;
                     if (date != null) {
-                        lbExifTime.setText(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(date));                    
+                        lbExifTime.setText(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(date));
                         tfGpsTime.setText(new SimpleDateFormat("dd/MM/yyyy ").format(date));
                         tfGpsTime.setCaretPosition(tfGpsTime.getText().length());
                         tfGpsTime.setEnabled(true);
-                    } else {                        
+                    } else {
                         lbExifTime.setText(tr("No date"));
                         tfGpsTime.setText("");
@@ -322,8 +322,8 @@
                     }
                 }
-                
+
             });
             panelLst.add(new JScrollPane(imgList), BorderLayout.CENTER);
-            
+
             JButton openButton = new JButton(tr("Open an other photo"));
             openButton.addActionListener(new ActionListener() {
@@ -349,8 +349,8 @@
                     }
                     if (date != null) {
-                        lbExifTime.setText(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(date));                    
+                        lbExifTime.setText(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(date));
                         tfGpsTime.setText(new SimpleDateFormat("dd/MM/yyyy ").format(date));
                         tfGpsTime.setEnabled(true);
-                    } else {                        
+                    } else {
                         lbExifTime.setText(tr("No date"));
                         tfGpsTime.setText("");
@@ -360,7 +360,7 @@
             });
             panelLst.add(openButton, BorderLayout.PAGE_END);
-            
+
             panel.add(panelLst, BorderLayout.LINE_START);
-            
+
             boolean isOk = false;
             while (! isOk) {
@@ -370,32 +370,32 @@
                 }
 
-                long delta; 
-                   
+                long delta;
+
                 try {
-                    delta = dateFormat.parse(lbExifTime.getText()).getTime() 
+                    delta = dateFormat.parse(lbExifTime.getText()).getTime()
                             - dateFormat.parse(tfGpsTime.getText()).getTime();
                 } catch(ParseException e) {
-                    JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing the date.\n" 
-                            + "Please use the requested format"), 
+                    JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing the date.\n"
+                            + "Please use the requested format"),
                             tr("Invalid date"), JOptionPane.ERROR_MESSAGE );
                     continue;
                 }
-                
+
                 String selectedTz = (String) cbTimezones.getSelectedItem();
                 int pos = selectedTz.lastIndexOf('(');
                 tzId = selectedTz.substring(0, pos - 1);
-                String tzValue = selectedTz.substring(pos + 1, selectedTz.length() - 1); 
-                
+                String tzValue = selectedTz.substring(pos + 1, selectedTz.length() - 1);
+
                 Main.pref.put("tagimages.timezoneid", tzId);
                 tfOffset.setText(Long.toString(delta / 1000));
                 tfTimezone.setText(tzValue);
-                
+
                 isOk = true;
-                
-            }
-            
-        }
-    }
-    
+
+            }
+
+        }
+    }
+
     public CorrelateGpxWithImages(AgpifojLayer layer) {
         this.yLayer = layer;
@@ -409,39 +409,39 @@
             Layer cur = iterLayer.next();
             if (cur instanceof GpxLayer) {
-                gpxLst.add(new GpxDataWrapper(((GpxLayer) cur).name, 
-                                              ((GpxLayer) cur).data, 
-                                              ((GpxLayer) cur).data.storageFile)); 
+                gpxLst.add(new GpxDataWrapper(((GpxLayer) cur).name,
+                                              ((GpxLayer) cur).data,
+                                              ((GpxLayer) cur).data.storageFile));
             }
         }
         for (GpxData data : loadedGpxData) {
-            gpxLst.add(new GpxDataWrapper(data.storageFile.getName(), 
+            gpxLst.add(new GpxDataWrapper(data.storageFile.getName(),
                                           data,
-                                          data.storageFile)); 
-        }
-        
+                                          data.storageFile));
+        }
+
         if (gpxLst.size() == 0) {
             gpxLst.add(tr("<No GPX track loaded yet>"));
         }
-        
+
         JPanel panelCb = new JPanel();
         panelCb.setLayout(new FlowLayout());
-        
+
         panelCb.add(new JLabel(tr("GPX track: ")));
-        
+
         cbGpx = new JComboBox(gpxLst);
         panelCb.add(cbGpx);
-        
+
         JButton buttonOpen = new JButton(tr("Open another GPX trace"));
         buttonOpen.setIcon(ImageProvider.get("agpifoj-open"));
         buttonOpen.addActionListener(new LoadGpxDataActionListener());
-        
+
         panelCb.add(buttonOpen);
-        
+
         JPanel panelTf = new JPanel();
         panelTf.setLayout(new GridBagLayout());
-        
+
         GridBagConstraints gc = new GridBagConstraints();
         gc.anchor = GridBagConstraints.WEST;
-        
+
         gc.gridx = gc.gridy = 0;
         gc.gridwidth = gc.gridheight = 1;
@@ -464,5 +464,5 @@
         gc.weighty = 0.0;
         panelTf.add(tfTimezone, gc);
-        
+
         gc.gridx = 0;
         gc.gridy = 1;
@@ -493,5 +493,5 @@
         gc.weighty = 1.0;
         panelTf.add(buttonViewGpsPhoto, gc);
-        
+
         gc.gridx = 0;
         gc.gridy = 2;
@@ -500,5 +500,5 @@
         gc.weightx = gc.weighty = 0.0;
         panelTf.add(new JLabel(tr("Update position for: ")), gc);
-        
+
         gc.gridx = 1;
         gc.gridy = 2;
@@ -510,5 +510,5 @@
         rbAllImg = new JRadioButton(tr("All images"));
         panelTf.add(rbAllImg, gc);
-        
+
         gc.gridx = 1;
         gc.gridy = 3;
@@ -520,5 +520,5 @@
         rbNoExifImg = new JRadioButton(tr("Images with no exif position"));
         panelTf.add(rbNoExifImg, gc);
-        
+
         gc.gridx = 1;
         gc.gridy = 4;
@@ -530,15 +530,15 @@
         rbUntaggedImg = new JRadioButton(tr("Not yet tagged images"));
         panelTf.add(rbUntaggedImg, gc);
-        
+
         ButtonGroup group = new ButtonGroup();
         group.add(rbAllImg);
         group.add(rbNoExifImg);
         group.add(rbUntaggedImg);
-        
+
         rbUntaggedImg.setSelected(true);
-        
+
         panel = new JPanel();
         panel.setLayout(new BorderLayout());
-        
+
         panel.add(panelCb, BorderLayout.PAGE_START);
         panel.add(panelTf, BorderLayout.CENTER);
@@ -555,5 +555,5 @@
 
             if (item == null || ! (item instanceof GpxDataWrapper)) {
-                JOptionPane.showMessageDialog(Main.parent, tr("You should select a GPX track"), 
+                JOptionPane.showMessageDialog(Main.parent, tr("You should select a GPX track"),
                                               tr("No selected GPX track"), JOptionPane.ERROR_MESSAGE );
                 continue;
@@ -563,10 +563,10 @@
             Float timezoneValue = parseTimezone(tfTimezone.getText().trim());
             if (timezoneValue == null) {
-                JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing timezone.\nExpected format: {0}", "+H:MM"), 
+                JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing timezone.\nExpected format: {0}", "+H:MM"),
                         tr("Invalid timezone"), JOptionPane.ERROR_MESSAGE);
                 continue;
             }
             gpstimezone = timezoneValue.floatValue();
-            
+
             String deltaText = tfOffset.getText().trim();
             if (deltaText.length() > 0) {
@@ -574,5 +574,5 @@
                     delta = Long.parseLong(deltaText);
                 } catch(NumberFormatException nfe) {
-                    JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing offset.\nExpected format: {0}", "number"), 
+                    JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing offset.\nExpected format: {0}", "number"),
                             tr("Invalid offset"), JOptionPane.ERROR_MESSAGE);
                     continue;
@@ -581,12 +581,12 @@
                 delta = 0;
             }
-            
+
             Main.pref.put("tagimages.doublegpstimezone", Double.toString(gpstimezone));
             Main.pref.put("tagimages.gpstimezone", Long.toString(- ((long) gpstimezone)));
             Main.pref.put("tagimages.delta", Long.toString(delta * 1000));
-            
+
             isOk = true;
         }
-        
+
         // Construct a list of images that have a date, and sort them on the date.
         ArrayList<ImageEntry> dateImgLst = new ArrayList<ImageEntry>(yLayer.data.size());
@@ -597,5 +597,5 @@
                 }
             }
-        
+
         } else if (rbNoExifImg.isSelected()) {
             for (ImageEntry e : yLayer.data) {
@@ -605,5 +605,5 @@
             }
 
-        } else { // rbUntaggedImg.isSelected()  
+        } else { // rbUntaggedImg.isSelected()
             for (ImageEntry e : yLayer.data) {
                 if (e.time != null && e.coor == null) {
@@ -612,12 +612,12 @@
             }
         }
-        
+
         int matched = matchGpxTrack(dateImgLst, selectedGpx.data, (long) (gpstimezone * 3600000) + delta * 1000);
 
-        // Search whether an other layer has yet defined some bounding box. 
+        // Search whether an other layer has yet defined some bounding box.
         // If none, we'll zoom to the bounding box of the layer with the photos.
         Collection<Layer> layerCol = Main.map.mapView.getAllLayers();
         Iterator<Layer> layerIter = layerCol.iterator();
-        boolean boundingBoxedLayerFound = false; 
+        boolean boundingBoxedLayerFound = false;
         while (layerIter.hasNext()) {
             Layer l = layerIter.next();
@@ -636,17 +636,17 @@
             Main.map.mapView.recalculateCenterScale(bbox);
         }
-        
+
         Main.main.map.repaint();
-        
+
         JOptionPane.showMessageDialog(Main.parent, tr("Found {0} matchs of {1} in GPX track {2}", matched, dateImgLst.size(), selectedGpx.name),
-                tr("GPX Track loaded"), 
-                ((dateImgLst.size() > 0 && matched == 0) ? JOptionPane.WARNING_MESSAGE 
+                tr("GPX Track loaded"),
+                ((dateImgLst.size() > 0 && matched == 0) ? JOptionPane.WARNING_MESSAGE
                                                          : JOptionPane.INFORMATION_MESSAGE));
-        
+
     }
 
     private int matchGpxTrack(ArrayList<ImageEntry> dateImgLst, GpxData selectedGpx, long offset) {
         int ret = 0;
-        
+
         Collections.sort(dateImgLst, new Comparator<ImageEntry>() {
             public int compare(ImageEntry arg0, ImageEntry arg1) {
@@ -654,22 +654,22 @@
             }
         });
-        
+
         PrimaryDateParser dateParser = new PrimaryDateParser();
-        
+
         for (GpxTrack trk : selectedGpx.tracks) {
             for (Collection<WayPoint> segment : trk.trackSegs) {
-                
+
                 long prevDateWp = 0;
                 WayPoint prevWp = null;
-                
+
                 for (WayPoint curWp : segment) {
-                
-                    String curDateWpStr = (String) curWp.attr.get("time"); 
+
+                    String curDateWpStr = (String) curWp.attr.get("time");
                     if (curDateWpStr != null) {
-                        
+
                         try {
                             long curDateWp = dateParser.parse(curDateWpStr).getTime() + offset;
                             ret += matchPoints(dateImgLst, prevWp, prevDateWp, curWp, curDateWp);
-                            
+
                             prevWp = curWp;
                             prevDateWp = curDateWp;
@@ -710,8 +710,8 @@
             } catch (Exception e) {
             }
-            
-            while(i >= 0 
+
+            while(i >= 0
                     && dateImgLst.get(i).time.getTime() == curDateWp) {
-                dateImgLst.get(i).pos = curWp.eastNorth; 
+                dateImgLst.get(i).pos = curWp.eastNorth;
                 dateImgLst.get(i).coor = Main.proj.eastNorth2latlon(dateImgLst.get(i).pos);
                 dateImgLst.get(i).speed = speed;
@@ -720,17 +720,17 @@
                 i--;
             }
-            
+
             if (prevDateWp != 0) {
                 long imgDate;
-                while(i >= 0 
+                while(i >= 0
                         && (imgDate = dateImgLst.get(i).time.getTime()) > prevDateWp) {
                     dateImgLst.get(i).pos = new EastNorth(
                             prevWp.eastNorth.east() + ((curWp.eastNorth.east() - prevWp.eastNorth.east()) * (imgDate - prevDateWp)) / (curDateWp - prevDateWp),
-                            prevWp.eastNorth.north() + ((curWp.eastNorth.north() - prevWp.eastNorth.north()) * (imgDate - prevDateWp)) / (curDateWp - prevDateWp)); 
+                            prevWp.eastNorth.north() + ((curWp.eastNorth.north() - prevWp.eastNorth.north()) * (imgDate - prevDateWp)) / (curDateWp - prevDateWp));
                     dateImgLst.get(i).coor = Main.proj.eastNorth2latlon(dateImgLst.get(i).pos);
                     dateImgLst.get(i).speed = speed;
                     if (curElevation != null && prevElevation != null) {
                         dateImgLst.get(i).elevation = prevElevation + ((curElevation - prevElevation) * (imgDate - prevDateWp)) / (curDateWp - prevDateWp);
-                    } 
+                    }
                     ret++;
                     i--;
@@ -757,5 +757,5 @@
             return curIndex;
         }
-        
+
         int curIndex = 0;
         int startIndex=0;
@@ -782,5 +782,5 @@
     private String formatTimezone(double timezone) {
         StringBuffer ret = new StringBuffer();
-        
+
         if (timezone < 0) {
             ret.append('-');
@@ -795,13 +795,13 @@
         }
         ret.append(minutes);
-        
+
         return ret.toString();
     }
-    
+
     private Float parseTimezone(String timezone) {
-    	if (timezone.length() == 0) {
-    		return new Float(0);
-    	}
-    	
+        if (timezone.length() == 0) {
+            return new Float(0);
+        }
+
         char sgnTimezone = '+';
         StringBuffer hTimezone = new StringBuffer();
@@ -817,5 +817,5 @@
                 break;
             case '+' :
-            case '-' : 
+            case '-' :
                 if (state == 1) {
                     sgnTimezone = c;
@@ -825,6 +825,6 @@
                 }
                 break;
-            case ':' : 
-            case '.' : 
+            case ':' :
+            case '.' :
                 if (state == 2) {
                     state = 3;
@@ -833,54 +833,54 @@
                 }
                 break;
-            case '0' : case '1' : case '2' : case '3' : case '4' : 
+            case '0' : case '1' : case '2' : case '3' : case '4' :
             case '5' : case '6' : case '7' : case '8' : case '9' :
                 switch(state) {
-                case 1 : 
-                case 2 : 
+                case 1 :
+                case 2 :
                     state = 2;
                     hTimezone.append(c);
                     break;
-                case 3 : 
+                case 3 :
                     mTimezone.append(c);
                     break;
-                default : 
+                default :
                     return null;
                 }
                 break;
-            default : 
+            default :
                 return null;
             }
         }
-        
+
         int h = 0;
         int m = 0;
         try {
-       		h = Integer.parseInt(hTimezone.toString());
-        	if (mTimezone.length() > 0) {
-        		m = Integer.parseInt(mTimezone.toString());
-        	}
+            h = Integer.parseInt(hTimezone.toString());
+            if (mTimezone.length() > 0) {
+                m = Integer.parseInt(mTimezone.toString());
+            }
         } catch (NumberFormatException nfe) {
-        	// Invalid timezone
-        	return null;
-        }
-        
+            // Invalid timezone
+            return null;
+        }
+
         if (h > 12 || m > 59 ) {
             return null;
         } else {
-        	return new Float((h + m / 60.0) * (sgnTimezone == '-' ? -1 : 1));
-        }
-    }
-
-    /** Return the distance in meters between 2 points 
+            return new Float((h + m / 60.0) * (sgnTimezone == '-' ? -1 : 1));
+        }
+    }
+
+    /** Return the distance in meters between 2 points
      * Formula and earth radius from : http://en.wikipedia.org/wiki/Great-circle_distance */
     public double getDistance(WayPoint p1, WayPoint p2) {
         double p1Lat = p1.latlon.lat() * Math.PI / 180;
-        double p1Lon = p1.latlon.lon() * Math.PI / 180; 
+        double p1Lon = p1.latlon.lon() * Math.PI / 180;
         double p2Lat = p2.latlon.lat() * Math.PI / 180;
         double p2Lon = p2.latlon.lon() * Math.PI / 180;
-        double ret = Math.atan2(Math.sqrt(Math.pow(Math.cos(p2Lat) * Math.sin(p2Lon - p1Lon), 2) 
+        double ret = Math.atan2(Math.sqrt(Math.pow(Math.cos(p2Lat) * Math.sin(p2Lon - p1Lon), 2)
                                           + Math.pow(Math.cos(p1Lat) * Math.sin(p2Lat)
-                                                     - Math.sin(p1Lat) * Math.cos(p2Lat) * Math.cos(p2Lon - p1Lon), 2)), 
-                                Math.sin(p1Lat) * Math.sin(p2Lat) 
+                                                     - Math.sin(p1Lat) * Math.cos(p2Lat) * Math.cos(p2Lon - p1Lon), 2)),
+                                Math.sin(p1Lat) * Math.sin(p2Lat)
                                 + Math.cos(p1Lat) * Math.cos(p2Lat) * Math.cos(p2Lon - p1Lon))
                      * 6372795; // Earth radius, in meters
Index: /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/ImageDisplay.java
===================================================================
--- /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/ImageDisplay.java	(revision 12777)
+++ /applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/ImageDisplay.java	(revision 12778)
@@ -25,18 +25,18 @@
 
 public class ImageDisplay extends JComponent {
-    
+
     /** The file that is currently displayed */
     private File file = null;
-    
+
     /** The image currently displayed */
     private Image image = null;
-    
+
     /** The image currently displayed */
     private boolean errorLoading = false;
-    
-    /** The rectangle (in image coordinates) of the image that is visible. This rectangle is calculated 
+
+    /** The rectangle (in image coordinates) of the image that is visible. This rectangle is calculated
      * each time the zoom is modified */
     private Rectangle visibleRect = null;
-    
+
     /** When a selection is done, the rectangle of the selection (in image coordinates) */
     private Rectangle selectedRect = null;
@@ -46,22 +46,22 @@
 
     private String osdText = null;
-    
+
     /** The thread that reads the images. */
     private class LoadImageRunnable implements Runnable {
 
         File file = null;
-        
+
         public LoadImageRunnable(File file) {
             this.file = file;
         }
-        
+
         public void run() {
             Image img = Toolkit.getDefaultToolkit().createImage(file.getPath());
             tracker.addImage(img, 1);
-            
+
             // Wait for the end of loading
             while (! tracker.checkID(1, true)) {
                 if (this.file != ImageDisplay.this.file) {
-                    // The file has changed 
+                    // The file has changed
                     tracker.removeImage(img);
                     return;
@@ -77,8 +77,8 @@
                 error = true;
             }
-            
+
             synchronized(ImageDisplay.this) {
                 if (this.file != ImageDisplay.this.file) {
-                    // The file has changed 
+                    // The file has changed
                     tracker.removeImage(img);
                     return;
@@ -93,17 +93,17 @@
         }
     }
-    
+
     private class ImgDisplayMouseListener implements MouseListener, MouseWheelListener, MouseMotionListener {
 
         boolean mouseIsDragging = false;
         Point mousePointInImg = null;
-        
-        /** Zoom in and out, trying to preserve the point of the image that was under the mouse cursor 
-         * at the same place */ 
+
+        /** Zoom in and out, trying to preserve the point of the image that was under the mouse cursor
+         * at the same place */
         public void mouseWheelMoved(MouseWheelEvent e) {
             File file;
             Image image;
             Rectangle visibleRect;
-            
+
             synchronized (ImageDisplay.this) {
                 file = ImageDisplay.this.file;
@@ -111,18 +111,18 @@
                 visibleRect = ImageDisplay.this.visibleRect;
             }
-            
+
             mouseIsDragging = false;
             selectedRect = null;
-            
+
             if (image == null) {
                 return;
             }
 
-            // Calculate the mouse cursor position in image coordinates, so that we can center the zoom 
-            // on that mouse position. 
+            // Calculate the mouse cursor position in image coordinates, so that we can center the zoom
+            // on that mouse position.
             if (e.getClickCount() == 1 || mousePointInImg == null) {
                 mousePointInImg = comp2imgCoord(visibleRect, e.getX(), e.getY());
             }
-            
+
             // Applicate the zoom to the visible rectangle in image coordinates
             if (e.getWheelRotation() > 0) {
@@ -133,5 +133,5 @@
                 visibleRect.height = visibleRect.height * 2 / 3;
             }
-            
+
             // Check that the zoom doesn't exceed 2:1
             if (visibleRect.width < getSize().width / 2) {
@@ -141,5 +141,5 @@
                 visibleRect.height = getSize().height / 2;
             }
-            
+
             // Set the same ratio for the visible rectangle and the display area
             int hFact = visibleRect.height * getSize().width;
@@ -150,16 +150,16 @@
                 visibleRect.height = wFact / getSize().width;
             }
-            
+
             // The size of the visible rectangle is limited by the image size.
             checkVisibleRectSize(image, visibleRect);
-            
+
             // Set the position of the visible rectangle, so that the mouse cursor doesn't move on the image.
             Rectangle drawRect = calculateDrawImageRectangle(visibleRect);
             visibleRect.x = mousePointInImg.x + ((drawRect.x - e.getX()) * visibleRect.width) / drawRect.width;
             visibleRect.y = mousePointInImg.y + ((drawRect.y - e.getY()) * visibleRect.height) / drawRect.height;
-            
+
             // The position is also limited by the image size
             checkVisibleRectPos(image, visibleRect);
-            
+
             synchronized(ImageDisplay.this) {
                 if (ImageDisplay.this.file == file) {
@@ -176,5 +176,5 @@
             Image image;
             Rectangle visibleRect;
-            
+
             synchronized (ImageDisplay.this) {
                 file = ImageDisplay.this.file;
@@ -190,14 +190,14 @@
                 return;
             }
-            
+
             // Calculate the translation to set the clicked point the center of the view.
             Point click = comp2imgCoord(visibleRect, e.getX(), e.getY());
             Point center = getCenterImgCoord(visibleRect);
-            
+
             visibleRect.x += click.x - center.x;
             visibleRect.y += click.y - center.y;
-            
+
             checkVisibleRectPos(image, visibleRect);
-            
+
             synchronized(ImageDisplay.this) {
                 if (ImageDisplay.this.file == file) {
@@ -208,5 +208,5 @@
         }
 
-        /** Initialize the dragging, either with button 1 (simple dragging) or button 3 (selection of 
+        /** Initialize the dragging, either with button 1 (simple dragging) or button 3 (selection of
          * a picture part) */
         public void mousePressed(MouseEvent e) {
@@ -216,9 +216,9 @@
                 return;
             }
-            
+
             File file;
             Image image;
             Rectangle visibleRect;
-            
+
             synchronized (ImageDisplay.this) {
                 file = ImageDisplay.this.file;
@@ -251,9 +251,9 @@
                 return;
             }
-            
+
             File file;
             Image image;
             Rectangle visibleRect;
-            
+
             synchronized (ImageDisplay.this) {
                 file = ImageDisplay.this.file;
@@ -279,5 +279,5 @@
                 }
                 ImageDisplay.this.repaint();
-                
+
             } else if (selectedRect != null) {
                 Point p = comp2imgCoord(visibleRect, e.getX(), e.getY());
@@ -300,9 +300,9 @@
                 return;
             }
-            
+
             File file;
             Image image;
             Rectangle visibleRect;
-            
+
             synchronized (ImageDisplay.this) {
                 file = ImageDisplay.this.file;
@@ -319,5 +319,5 @@
             if (mouseIsDragging) {
                 mouseIsDragging = false;
-                
+
             } else if (selectedRect != null) {
                 int oldWidth = selectedRect.width;
@@ -331,5 +331,5 @@
                     selectedRect.height = getSize().height / 2;
                 }
-                
+
                 // Set the same ratio for the visible rectangle and the display area
                 int hFact = selectedRect.height * getSize().width;
@@ -340,5 +340,5 @@
                     selectedRect.height = wFact / getSize().width;
                 }
-                
+
                 // Keep the center of the selection
                 if (selectedRect.width != oldWidth) {
@@ -348,13 +348,13 @@
                     selectedRect.y -= (selectedRect.height - oldHeight) / 2;
                 }
-                
+
                 checkVisibleRectSize(image, selectedRect);
                 checkVisibleRectPos(image, selectedRect);
-                
+
                 synchronized (ImageDisplay.this) {
                     if (file == ImageDisplay.this.file) {
                         ImageDisplay.this.visibleRect = selectedRect;
                     }
-                }                
+                }
                 selectedRect = null;
                 ImageDisplay.this.repaint();
@@ -370,5 +370,5 @@
         public void mouseMoved(MouseEvent e) {
         }
-        
+
         private void checkPointInVisibleRect(Point p, Rectangle visibleRect) {
             if (p.x < visibleRect.x) {
@@ -386,5 +386,5 @@
         }
     }
-    
+
     public ImageDisplay() {
         ImgDisplayMouseListener mouseListener = new ImgDisplayMouseListener();
@@ -393,5 +393,5 @@
         addMouseMotionListener(mouseListener);
     }
-    
+
     public void setImage(File file) {
         synchronized(this) {
@@ -410,5 +410,5 @@
         this.osdText = text;
     }
-    
+
     public void paintComponent(Graphics g) {
         Image image;
@@ -416,5 +416,5 @@
         Rectangle visibleRect;
         boolean errorLoading;
-        
+
         synchronized(this) {
             image = this.image;
@@ -423,5 +423,5 @@
             errorLoading = this.errorLoading;
         }
-        
+
         if (file == null) {
             g.setColor(Color.black);
@@ -447,12 +447,12 @@
         } else {
             Rectangle target = calculateDrawImageRectangle(visibleRect);
-            g.drawImage(image, 
-                        target.x, target.y, target.x + target.width, target.y + target.height, 
-                        visibleRect.x, visibleRect.y, visibleRect.x + visibleRect.width, visibleRect.y + visibleRect.height, 
+            g.drawImage(image,
+                        target.x, target.y, target.x + target.width, target.y + target.height,
+                        visibleRect.x, visibleRect.y, visibleRect.x + visibleRect.width, visibleRect.y + visibleRect.height,
                         null);
             if (selectedRect != null) {
                 Point topLeft = img2compCoord(visibleRect, selectedRect.x, selectedRect.y);
-                Point bottomRight = img2compCoord(visibleRect, 
-                                                  selectedRect.x + selectedRect.width, 
+                Point bottomRight = img2compCoord(visibleRect,
+                                                  selectedRect.x + selectedRect.width,
                                                   selectedRect.y + selectedRect.height);
                 g.setColor(new Color(128, 128, 128, 180));
@@ -502,5 +502,5 @@
         }
     }
-    
+
     private final Point img2compCoord(Rectangle visibleRect, int xImg, int yImg) {
         Rectangle drawRect = calculateDrawImageRectangle(visibleRect);
@@ -524,8 +524,8 @@
         int x, y, w, h;
         x = 0;
-        y = 0; 
+        y = 0;
         w = size.width;
         h = size.height;
-        
+
         int wFact = w * visibleRect.height;
         int hFact = h * visibleRect.width;
@@ -546,5 +546,5 @@
         Image image;
         Rectangle visibleRect;
-        
+
         synchronized (this) {
             file = ImageDisplay.this.file;
@@ -560,13 +560,13 @@
             // The display is not at best fit. => Zoom to best fit
             visibleRect = new Rectangle(0, 0, image.getWidth(null), image.getHeight(null));
-        
+
         } else {
             // The display is at best fit => zoom to 1:1
             Point center = getCenterImgCoord(visibleRect);
-            visibleRect = new Rectangle(center.x - getWidth() / 2, center.y - getHeight() / 2, 
+            visibleRect = new Rectangle(center.x - getWidth() / 2, center.y - getHeight() / 2,
                                         getWidth(), getHeight());
             checkVisibleRectPos(image, visibleRect);
         }
-        
+
         synchronized(this) {
             if (file == this.file) {
Index: /applications/editors/josm/plugins/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePlugin.java
===================================================================
--- /applications/editors/josm/plugins/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePlugin.java	(revision 12778)
@@ -14,10 +14,10 @@
  */
 public class ColorSchemePlugin extends Plugin {
-    
+
     /**
      * Default Constructor
      */
     public ColorSchemePlugin() {
-        
+
     }
 
@@ -26,6 +26,6 @@
         return new ColorSchemePreference();
     }
-    
-    
+
+
 
 }
Index: /applications/editors/josm/plugins/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePreference.java
===================================================================
--- /applications/editors/josm/plugins/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePreference.java	(revision 12777)
+++ /applications/editors/josm/plugins/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePreference.java	(revision 12778)
@@ -36,25 +36,25 @@
     private static final String PREF_KEY_SCHEMES_NAMES = PREF_KEY_SCHEMES_PREFIX + "names";
     public static final String PREF_KEY_COLOR_PREFIX = "color.";
-	private JList schemesList;
-	private DefaultListModel listModel;
-	private List<String>colorKeys;
-	private ColorPreference colorPreference;
-	
-	/**
-	 * Default Constructor 
-	 */
-	public ColorSchemePreference() {
-	}
-	
+    private JList schemesList;
+    private DefaultListModel listModel;
+    private List<String>colorKeys;
+    private ColorPreference colorPreference;
+    
+    /**
+     * Default Constructor 
+     */
+    public ColorSchemePreference() {
+    }
+    
 
-	/* (non-Javadoc)
-	 * @see org.openstreetmap.josm.gui.preferences.PreferenceSetting#addGui(org.openstreetmap.josm.gui.preferences.PreferenceDialog)
-	 */
-	public void addGui(final PreferenceDialog gui) {
+    /* (non-Javadoc)
+     * @see org.openstreetmap.josm.gui.preferences.PreferenceSetting#addGui(org.openstreetmap.josm.gui.preferences.PreferenceDialog)
+     */
+    public void addGui(final PreferenceDialog gui) {
         Map<String, String> colorMap = Main.pref.getAllPrefix(PREF_KEY_COLOR_PREFIX);
         colorKeys = new ArrayList<String>(colorMap.keySet());
         Collections.sort(colorKeys);
-	    listModel = new DefaultListModel();
-		schemesList = new JList(listModel);
+        listModel = new DefaultListModel();
+        schemesList = new JList(listModel);
         String schemes = Main.pref.get(PREF_KEY_SCHEMES_NAMES);
         StringTokenizer st = new StringTokenizer(schemes, ";");        
@@ -76,51 +76,51 @@
             }
         });
-		JButton addScheme = new JButton(tr("Add"));
-		addScheme.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				String schemeName = JOptionPane.showInputDialog(Main.parent, tr("Color Scheme"));
-				if (schemeName == null)
-					return;
-				schemeName = schemeName.replaceAll("\\.", "_");
-				setColorScheme(schemeName, getColorPreference().getColorModel());
-				listModel.addElement(schemeName);
+        JButton addScheme = new JButton(tr("Add"));
+        addScheme.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                String schemeName = JOptionPane.showInputDialog(Main.parent, tr("Color Scheme"));
+                if (schemeName == null)
+                    return;
+                schemeName = schemeName.replaceAll("\\.", "_");
+                setColorScheme(schemeName, getColorPreference().getColorModel());
+                listModel.addElement(schemeName);
                 saveSchemeNamesToPref();
-			}
-		});
+            }
+        });
 
-		JButton deleteScheme = new JButton(tr("Delete"));
-		deleteScheme.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				if (schemesList.getSelectedIndex() == -1)
-					JOptionPane.showMessageDialog(Main.parent, tr("Please select the scheme to delete."));
-				else {
-			        String schemeName = (String) listModel.get(schemesList.getSelectedIndex());
-			        removeColorSchemeFromPreferences(schemeName);
-				    listModel.remove(schemesList.getSelectedIndex());
-				    saveSchemeNamesToPref();
-				}
-			}
-		});
-		schemesList.setVisibleRowCount(3);
+        JButton deleteScheme = new JButton(tr("Delete"));
+        deleteScheme.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                if (schemesList.getSelectedIndex() == -1)
+                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the scheme to delete."));
+                else {
+                    String schemeName = (String) listModel.get(schemesList.getSelectedIndex());
+                    removeColorSchemeFromPreferences(schemeName);
+                    listModel.remove(schemesList.getSelectedIndex());
+                    saveSchemeNamesToPref();
+                }
+            }
+        });
+        schemesList.setVisibleRowCount(3);
 
-		//schemesList.setToolTipText(tr("The sources (url or filename) of annotation preset definition files. See http://josm.eigenheimstrasse.de/wiki/AnnotationPresets for help."));
+        //schemesList.setToolTipText(tr("The sources (url or filename) of annotation preset definition files. See http://josm.eigenheimstrasse.de/wiki/AnnotationPresets for help."));
         useScheme.setToolTipText(tr("Use the selected scheme from the list."));
-		addScheme.setToolTipText(tr("Use the current colors as a new color scheme."));
-		deleteScheme.setToolTipText(tr("Delete the selected scheme from the list."));
+        addScheme.setToolTipText(tr("Use the current colors as a new color scheme."));
+        deleteScheme.setToolTipText(tr("Delete the selected scheme from the list."));
 
-		gui.map.add(new JLabel(tr("Color Schemes")), GBC.eol().insets(0,5,0,0));
-		gui.map.add(new JScrollPane(schemesList), GBC.eol().fill(GBC.BOTH));
-		JPanel buttonPanel = new JPanel(new GridBagLayout());
-		gui.map.add(buttonPanel, GBC.eol().fill(GBC.HORIZONTAL));
-		buttonPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
+        gui.map.add(new JLabel(tr("Color Schemes")), GBC.eol().insets(0,5,0,0));
+        gui.map.add(new JScrollPane(schemesList), GBC.eol().fill(GBC.BOTH));
+        JPanel buttonPanel = new JPanel(new GridBagLayout());
+        gui.map.add(buttonPanel, GBC.eol().fill(GBC.HORIZONTAL));
+        buttonPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
         buttonPanel.add(useScheme, GBC.std().insets(0,5,5,0));
-		buttonPanel.add(addScheme, GBC.std().insets(0,5,5,0));
-		buttonPanel.add(deleteScheme, GBC.std().insets(0,5,5,0));
-	}
-	
-	/**
-	 * Saves the names of the schemes to the preferences. 
-	 */
-	public void saveSchemeNamesToPref() {
+        buttonPanel.add(addScheme, GBC.std().insets(0,5,5,0));
+        buttonPanel.add(deleteScheme, GBC.std().insets(0,5,5,0));
+    }
+    
+    /**
+     * Saves the names of the schemes to the preferences. 
+     */
+    public void saveSchemeNamesToPref() {
         if (schemesList.getModel().getSize() > 0) {
             StringBuilder sb = new StringBuilder();
@@ -129,51 +129,51 @@
             Main.pref.put(PREF_KEY_SCHEMES_NAMES, sb.toString().substring(1));
         } else
-            Main.pref.put(PREF_KEY_SCHEMES_NAMES, null);	    
-	}
+            Main.pref.put(PREF_KEY_SCHEMES_NAMES, null);        
+    }
 
-	public boolean ok() {
-	    return false;// nothing to do
-	}
-	
-	/**
-	 * Remove all color entries for the given scheme from the preferences.
-	 * @param schemeName the name of the scheme.
-	 */
-	public void removeColorSchemeFromPreferences(String schemeName) {
+    public boolean ok() {
+        return false;// nothing to do
+    }
+    
+    /**
+     * Remove all color entries for the given scheme from the preferences.
+     * @param schemeName the name of the scheme.
+     */
+    public void removeColorSchemeFromPreferences(String schemeName) {
         // delete color entries for scheme in preferences:
         Map<String, String> colors = Main.pref.getAllPrefix(PREF_KEY_SCHEMES_PREFIX + schemeName + ".");
         for(String key : colors.keySet()) {
             Main.pref.put(key, null);
-        }	    
-	}
-	
-	/**
-	 * Copy all color entries from the given map to entries in preferences with the scheme name.
-	 * @param schemeName the name of the scheme.
-	 * @param the map containing the color key (without prefix) and the html color values.
-	 */
-	public void setColorScheme(String schemeName, Map<String, String> colorMap) {
-	    String key;
-	    for(String colorKey : colorMap.keySet()) {
-	        key = PREF_KEY_SCHEMES_PREFIX + schemeName + "." + PREF_KEY_COLOR_PREFIX + colorKey;
-	        Main.pref.put(key, colorMap.get(colorKey));
-	    }
-	}
-	
-	/**
-	 * Reads all colors for a scheme and returns them in a map (key = color key without prefix, 
-	 * value = html color code).
-	 * @param schemeName the name of the scheme.
-	 */
-	public Map<String, String> getColorMap(String schemeName) {
-	    String colorKey;
-	    String prefix = PREF_KEY_SCHEMES_PREFIX + schemeName + "." + PREF_KEY_COLOR_PREFIX;
-	    Map<String, String>colorMap = new HashMap<String, String>();
-	    for(String schemeColorKey : Main.pref.getAllPrefix(prefix).keySet()) {
-	        colorKey = schemeColorKey.substring(prefix.length());
-	        colorMap.put(colorKey, Main.pref.get(schemeColorKey));
-	    }
-	    return colorMap;
-	}
+        }       
+    }
+    
+    /**
+     * Copy all color entries from the given map to entries in preferences with the scheme name.
+     * @param schemeName the name of the scheme.
+     * @param the map containing the color key (without prefix) and the html color values.
+     */
+    public void setColorScheme(String schemeName, Map<String, String> colorMap) {
+        String key;
+        for(String colorKey : colorMap.keySet()) {
+            key = PREF_KEY_SCHEMES_PREFIX + schemeName + "." + PREF_KEY_COLOR_PREFIX + colorKey;
+            Main.pref.put(key, colorMap.get(colorKey));
+        }
+    }
+    
+    /**
+     * Reads all colors for a scheme and returns them in a map (key = color key without prefix, 
+     * value = html color code).
+     * @param schemeName the name of the scheme.
+     */
+    public Map<String, String> getColorMap(String schemeName) {
+        String colorKey;
+        String prefix = PREF_KEY_SCHEMES_PREFIX + schemeName + "." + PREF_KEY_COLOR_PREFIX;
+        Map<String, String>colorMap = new HashMap<String, String>();
+        for(String schemeColorKey : Main.pref.getAllPrefix(prefix).keySet()) {
+            colorKey = schemeColorKey.substring(prefix.length());
+            colorMap.put(colorKey, Main.pref.get(schemeColorKey));
+        }
+        return colorMap;
+    }
 
     public ColorPreference getColorPreference() {
Index: /applications/editors/josm/plugins/duplicateway/src/org/openstreetmap/josm/plugins/duplicateway/DuplicateWayAction.java
===================================================================
--- /applications/editors/josm/plugins/duplicateway/src/org/openstreetmap/josm/plugins/duplicateway/DuplicateWayAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/duplicateway/src/org/openstreetmap/josm/plugins/duplicateway/DuplicateWayAction.java	(revision 12778)
@@ -34,238 +34,238 @@
 /**
  * Duplicate an existing set of ordered ways, offset by a specified distance.
- * 
+ *
  * This basic version just creates a completely seperate way and makes no
  * attempt to attach it to any other ways.
- * 
+ *
  * Planned Improvements:
- * 
+ *
  * 1. After creation of the duplicate way and while it is still selected allow
  * the Mouse wheel, or the up and down arrow (probably in association with the
  * shift key) to increase/decrease the offset distance. Clicking anywhere, or
  * moving the mouse out of the view window should finish this mode.
- * 
+ *
  * 2. Locate points close to the end points and pop up a dialog asking of these
  * should be joined.
- * 
+ *
  * 3. Handle intersecting ways. Pop up a dialog for each asking if the
  * intersecting way should be carried accross to intersect the newly created
  * way. Handle multiple intersecting ways at a point.
- * 
- * 
+ *
+ *
  * @author Brent Easton
- * 
+ *
  */
 public class DuplicateWayAction extends MapMode implements
         SelectionChangedListener, MouseListener {
 
-	private static final long serialVersionUID = 1L;
-
-	protected Cursor oldCursor;
-
-	protected List<Way> selectedWays;
-	
-	protected MapMode previousMode;
-
-	/**
-	 * Create new DuplicateWay Action
-	 * 
-	 * @param name
-	 */
-	public DuplicateWayAction() {
-		super(tr("Duplicate Way"), "duplicateway",
-		        tr("Duplicate selected ways."), KeyEvent.VK_W, null,
-		        ImageProvider.getCursor("crosshair", "duplicate"));
-		setEnabled(false);
-		DataSet.listeners.add(this);
-	}
-
-	@Override public void enterMode() {
-		super.enterMode();
-		Main.map.mapView.addMouseListener(this);
-	}
-
-	@Override public void exitMode() {
-		super.exitMode();
-		Main.map.mapView.removeMouseListener(this);
-	}
-
-	/**
-	 * The Duplicate Way button has been clicked
-	 * 
-	 * @param e
-	 *            Action Event
-	 */
-	@Override public void actionPerformed(ActionEvent e) {
-
-		selectedWays = new ArrayList<Way>();
-		for (OsmPrimitive osm : Main.ds.getSelected()) {
-			if (osm instanceof Way) {
-				Way way = (Way)osm;
-				EastNorth last = null;
-				for (Segment seg : way.segments) {
-					if (last != null) {
-						if (!seg.from.eastNorth.equals(last)) {
-							JOptionPane.showMessageDialog(Main.parent,
-							        tr("Can't duplicate unordered way."));
-							return;
-						}
-					}
-					last = seg.to.eastNorth;
-				}
-				selectedWays.add(way);
-			}
-		}
-
-		if (Main.map == null) {
-			JOptionPane.showMessageDialog(Main.parent, tr("No data loaded."));
-			return;
-		}
-
-		if (selectedWays.isEmpty()) {
-			JOptionPane.showMessageDialog(Main.parent,
-			        tr("You must select at least one way."));
-			return;
-		}
-		previousMode = Main.map.mapMode;
-		super.actionPerformed(e);
-	}
-
-	/**
-	 * Create a new Node object at a specified Easting/Northing location
-	 * 
-	 * @param east
-	 *            Easting of new Node
-	 * @param north
-	 *            Northing of new node
-	 * @return new Node
-	 */
-	public static Node createNode(double east, double north) {
-		return new Node(Main.proj.eastNorth2latlon(new EastNorth(east, north)));
-	}
-
-	/**
-	 * Duplicate the selected ways. The distance to be offset is determined by
-	 * finding the distance of the 'offset' point from the nearest segment.
-	 * 
-	 * @param clickPoint
-	 *            The point in screen co-ordinates used to calculate the offset
-	 *            distance
-	 */
-	protected void duplicate(Point clickPoint) {
-
-		EastNorth clickEN = Main.map.mapView.getEastNorth(clickPoint.x,
-		        clickPoint.y);
-
-		/*
-		 * First, find the nearest Segment belonging to a selected way
-		 */
-		Segment cs = null;
-		for (Way way : selectedWays) {
-			double minDistance = Double.MAX_VALUE;
-			// segments
-			for (Segment ls : way.segments) {
-				if (ls.deleted || ls.incomplete)
-					continue;
-				double perDist = JVector.perpDistance(ls, clickEN);
-				if (perDist < minDistance) {
-					minDistance = perDist;
-					cs = ls;
-				}
-			}
-		}
-
-		if (cs == null) {
-			return;
-		}
-
-		/*
-		 * Find the distance we need to offset the new way +ve offset is to the
-		 * right of the initial way, -ve to the left
-		 */
-		JVector closestSegment = new JVector(cs);
-		double offset = closestSegment.calculateOffset(clickEN);
-
-		Collection<Command> commands = new LinkedList<Command>();
-		Collection<Way> ways = new LinkedList<Way>();
-
-		/*
-		 * First new node is offset 90 degrees from the first point
-		 */
-		for (Way way : selectedWays) {
-			Way newWay = new Way();
-
-			Node lastNode = null;
-			JVector lastLine = null;
-
-			for (Segment seg : way.segments) {
-				JVector currentLine = new JVector(seg);
-				Node newNode = null;
-
-				if (lastNode == null) {
-					JVector perpVector = new JVector(currentLine);
-					perpVector.rotate90(offset);
-					newNode = createNode(perpVector.getP2().getX(), perpVector
-					        .getP2().getY());
-					commands.add(new AddCommand(newNode));
-				} else {
-					JVector bisector = lastLine.bisector(currentLine, offset);
-					newNode = createNode(bisector.getP2().getX(), bisector
-					        .getP2().getY());
-					commands.add(new AddCommand(newNode));
-					Segment s = new Segment(newNode, lastNode);
-					commands.add(new AddCommand(s));
-					newWay.segments.add(0, s);
-				}
-
-				lastLine = currentLine;
-				lastNode = newNode;
-
-			}
-			lastLine.reverse();
-			lastLine.rotate90(-offset);
-			Node newNode = createNode(lastLine.getP2().getX(), lastLine.getP2()
-			        .getY());
-			commands.add(new AddCommand(newNode));
-			Segment s = new Segment(newNode, lastNode);
-			commands.add(new AddCommand(s));
-			newWay.segments.add(0, s);
-
-			for (String key : way.keySet()) {
-				newWay.put(key, way.get(key));
-			}
-			commands.add(new AddCommand(newWay));
-			ways.add(newWay);
-		}
-
-		Main.main.undoRedo.add(new SequenceCommand(tr("Create duplicate way"),
-		        commands));
-		Main.ds.setSelected(ways);
-	}
-
-	/**
-	 * Enable the "Duplicate way" menu option if at least one way is selected
-	 * 
-	 * @param newSelection
-	 */
-	public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
-		for (OsmPrimitive osm : newSelection) {
-			if (osm instanceof Way) {
-				setEnabled(true);
-				return;
-			}
-		}
-		setEnabled(false);
-	}
-
-	/**
-	 * User has clicked on map to indicate the offset. Create the
-	 * duplicate way and exit duplicate mode
-	 * 
-	 * @param e
-	 */
-	public void mouseClicked(MouseEvent e) {
-		duplicate(e.getPoint());
-		exitMode();
-		Main.map.selectMapMode(previousMode);
-	}
+    private static final long serialVersionUID = 1L;
+
+    protected Cursor oldCursor;
+
+    protected List<Way> selectedWays;
+
+    protected MapMode previousMode;
+
+    /**
+     * Create new DuplicateWay Action
+     *
+     * @param name
+     */
+    public DuplicateWayAction() {
+        super(tr("Duplicate Way"), "duplicateway",
+                tr("Duplicate selected ways."), KeyEvent.VK_W, null,
+                ImageProvider.getCursor("crosshair", "duplicate"));
+        setEnabled(false);
+        DataSet.listeners.add(this);
+    }
+
+    @Override public void enterMode() {
+        super.enterMode();
+        Main.map.mapView.addMouseListener(this);
+    }
+
+    @Override public void exitMode() {
+        super.exitMode();
+        Main.map.mapView.removeMouseListener(this);
+    }
+
+    /**
+     * The Duplicate Way button has been clicked
+     *
+     * @param e
+     *            Action Event
+     */
+    @Override public void actionPerformed(ActionEvent e) {
+
+        selectedWays = new ArrayList<Way>();
+        for (OsmPrimitive osm : Main.ds.getSelected()) {
+            if (osm instanceof Way) {
+                Way way = (Way)osm;
+                EastNorth last = null;
+                for (Segment seg : way.segments) {
+                    if (last != null) {
+                        if (!seg.from.eastNorth.equals(last)) {
+                            JOptionPane.showMessageDialog(Main.parent,
+                                    tr("Can't duplicate unordered way."));
+                            return;
+                        }
+                    }
+                    last = seg.to.eastNorth;
+                }
+                selectedWays.add(way);
+            }
+        }
+
+        if (Main.map == null) {
+            JOptionPane.showMessageDialog(Main.parent, tr("No data loaded."));
+            return;
+        }
+
+        if (selectedWays.isEmpty()) {
+            JOptionPane.showMessageDialog(Main.parent,
+                    tr("You must select at least one way."));
+            return;
+        }
+        previousMode = Main.map.mapMode;
+        super.actionPerformed(e);
+    }
+
+    /**
+     * Create a new Node object at a specified Easting/Northing location
+     *
+     * @param east
+     *            Easting of new Node
+     * @param north
+     *            Northing of new node
+     * @return new Node
+     */
+    public static Node createNode(double east, double north) {
+        return new Node(Main.proj.eastNorth2latlon(new EastNorth(east, north)));
+    }
+
+    /**
+     * Duplicate the selected ways. The distance to be offset is determined by
+     * finding the distance of the 'offset' point from the nearest segment.
+     *
+     * @param clickPoint
+     *            The point in screen co-ordinates used to calculate the offset
+     *            distance
+     */
+    protected void duplicate(Point clickPoint) {
+
+        EastNorth clickEN = Main.map.mapView.getEastNorth(clickPoint.x,
+                clickPoint.y);
+
+        /*
+         * First, find the nearest Segment belonging to a selected way
+         */
+        Segment cs = null;
+        for (Way way : selectedWays) {
+            double minDistance = Double.MAX_VALUE;
+            // segments
+            for (Segment ls : way.segments) {
+                if (ls.deleted || ls.incomplete)
+                    continue;
+                double perDist = JVector.perpDistance(ls, clickEN);
+                if (perDist < minDistance) {
+                    minDistance = perDist;
+                    cs = ls;
+                }
+            }
+        }
+
+        if (cs == null) {
+            return;
+        }
+
+        /*
+         * Find the distance we need to offset the new way +ve offset is to the
+         * right of the initial way, -ve to the left
+         */
+        JVector closestSegment = new JVector(cs);
+        double offset = closestSegment.calculateOffset(clickEN);
+
+        Collection<Command> commands = new LinkedList<Command>();
+        Collection<Way> ways = new LinkedList<Way>();
+
+        /*
+         * First new node is offset 90 degrees from the first point
+         */
+        for (Way way : selectedWays) {
+            Way newWay = new Way();
+
+            Node lastNode = null;
+            JVector lastLine = null;
+
+            for (Segment seg : way.segments) {
+                JVector currentLine = new JVector(seg);
+                Node newNode = null;
+
+                if (lastNode == null) {
+                    JVector perpVector = new JVector(currentLine);
+                    perpVector.rotate90(offset);
+                    newNode = createNode(perpVector.getP2().getX(), perpVector
+                            .getP2().getY());
+                    commands.add(new AddCommand(newNode));
+                } else {
+                    JVector bisector = lastLine.bisector(currentLine, offset);
+                    newNode = createNode(bisector.getP2().getX(), bisector
+                            .getP2().getY());
+                    commands.add(new AddCommand(newNode));
+                    Segment s = new Segment(newNode, lastNode);
+                    commands.add(new AddCommand(s));
+                    newWay.segments.add(0, s);
+                }
+
+                lastLine = currentLine;
+                lastNode = newNode;
+
+            }
+            lastLine.reverse();
+            lastLine.rotate90(-offset);
+            Node newNode = createNode(lastLine.getP2().getX(), lastLine.getP2()
+                    .getY());
+            commands.add(new AddCommand(newNode));
+            Segment s = new Segment(newNode, lastNode);
+            commands.add(new AddCommand(s));
+            newWay.segments.add(0, s);
+
+            for (String key : way.keySet()) {
+                newWay.put(key, way.get(key));
+            }
+            commands.add(new AddCommand(newWay));
+            ways.add(newWay);
+        }
+
+        Main.main.undoRedo.add(new SequenceCommand(tr("Create duplicate way"),
+                commands));
+        Main.ds.setSelected(ways);
+    }
+
+    /**
+     * Enable the "Duplicate way" menu option if at least one way is selected
+     *
+     * @param newSelection
+     */
+    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
+        for (OsmPrimitive osm : newSelection) {
+            if (osm instanceof Way) {
+                setEnabled(true);
+                return;
+            }
+        }
+        setEnabled(false);
+    }
+
+    /**
+     * User has clicked on map to indicate the offset. Create the
+     * duplicate way and exit duplicate mode
+     *
+     * @param e
+     */
+    public void mouseClicked(MouseEvent e) {
+        duplicate(e.getPoint());
+        exitMode();
+        Main.map.selectMapMode(previousMode);
+    }
 }
Index: /applications/editors/josm/plugins/duplicateway/src/org/openstreetmap/josm/plugins/duplicateway/DuplicateWayPlugin.java
===================================================================
--- /applications/editors/josm/plugins/duplicateway/src/org/openstreetmap/josm/plugins/duplicateway/DuplicateWayPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/duplicateway/src/org/openstreetmap/josm/plugins/duplicateway/DuplicateWayPlugin.java	(revision 12778)
@@ -11,5 +11,5 @@
 /**
  * A plugin to add a duplicate way option to assist with creating divided roads
- * 
+ *
  * @author Brent Easton
  */
@@ -38,5 +38,5 @@
       toolsMenu.add(new JMenuItem(new DuplicateWayAction()));
     }
-    
+
   }
 
Index: /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/ByteHelper.java
===================================================================
--- /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/ByteHelper.java	(revision 12777)
+++ /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/ByteHelper.java	(revision 12778)
@@ -12,102 +12,102 @@
 {
 
-	/**
-	 * 
-	 * @param src
-	 * @param startS
-	 * @param len
-	 * @param dest
-	 * @param startD
-	 * @return
-	 */
-	public static int copyByteArr2ByteArr(byte src[], int startS, int len, byte dest[], int startD)
-	{
-		for (int ii = 0 ;
-			ii < len && startD < dest.length && startS < src.length && startD >= 0 && startS >= 0;
-			++ii, ++startD, ++startS)
-		{
-			dest[startD] = src[startS];
-		}
-		return startD;
-	}
+    /**
+     *
+     * @param src
+     * @param startS
+     * @param len
+     * @param dest
+     * @param startD
+     * @return
+     */
+    public static int copyByteArr2ByteArr(byte src[], int startS, int len, byte dest[], int startD)
+    {
+        for (int ii = 0 ;
+            ii < len && startD < dest.length && startS < src.length && startD >= 0 && startS >= 0;
+            ++ii, ++startD, ++startS)
+        {
+            dest[startD] = src[startS];
+        }
+        return startD;
+    }
 
-	/**
-	 * 
-	 * @param byt
-	 * @return
-	 */
-	public static int byte2IntUnsigned(byte byt)
-	{
-		return ((byt >= 0) ? byt : 256 + byt);
-	}
+    /**
+     *
+     * @param byt
+     * @return
+     */
+    public static int byte2IntUnsigned(byte byt)
+    {
+        return ((byt >= 0) ? byt : 256 + byt);
+    }
 
-	/**
-	 * 
-	 * @param nibble
-	 */
-	private static char nibble2Char(int nibble)
-	{
-		char chr = '*';
-		nibble = nibble & 0xF;
-		switch (nibble)
-		{
-		case 0: chr = '0'; break;
-		case 1: chr = '1'; break;
-		case 2: chr = '2'; break;
-		case 3: chr = '3'; break;
-		case 4: chr = '4'; break;
-		case 5: chr = '5'; break;
-		case 6: chr = '6'; break;
-		case 7: chr = '7'; break;
-		case 8: chr = '8'; break;
-		case 9: chr = '9'; break;
-		case 10: chr = 'A'; break;
-		case 11: chr = 'B'; break;
-		case 12: chr = 'C'; break;
-		case 13: chr = 'D'; break;
-		case 14: chr = 'E'; break;
-		case 15: chr = 'F'; break;
-		}
-		return chr; 
-	}
+    /**
+     *
+     * @param nibble
+     */
+    private static char nibble2Char(int nibble)
+    {
+        char chr = '*';
+        nibble = nibble & 0xF;
+        switch (nibble)
+        {
+        case 0: chr = '0'; break;
+        case 1: chr = '1'; break;
+        case 2: chr = '2'; break;
+        case 3: chr = '3'; break;
+        case 4: chr = '4'; break;
+        case 5: chr = '5'; break;
+        case 6: chr = '6'; break;
+        case 7: chr = '7'; break;
+        case 8: chr = '8'; break;
+        case 9: chr = '9'; break;
+        case 10: chr = 'A'; break;
+        case 11: chr = 'B'; break;
+        case 12: chr = 'C'; break;
+        case 13: chr = 'D'; break;
+        case 14: chr = 'E'; break;
+        case 15: chr = 'F'; break;
+        }
+        return chr;
+    }
 
-	/**
-	 * 
-	 * @return
-	 */
-	public static String byte2StringUnsigned(byte byt)
-	{
-		StringBuffer buf = new StringBuffer(4);
-		int bb = byte2IntUnsigned(byt);
-		//buf.append("0x");
-		buf.append(nibble2Char(bb / 16));
-		buf.append(nibble2Char(bb % 16));
-		return buf.toString();
-	}
+    /**
+     *
+     * @return
+     */
+    public static String byte2StringUnsigned(byte byt)
+    {
+        StringBuffer buf = new StringBuffer(4);
+        int bb = byte2IntUnsigned(byt);
+        //buf.append("0x");
+        buf.append(nibble2Char(bb / 16));
+        buf.append(nibble2Char(bb % 16));
+        return buf.toString();
+    }
 
-	/**
-	 * 
-	 * @param byt
-	 */
-	public static String byteArray2String(byte byt[])
-	{
-		return byteArray2String(byt, byt.length);
-	}
+    /**
+     *
+     * @param byt
+     */
+    public static String byteArray2String(byte byt[])
+    {
+        return byteArray2String(byt, byt.length);
+    }
 
-	/**
-	 * 
-	 * @param byt
-	 * @param cnt
-	 */
-	public static String byteArray2String(byte byt[], int cnt)
-	{
-		StringBuffer buf = new StringBuffer(cnt * 5);
-		for (int ii = 0 ; ii < cnt && ii < byt.length ; ++ii)
-		{
-			if (ii > 0) {buf.append(" ");}
-			buf.append(byte2StringUnsigned(byt[ii]));
-		}
-		return buf.toString();
-	}
+    /**
+     *
+     * @param byt
+     * @param cnt
+     */
+    public static String byteArray2String(byte byt[], int cnt)
+    {
+        StringBuffer buf = new StringBuffer(cnt * 5);
+        for (int ii = 0 ; ii < cnt && ii < byt.length ; ++ii)
+        {
+            if (ii > 0) {buf.append(" ");}
+            buf.append(byte2StringUnsigned(byt[ii]));
+        }
+        return buf.toString();
+    }
 
 }
Index: /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/Dg100Config.java
===================================================================
--- /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/Dg100Config.java	(revision 12777)
+++ /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/Dg100Config.java	(revision 12778)
@@ -30,485 +30,485 @@
 //  nn nn nn nn: distance in m
 //  xx xx: checksum
-//	A0 A2 00 35 B7 jj kk ll ll ll ll mm nn nn nn nn
+//  A0 A2 00 35 B7 jj kk ll ll ll ll mm nn nn nn nn
 //  aa aa aa aa bb bb bb bb cc cc cc cc 00 00 gg hh
 //  ii dd dd dd dd ee ee ee ee ff ff ff ff 01 61 01
 //  01 0C D5 0D 00 04 CC B0 B3
 
-	private byte logFormat = -1;
-	private byte disableLogSpeed = -1;
-	private int speedThres = -1;
-	private byte disableLogDist = -1;
-	private int distThres = -1;
-	private int swATime = -1;
-	private int swBTime = -1;
-	private int swCTime = -1;
-	private short unk1 = -1;
-	private byte swATimeOrDist = -1;
-	private byte swBTimeOrDist = -1;
-	private byte swCTimeOrDist = -1;
-	private int swADist = -1;
-	private int swBDist = -1;
-	private int swCDist = -1;
-	private byte unk2 = -1;
-	private int remainder = -1;
-	private int unk3 = -1;
-	private int unk4 = -1;
-
-	private static String propLogFormat = "logFormat";
-	private static String propDisableLogSpeed = "disableLogSpeed";
-	private static String propSpeedThres = "speedThres";
-	private static String propDisableLogDist = "disableLogDist";
-	private static String propDistThres = "distThres";
-	private static String propSwATime = "swATime";
-	private static String propSwBTime = "swBTime";
-	private static String propSwCTime = "swCTime";
-	private static String propUnk1 = "unk1";
-	private static String propSwATimeOrDist = "swATimeOrDist";
-	private static String propSwBTimeOrDist = "swBTimeOrDist";
-	private static String propSwCTimeOrDist = "swCTimeOrDist";
-	private static String propSwADist = "swADist";
-	private static String propSwBDist = "swBDist";
-	private static String propSwCDist = "swCDist";
-	private static String propUnk2 = "unk2";
-	private static String propRemainder = "remainder";
-	private static String propUnk3 = "unk3";
-	private static String propUnk4 = "unk4";
-
-	public Dg100Config(ByteBuffer buf)
-	{
-		logFormat = buf.get();
-		disableLogSpeed = buf.get();
-		speedThres = buf.getInt();
-		disableLogDist = buf.get();
-		distThres = buf.getInt();
-		swATime = buf.getInt();
-		swBTime = buf.getInt();
-		swCTime = buf.getInt();
-		unk1 = buf.getShort();
-		swATimeOrDist = buf.get();
-		swBTimeOrDist = buf.get();
-		swCTimeOrDist = buf.get();
-		swADist = buf.getInt();
-		swBDist = buf.getInt();
-		swCDist = buf.getInt();
-		unk2 = buf.get();
-		remainder = buf.get();
-		unk3 = buf.get();
-		unk4 = buf.get();
-	}
-
-	public Dg100Config(String fName)
-		throws Exception
-	{
-		readProps(fName);
-	}
-
-	public String toString()
-	{
-		return 
-			"[Dg100Config: logFormat = " + logFormat
-			+ ",disableLogSpeed = " + disableLogSpeed
-			+ ",speedThres = " + speedThres
-			+ ",disableLogDist = " + disableLogDist
-			+ ",distThres = " + distThres
-			+ ",swATime = " + swATime
-			+ ",swBTime = " + swBTime
-			+ ",swCTime = " + swCTime
-			+ ",unk1 = " + unk1
-			+ ",swATimeOrDist = " + swATimeOrDist
-			+ ",swBTimeOrDist = " + swBTimeOrDist
-			+ ",swCTimeOrDist = " + swCTimeOrDist
-			+ ",swADist = " + swADist
-			+ ",swBDist = " + swBDist
-			+ ",swCDist = " + swCDist
-			+ ",unk2 = " + unk2
-			+ ",remainder = " + remainder
-			+ ",unk3 = " + unk3
-			+ ",unk4 = " + unk4
-			;
-	}
-
-	/**
-	 * @param buf
-	 */
-	public void write(ByteBuffer buf)
-	{
-		buf.position(5);
-		buf.put(logFormat);
-		buf.put(disableLogSpeed);
-		buf.putInt(speedThres);
-		buf.put(disableLogDist);
-		buf.putInt(distThres);
-		buf.putInt(swATime);
-		buf.putInt(swBTime);
-		buf.putInt(swCTime);
-		buf.putShort(unk1);
-		buf.put(swATimeOrDist);
-		buf.put(swBTimeOrDist);
-		buf.put(swCTimeOrDist);
-		buf.putInt(swADist);
-		buf.putInt(swBDist);
-		buf.putInt(swCDist);
-		buf.put(unk2);
-	}
-
-	/**
-	 * @return Returns the disableLogDist.
-	 */
-	public boolean getDisableLogDist()
-	{
-		return disableLogDist != 0;
-	}
-
-	/**
-	 * @param disableLogDist The disableLogDist to set.
-	 */
-	public void setDisableLogDist(boolean disableLogDist)
-	{
+    private byte logFormat = -1;
+    private byte disableLogSpeed = -1;
+    private int speedThres = -1;
+    private byte disableLogDist = -1;
+    private int distThres = -1;
+    private int swATime = -1;
+    private int swBTime = -1;
+    private int swCTime = -1;
+    private short unk1 = -1;
+    private byte swATimeOrDist = -1;
+    private byte swBTimeOrDist = -1;
+    private byte swCTimeOrDist = -1;
+    private int swADist = -1;
+    private int swBDist = -1;
+    private int swCDist = -1;
+    private byte unk2 = -1;
+    private int remainder = -1;
+    private int unk3 = -1;
+    private int unk4 = -1;
+
+    private static String propLogFormat = "logFormat";
+    private static String propDisableLogSpeed = "disableLogSpeed";
+    private static String propSpeedThres = "speedThres";
+    private static String propDisableLogDist = "disableLogDist";
+    private static String propDistThres = "distThres";
+    private static String propSwATime = "swATime";
+    private static String propSwBTime = "swBTime";
+    private static String propSwCTime = "swCTime";
+    private static String propUnk1 = "unk1";
+    private static String propSwATimeOrDist = "swATimeOrDist";
+    private static String propSwBTimeOrDist = "swBTimeOrDist";
+    private static String propSwCTimeOrDist = "swCTimeOrDist";
+    private static String propSwADist = "swADist";
+    private static String propSwBDist = "swBDist";
+    private static String propSwCDist = "swCDist";
+    private static String propUnk2 = "unk2";
+    private static String propRemainder = "remainder";
+    private static String propUnk3 = "unk3";
+    private static String propUnk4 = "unk4";
+
+    public Dg100Config(ByteBuffer buf)
+    {
+        logFormat = buf.get();
+        disableLogSpeed = buf.get();
+        speedThres = buf.getInt();
+        disableLogDist = buf.get();
+        distThres = buf.getInt();
+        swATime = buf.getInt();
+        swBTime = buf.getInt();
+        swCTime = buf.getInt();
+        unk1 = buf.getShort();
+        swATimeOrDist = buf.get();
+        swBTimeOrDist = buf.get();
+        swCTimeOrDist = buf.get();
+        swADist = buf.getInt();
+        swBDist = buf.getInt();
+        swCDist = buf.getInt();
+        unk2 = buf.get();
+        remainder = buf.get();
+        unk3 = buf.get();
+        unk4 = buf.get();
+    }
+
+    public Dg100Config(String fName)
+        throws Exception
+    {
+        readProps(fName);
+    }
+
+    public String toString()
+    {
+        return
+            "[Dg100Config: logFormat = " + logFormat
+            + ",disableLogSpeed = " + disableLogSpeed
+            + ",speedThres = " + speedThres
+            + ",disableLogDist = " + disableLogDist
+            + ",distThres = " + distThres
+            + ",swATime = " + swATime
+            + ",swBTime = " + swBTime
+            + ",swCTime = " + swCTime
+            + ",unk1 = " + unk1
+            + ",swATimeOrDist = " + swATimeOrDist
+            + ",swBTimeOrDist = " + swBTimeOrDist
+            + ",swCTimeOrDist = " + swCTimeOrDist
+            + ",swADist = " + swADist
+            + ",swBDist = " + swBDist
+            + ",swCDist = " + swCDist
+            + ",unk2 = " + unk2
+            + ",remainder = " + remainder
+            + ",unk3 = " + unk3
+            + ",unk4 = " + unk4
+            ;
+    }
+
+    /**
+     * @param buf
+     */
+    public void write(ByteBuffer buf)
+    {
+        buf.position(5);
+        buf.put(logFormat);
+        buf.put(disableLogSpeed);
+        buf.putInt(speedThres);
+        buf.put(disableLogDist);
+        buf.putInt(distThres);
+        buf.putInt(swATime);
+        buf.putInt(swBTime);
+        buf.putInt(swCTime);
+        buf.putShort(unk1);
+        buf.put(swATimeOrDist);
+        buf.put(swBTimeOrDist);
+        buf.put(swCTimeOrDist);
+        buf.putInt(swADist);
+        buf.putInt(swBDist);
+        buf.putInt(swCDist);
+        buf.put(unk2);
+    }
+
+    /**
+     * @return Returns the disableLogDist.
+     */
+    public boolean getDisableLogDist()
+    {
+        return disableLogDist != 0;
+    }
+
+    /**
+     * @param disableLogDist The disableLogDist to set.
+     */
+    public void setDisableLogDist(boolean disableLogDist)
+    {
             this.disableLogDist = (byte)(disableLogDist ? 1 : 0);
-	}
-
-	/**
-	 * @return Returns the disableLogSpeed.
-	 */
-	public boolean getDisableLogSpeed()
-	{
-		return disableLogSpeed != 0;
-	}
-
-	/**
-	 * @param disableLogSpeed The disableLogSpeed to set.
-	 */
-	public void setDisableLogSpeed(boolean disableLogSpeed)
-	{
+    }
+
+    /**
+     * @return Returns the disableLogSpeed.
+     */
+    public boolean getDisableLogSpeed()
+    {
+        return disableLogSpeed != 0;
+    }
+
+    /**
+     * @param disableLogSpeed The disableLogSpeed to set.
+     */
+    public void setDisableLogSpeed(boolean disableLogSpeed)
+    {
             this.disableLogSpeed = (byte)(disableLogSpeed ? 1 : 0);
-	}
-
-	/**
-	 * @return Returns the distThres.
-	 */
-	public int getDistThres()
-	{
-		return distThres;
-	}
-
-	/**
-	 * @param distThres The distThres to set.
-	 */
-	public void setDistThres(int distThres)
-	{
-		this.distThres = distThres;
-	}
-
-	/**
-	 * @return Returns the logFormat.
-	 */
-	public byte getLogFormat()
-	{
-		return logFormat;
-	}
-
-	/**
-	 * @param logFormat The logFormat to set.
-	 */
-	public void setLogFormat(byte logFormat)
-	{
-		this.logFormat = logFormat;
-	}
-
-	/**
-	 * @return Returns the speedThres.
-	 */
-	public int getSpeedThres()
-	{
-		return speedThres;
-	}
-
-	/**
-	 * @param speedThres The speedThres to set.
-	 */
-	public void setSpeedThres(int speedThres)
-	{
-		this.speedThres = speedThres;
-	}
-
-	/**
-	 * @return Returns the swADist.
-	 */
-	public int getSwADist()
-	{
-		return swADist;
-	}
-
-	/**
-	 * @param swADist The swADist to set.
-	 */
-	public void setSwADist(int swADist)
-	{
-		this.swADist = swADist;
-	}
-
-	/**
-	 * @return Returns the swATime.
-	 */
-	public int getSwATime()
-	{
-		return swATime;
-	}
-
-	/**
-	 * @param swATime The swATime to set.
-	 */
-	public void setSwATime(int swATime)
-	{
-		this.swATime = swATime;
-	}
-
-	/**
-	 * @return Returns the swATimeOrDist.
-	 */
-	public byte getSwATimeOrDist()
-	{
-		return swATimeOrDist;
-	}
-
-	/**
-	 * @param swATimeOrDist The swATimeOrDist to set.
-	 */
-	public void setSwATimeOrDist(byte swATimeOrDist)
-	{
-		this.swATimeOrDist = swATimeOrDist;
-	}
-
-	/**
-	 * @return Returns the swBDist.
-	 */
-	public int getSwBDist()
-	{
-		return swBDist;
-	}
-
-	/**
-	 * @param swBDist The swBDist to set.
-	 */
-	public void setSwBDist(int swBDist)
-	{
-		this.swBDist = swBDist;
-	}
-
-	/**
-	 * @return Returns the swBTime.
-	 */
-	public int getSwBTime()
-	{
-		return swBTime;
-	}
-
-	/**
-	 * @param swBTime The swBTime to set.
-	 */
-	public void setSwBTime(int swBTime)
-	{
-		this.swBTime = swBTime;
-	}
-
-	/**
-	 * @return Returns the swBTimeOrDist.
-	 */
-	public byte getSwBTimeOrDist()
-	{
-		return swBTimeOrDist;
-	}
-
-	/**
-	 * @param swBTimeOrDist The swBTimeOrDist to set.
-	 */
-	public void setSwBTimeOrDist(byte swBTimeOrDist)
-	{
-		this.swBTimeOrDist = swBTimeOrDist;
-	}
-
-	/**
-	 * @return Returns the swCDist.
-	 */
-	public int getSwCDist()
-	{
-		return swCDist;
-	}
-
-	/**
-	 * @param swCDist The swCDist to set.
-	 */
-	public void setSwCDist(int swCDist)
-	{
-		this.swCDist = swCDist;
-	}
-
-	/**
-	 * @return Returns the swCTime.
-	 */
-	public int getSwCTime()
-	{
-		return swCTime;
-	}
-
-	/**
-	 * @param swCTime The swCTime to set.
-	 */
-	public void setSwCTime(int swCTime)
-	{
-		this.swCTime = swCTime;
-	}
-
-	/**
-	 * @return Returns the swCTimeOrDist.
-	 */
-	public byte getSwCTimeOrDist()
-	{
-		return swCTimeOrDist;
-	}
-
-	/**
-	 * @param swCTimeOrDist The swCTimeOrDist to set.
-	 */
-	public void setSwCTimeOrDist(byte swCTimeOrDist)
-	{
-		this.swCTimeOrDist = swCTimeOrDist;
-	}
-
-	/**
-	 * @return Returns the unk1.
-	 */
-	public short getUnk1()
-	{
-		return unk1;
-	}
-
-	/**
-	 * @param unk1 The unk1 to set.
-	 */
-	public void setUnk1(short unk1)
-	{
-		this.unk1 = unk1;
-	}
-
-	/**
-	 * @return Returns the unk2.
-	 */
-	public byte getUnk2()
-	{
-		return unk2;
-	}
-
-	/**
-	 * @param unk2 The unk2 to set.
-	 */
-	public void setUnk2(byte unk2)
-	{
-		this.unk2 = unk2;
-	}
-
-	/**
-	 * @return Returns the remainder.
-	 */
-	public int getRemainder()
-	{
-		return remainder;
-	}
-
-	/**
-	 * @return Returns the unk3.
-	 */
-	public int getUnk3()
-	{
-		return unk3;
-	}
-
-	/**
-	 * @return Returns the unk4.
-	 */
-	public int getUnk4()
-	{
-		return unk4;
-	}
-
-	public void writeProps(String fName)
-		throws Exception
-	{
-		Properties props = new Properties();
-		props.setProperty(propLogFormat, "" + logFormat);
-		props.setProperty(propDisableLogSpeed, "" + disableLogSpeed);
-		props.setProperty(propSpeedThres, "" + speedThres);
-		props.setProperty(propDisableLogDist, "" + disableLogDist);
-		props.setProperty(propDistThres, "" + distThres);
-		props.setProperty(propSwATime, "" + swATime);
-		props.setProperty(propSwBTime, "" + swBTime);
-		props.setProperty(propSwCTime, "" + swCTime);
-		props.setProperty(propUnk1, "" + unk1);
-		props.setProperty(propSwATimeOrDist, "" + swATimeOrDist);
-		props.setProperty(propSwBTimeOrDist, "" + swBTimeOrDist);
-		props.setProperty(propSwCTimeOrDist, "" + swCTimeOrDist);
-		props.setProperty(propSwADist, "" + swADist);
-		props.setProperty(propSwBDist, "" + swBDist);
-		props.setProperty(propSwCDist, "" + swCDist);
-		props.setProperty(propUnk2, "" + unk2);
-		props.setProperty(propRemainder, "" + remainder);
-		props.setProperty(propUnk3, "" + unk3);
-		props.setProperty(propUnk4, "" + unk4);
-		OutputStream os = null;
-		try
-		{
-			os = new FileOutputStream(fName);
-			props.store(os, "dg100 config");
-		}
-		catch (Exception ex)
-		{
-			ex.printStackTrace();
-			throw ex;
-		}
-		finally
-		{
-			if (os != null) {os.close();}
-		}
-	}
-
-	public void readProps(String fName)
-		throws Exception
-	{
-		Properties props = new Properties();
-		InputStream is = null;
-		try
-		{
-			is = new FileInputStream(fName);
-			props.load(is);
-		}
-		catch (Exception ex)
-		{
-			ex.printStackTrace();
-			throw ex;
-		}
-		finally
-		{
-			if (is != null) {is.close();}
-		}
-		logFormat = Byte.parseByte(props.getProperty(propLogFormat, "2"));
-		disableLogSpeed = Byte.parseByte(props.getProperty(propDisableLogSpeed, "0"));
-		speedThres = Integer.parseInt(props.getProperty(propSpeedThres, "0"));
-		disableLogDist = Byte.parseByte(props.getProperty(propDisableLogDist, "0"));
-		distThres = Integer.parseInt(props.getProperty(propDistThres, "0"));
-		swATime = Integer.parseInt(props.getProperty(propSwATime, "1000"));
-		swBTime = Integer.parseInt(props.getProperty(propSwBTime, "1000"));
-		swCTime = Integer.parseInt(props.getProperty(propSwCTime, "1000"));
-		swATimeOrDist = Byte.parseByte(props.getProperty(propSwATimeOrDist, "0"));
-		swBTimeOrDist = Byte.parseByte(props.getProperty(propSwBTimeOrDist, "0"));
-		swCTimeOrDist = Byte.parseByte(props.getProperty(propSwCTimeOrDist, "0"));
-		swADist = Integer.parseInt(props.getProperty(propSwADist, "0"));
-		swBDist = Integer.parseInt(props.getProperty(propSwBDist, "0"));
-		swCDist = Integer.parseInt(props.getProperty(propSwCDist, "0"));
-		unk1 = Short.parseShort(props.getProperty(propUnk1, "0"));
-		unk2 = Byte.parseByte(props.getProperty(propUnk2, "0"));
-		unk3 = Integer.parseInt(props.getProperty(propUnk3, "0"));
-		unk4 = Integer.parseInt(props.getProperty(propUnk4, "0"));
-	}
+    }
+
+    /**
+     * @return Returns the distThres.
+     */
+    public int getDistThres()
+    {
+        return distThres;
+    }
+
+    /**
+     * @param distThres The distThres to set.
+     */
+    public void setDistThres(int distThres)
+    {
+        this.distThres = distThres;
+    }
+
+    /**
+     * @return Returns the logFormat.
+     */
+    public byte getLogFormat()
+    {
+        return logFormat;
+    }
+
+    /**
+     * @param logFormat The logFormat to set.
+     */
+    public void setLogFormat(byte logFormat)
+    {
+        this.logFormat = logFormat;
+    }
+
+    /**
+     * @return Returns the speedThres.
+     */
+    public int getSpeedThres()
+    {
+        return speedThres;
+    }
+
+    /**
+     * @param speedThres The speedThres to set.
+     */
+    public void setSpeedThres(int speedThres)
+    {
+        this.speedThres = speedThres;
+    }
+
+    /**
+     * @return Returns the swADist.
+     */
+    public int getSwADist()
+    {
+        return swADist;
+    }
+
+    /**
+     * @param swADist The swADist to set.
+     */
+    public void setSwADist(int swADist)
+    {
+        this.swADist = swADist;
+    }
+
+    /**
+     * @return Returns the swATime.
+     */
+    public int getSwATime()
+    {
+        return swATime;
+    }
+
+    /**
+     * @param swATime The swATime to set.
+     */
+    public void setSwATime(int swATime)
+    {
+        this.swATime = swATime;
+    }
+
+    /**
+     * @return Returns the swATimeOrDist.
+     */
+    public byte getSwATimeOrDist()
+    {
+        return swATimeOrDist;
+    }
+
+    /**
+     * @param swATimeOrDist The swATimeOrDist to set.
+     */
+    public void setSwATimeOrDist(byte swATimeOrDist)
+    {
+        this.swATimeOrDist = swATimeOrDist;
+    }
+
+    /**
+     * @return Returns the swBDist.
+     */
+    public int getSwBDist()
+    {
+        return swBDist;
+    }
+
+    /**
+     * @param swBDist The swBDist to set.
+     */
+    public void setSwBDist(int swBDist)
+    {
+        this.swBDist = swBDist;
+    }
+
+    /**
+     * @return Returns the swBTime.
+     */
+    public int getSwBTime()
+    {
+        return swBTime;
+    }
+
+    /**
+     * @param swBTime The swBTime to set.
+     */
+    public void setSwBTime(int swBTime)
+    {
+        this.swBTime = swBTime;
+    }
+
+    /**
+     * @return Returns the swBTimeOrDist.
+     */
+    public byte getSwBTimeOrDist()
+    {
+        return swBTimeOrDist;
+    }
+
+    /**
+     * @param swBTimeOrDist The swBTimeOrDist to set.
+     */
+    public void setSwBTimeOrDist(byte swBTimeOrDist)
+    {
+        this.swBTimeOrDist = swBTimeOrDist;
+    }
+
+    /**
+     * @return Returns the swCDist.
+     */
+    public int getSwCDist()
+    {
+        return swCDist;
+    }
+
+    /**
+     * @param swCDist The swCDist to set.
+     */
+    public void setSwCDist(int swCDist)
+    {
+        this.swCDist = swCDist;
+    }
+
+    /**
+     * @return Returns the swCTime.
+     */
+    public int getSwCTime()
+    {
+        return swCTime;
+    }
+
+    /**
+     * @param swCTime The swCTime to set.
+     */
+    public void setSwCTime(int swCTime)
+    {
+        this.swCTime = swCTime;
+    }
+
+    /**
+     * @return Returns the swCTimeOrDist.
+     */
+    public byte getSwCTimeOrDist()
+    {
+        return swCTimeOrDist;
+    }
+
+    /**
+     * @param swCTimeOrDist The swCTimeOrDist to set.
+     */
+    public void setSwCTimeOrDist(byte swCTimeOrDist)
+    {
+        this.swCTimeOrDist = swCTimeOrDist;
+    }
+
+    /**
+     * @return Returns the unk1.
+     */
+    public short getUnk1()
+    {
+        return unk1;
+    }
+
+    /**
+     * @param unk1 The unk1 to set.
+     */
+    public void setUnk1(short unk1)
+    {
+        this.unk1 = unk1;
+    }
+
+    /**
+     * @return Returns the unk2.
+     */
+    public byte getUnk2()
+    {
+        return unk2;
+    }
+
+    /**
+     * @param unk2 The unk2 to set.
+     */
+    public void setUnk2(byte unk2)
+    {
+        this.unk2 = unk2;
+    }
+
+    /**
+     * @return Returns the remainder.
+     */
+    public int getRemainder()
+    {
+        return remainder;
+    }
+
+    /**
+     * @return Returns the unk3.
+     */
+    public int getUnk3()
+    {
+        return unk3;
+    }
+
+    /**
+     * @return Returns the unk4.
+     */
+    public int getUnk4()
+    {
+        return unk4;
+    }
+
+    public void writeProps(String fName)
+        throws Exception
+    {
+        Properties props = new Properties();
+        props.setProperty(propLogFormat, "" + logFormat);
+        props.setProperty(propDisableLogSpeed, "" + disableLogSpeed);
+        props.setProperty(propSpeedThres, "" + speedThres);
+        props.setProperty(propDisableLogDist, "" + disableLogDist);
+        props.setProperty(propDistThres, "" + distThres);
+        props.setProperty(propSwATime, "" + swATime);
+        props.setProperty(propSwBTime, "" + swBTime);
+        props.setProperty(propSwCTime, "" + swCTime);
+        props.setProperty(propUnk1, "" + unk1);
+        props.setProperty(propSwATimeOrDist, "" + swATimeOrDist);
+        props.setProperty(propSwBTimeOrDist, "" + swBTimeOrDist);
+        props.setProperty(propSwCTimeOrDist, "" + swCTimeOrDist);
+        props.setProperty(propSwADist, "" + swADist);
+        props.setProperty(propSwBDist, "" + swBDist);
+        props.setProperty(propSwCDist, "" + swCDist);
+        props.setProperty(propUnk2, "" + unk2);
+        props.setProperty(propRemainder, "" + remainder);
+        props.setProperty(propUnk3, "" + unk3);
+        props.setProperty(propUnk4, "" + unk4);
+        OutputStream os = null;
+        try
+        {
+            os = new FileOutputStream(fName);
+            props.store(os, "dg100 config");
+        }
+        catch (Exception ex)
+        {
+            ex.printStackTrace();
+            throw ex;
+        }
+        finally
+        {
+            if (os != null) {os.close();}
+        }
+    }
+
+    public void readProps(String fName)
+        throws Exception
+    {
+        Properties props = new Properties();
+        InputStream is = null;
+        try
+        {
+            is = new FileInputStream(fName);
+            props.load(is);
+        }
+        catch (Exception ex)
+        {
+            ex.printStackTrace();
+            throw ex;
+        }
+        finally
+        {
+            if (is != null) {is.close();}
+        }
+        logFormat = Byte.parseByte(props.getProperty(propLogFormat, "2"));
+        disableLogSpeed = Byte.parseByte(props.getProperty(propDisableLogSpeed, "0"));
+        speedThres = Integer.parseInt(props.getProperty(propSpeedThres, "0"));
+        disableLogDist = Byte.parseByte(props.getProperty(propDisableLogDist, "0"));
+        distThres = Integer.parseInt(props.getProperty(propDistThres, "0"));
+        swATime = Integer.parseInt(props.getProperty(propSwATime, "1000"));
+        swBTime = Integer.parseInt(props.getProperty(propSwBTime, "1000"));
+        swCTime = Integer.parseInt(props.getProperty(propSwCTime, "1000"));
+        swATimeOrDist = Byte.parseByte(props.getProperty(propSwATimeOrDist, "0"));
+        swBTimeOrDist = Byte.parseByte(props.getProperty(propSwBTimeOrDist, "0"));
+        swCTimeOrDist = Byte.parseByte(props.getProperty(propSwCTimeOrDist, "0"));
+        swADist = Integer.parseInt(props.getProperty(propSwADist, "0"));
+        swBDist = Integer.parseInt(props.getProperty(propSwBDist, "0"));
+        swCDist = Integer.parseInt(props.getProperty(propSwCDist, "0"));
+        unk1 = Short.parseShort(props.getProperty(propUnk1, "0"));
+        unk2 = Byte.parseByte(props.getProperty(propUnk2, "0"));
+        unk3 = Integer.parseInt(props.getProperty(propUnk3, "0"));
+        unk4 = Integer.parseInt(props.getProperty(propUnk4, "0"));
+    }
 
 }
Index: /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/FileInfoRec.java
===================================================================
--- /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/FileInfoRec.java	(revision 12777)
+++ /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/FileInfoRec.java	(revision 12778)
@@ -13,26 +13,26 @@
 public class FileInfoRec
 {
-	private int timeZ = 0;
-	private int date = 0;
-	private int idx = 0;
-	
-	public FileInfoRec(ByteBuffer buf)
-	{
-		timeZ =  buf.getInt();
-		date =  buf.getInt();
-		idx =  buf.getInt();
-	}
-	
-	public String toString()
-	{
-		return "[FileInfoRec: timeZ = " + timeZ + ", date = " + date + ", idx = " + idx + "]";
-	}
+    private int timeZ = 0;
+    private int date = 0;
+    private int idx = 0;
 
-	/**
-	 * @return Returns the idx.
-	 */
-	public int getIdx()
-	{
-		return idx;
-	}
+    public FileInfoRec(ByteBuffer buf)
+    {
+        timeZ =  buf.getInt();
+        date =  buf.getInt();
+        idx =  buf.getInt();
+    }
+
+    public String toString()
+    {
+        return "[FileInfoRec: timeZ = " + timeZ + ", date = " + date + ", idx = " + idx + "]";
+    }
+
+    /**
+     * @return Returns the idx.
+     */
+    public int getIdx()
+    {
+        return idx;
+    }
 }
Index: /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/GpsRec.java
===================================================================
--- /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/GpsRec.java	(revision 12777)
+++ /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/GpsRec.java	(revision 12778)
@@ -22,420 +22,420 @@
 //  ff ff ff ff: dg100Altitude (m): alt * 10000
 
-	private int dg100Latitude = -1;
-	private int dg100Longitude = -1;
-	private int dg100TimeZ = -1;
-	private int dg100Date = -1;
-	private int dg100Speed = -1;
-	private int dg100Altitude = -1;
-	private int dg100Unk1 = -1;
-	private int dg100TypeOfCurRec = -1;
-	private int dg100TypeOfNextRec = -1;
-	// calculated data
-	private Calendar dateTime = null;
-
-	public GpsRec()
-	{
-		dg100TypeOfNextRec = 2;
-		dg100TypeOfCurRec = 2;
-		dg100Latitude = 0;
-		dg100Longitude = 0;
-		dg100TimeZ = 0;
-		dg100Date = 0;
-		dg100Speed = 0;
-		dg100Altitude = 0;
-		dg100Unk1 = -1;
-		dateTime = null;
-	}
-
-	public void copy(GpsRec init)
-	{
-		dg100TypeOfNextRec = init.dg100TypeOfNextRec;
-		dg100TypeOfCurRec = init.dg100TypeOfCurRec;
-		dg100Latitude = init.dg100Latitude;
-		dg100Longitude = init.dg100Longitude;
-		dg100TimeZ = init.dg100TimeZ;
-		dg100Date = init.dg100Date;
-		dg100Speed = init.dg100Speed;
-		dg100Altitude = init.dg100Altitude;
-		dg100Unk1 = init.dg100Unk1;
-		dateTime = init.dateTime;
-	}
-
-	public GpsRec(GpsRec init)
-	{
-		copy(init);
-	}
-
-	/**
-	 * @see java.lang.Object#equals(java.lang.Object)
-	 */
-	public boolean equals(Object arg0)
-	{
-		boolean isEqual = false;
-		if (arg0 != null && arg0 instanceof GpsRec)
-		{
-			GpsRec otherGpsRec = (GpsRec)arg0;
-			isEqual =
-				dg100TypeOfNextRec == otherGpsRec.dg100TypeOfNextRec
-				&& dg100TypeOfCurRec == otherGpsRec.dg100TypeOfCurRec
-				&& dg100Latitude == otherGpsRec.dg100Latitude
-				&& dg100Longitude == otherGpsRec.dg100Longitude
-				&& dg100TimeZ == otherGpsRec.dg100TimeZ
-				&& dg100Date == otherGpsRec.dg100Date
-				&& dg100Speed == otherGpsRec.dg100Speed
-				&& dg100Altitude == otherGpsRec.dg100Altitude
-				//&& dg100Unk1 == otherGpsRec.unk1
-				;
-		}
-		return isEqual;
-	}
-
-	public GpsRec(ByteBuffer buf, int recType)
-	{
-		dg100Latitude =  buf.getInt();
-		dg100Longitude =  buf.getInt();
-		dg100TypeOfNextRec = recType;
-		dg100TypeOfCurRec = recType;
-		dateTime = null;
-		if (dg100TypeOfNextRec >= 1)
-		{
-			dg100TimeZ = buf.getInt();
-			dg100Date = buf.getInt();
-			calcDateTime();
-			dg100Speed =  buf.getInt();
-			if (dg100TypeOfNextRec >= 1)
-			{
-				dg100Altitude =  buf.getInt();
-				dg100Unk1 =  buf.getInt();
-				dg100TypeOfNextRec =  buf.getInt();
-			}
-		}
-	}
-
-	/**
-	 * Shows wether this is a valid GPS record.
-	 * @return true if GPS record is valid; otherwise false.
-	 */
-	public boolean isValid()
-	{
-		return
-			dg100Latitude <= 360000000
-			&& dg100Latitude >= 0
-			&& dg100Longitude <= 360000000
-			&& dg100Longitude >= 0
-			&& dg100TimeZ >= 0
-			&& dg100TimeZ <= 240000
-			&& dg100Unk1 >= 0
-			&& dg100Unk1 <= 1
-			;
-	}
-
-	public int getDg100TypeOfNextRec()
-	{
-		return dg100TypeOfNextRec;
-	}
-
-	public int getDg100TypeOfCurRec()
-	{
-		return dg100TypeOfCurRec;
-	}
-
-	public String toString()
-	{
-		return "[GpsRec: "
-			+ " Lat = " + dg100Latitude
-			+ ", Long = " + dg100Longitude
-			+ ", TimeZ = " + dg100TimeZ
-			+ ", Date = " + dg100Date
-			+ ", Speed = " + dg100Speed
-			+ ", Alt = " + dg100Altitude
-			+ ", Unk1 = " + dg100Unk1
-			+ ", TypeOfCurRec = " + dg100TypeOfCurRec
-			+ ", TypeOfNextRec = " + dg100TypeOfNextRec
-			+ "]";
-	}
-
-	/**
-	 * @return Returns the dg100Latitude.
-	 */
-	public int getDg100Latitude()
-	{
-		return dg100Latitude;
-	}
-
-	/**
-	 * Converts this object to its GPX representation.
-	 * @return this object's GPX representation as a String.
-	 */
-	public String toGpxTrkpt()
-	{
-//		<trkpt lat="47.6972383333" lon="11.4178650000">
-//		<ele>662.0000000000</ele>
-//		<time>2007-04-21T13:56:05Z</time>
-//		<dg100Speed>1.0833333333</dg100Speed>
-//		</trkpt>
-		StringBuffer buf = new StringBuffer(500);
-		buf.append("<trkpt");
-		buf.append(" lat=\"").append(getLatitude()).append("\"");
-		buf.append(" lon=\"").append(getLongitude()).append("\"");
-		buf.append(">");
-		if (dg100TypeOfCurRec > 0)
-		{
-			if (dg100TypeOfCurRec > 1)
-			{
-				buf.append("<ele>").append(getAltitude()).append("</ele>");
-			}
-			buf.append("<time>").append(getStringZuluTime()).append("</time>");
-			buf.append("<speed>").append(getSpeed()).append("</speed>");
-		}
-		buf.append("</trkpt>");
-		return buf.toString();
-	}
-
-	/**
-	 * Converts this object to its GPX waypoint representation.
-	 * @return this object's GPX representation as a String.
-	 */
-	public String toGpxWpt()
-	{
-//		<wpt lat="47.6972383333" lon="11.4178650000">
-//		<ele>662.0000000000</ele>
-//		<time>2007-04-21T13:56:05Z</time>
-//		</wpt>
-		StringBuffer buf = new StringBuffer(500);
-		buf.append("<wpt");
-		buf.append(" lat=\"").append(getLatitude()).append("\"");
-		buf.append(" lon=\"").append(getLongitude()).append("\"");
-		buf.append(">");
-		if (dg100TypeOfCurRec > 0)
-		{
-			if (dg100TypeOfCurRec > 1)
-			{
-				buf.append("<ele>").append(getAltitude()).append("</ele>");
-			}
-			buf.append("<time>").append(getStringZuluTime()).append("</time>");
-		}
-		buf.append("</wpt>");
-		return buf.toString();
-	}
-
-	/**
-	 * Converts GlobalSat dg100Latitude and dg100Longitude internal format to degrees.
-	 * @param gsLatOrLon
-	 * @return nodeg in degrees
-	 */
-	private double toDegree(int gsLatOrLon)
-	{
-		int scale = 1000000;
-		double deg = 9999.9999;
-		double degScaled = (double)(gsLatOrLon / scale);
-		double minScaled = ((double)(gsLatOrLon - degScaled * scale)) / 600000.0;
-		deg = degScaled + minScaled;
-		return deg;
-	}
-
-	/**
-	 * Gets dg100Date and time as a String in GPX dg100Date-time-format (aka zulu time).
-	 * @return a dg100Date-time-string in GPX dg100Date-time-format (aka zulu time).
-	 */
-	public String getStringZuluTime()
-	{
-		return getStringDateTime("yyyy-MM-dd'T'HH:mm:ss'Z'");
-	}
-
-	/**
-	 * Gets dg100Date and time as a String in format "yyyyMMddHHmmss".
-	 * @return a dg100Date-time-string in format "yyyyMMddHHmmss".
-	 */
-	public String getStringDateTime()
-	{
-		return getStringDateTime("yyyyMMddHHmmss");
-	}
-
-	/**
-	 * Gets dg100Date and time as a String in given format.
-	 * @param dateTimeFormat
-	 * @return
-	 */
-	private String getStringDateTime(String dateTimeFormat)
-	{
-		String dateTimeString = "???";
-		if (dateTime != null)
-		{
-			SimpleDateFormat sdf = new SimpleDateFormat(dateTimeFormat);
-			//logger.info(gsTime + " " + gsDate);
-			dateTimeString = sdf.format(dateTime.getTime());
-		}
-		return dateTimeString;
-	}
-
-	/**
-	 * @return Returns the dg100Altitude.
-	 */
-	public int getDg100Altitude()
-	{
-		return dg100Altitude;
-	}
-
-	/**
-	 * @param dg100Altitude The dg100Altitude to set.
-	 */
-	private void setDg100Altitude(int altitude)
-	{
-		this.dg100Altitude = altitude;
-	}
-
-	/**
-	 * @return Returns the dg100Date.
-	 */
-	public int getDg100Date()
-	{
-		return dg100Date;
-	}
-
-	/**
-	 * @param dg100Date The dg100Date to set.
-	 */
-	private void setDg100Date(int date)
-	{
-		this.dg100Date = date;
-		calcDateTime();
-	}
-
-	/**
-	 * @return
-	 */
-	private void calcDateTime()
-	{
-		int hh = dg100TimeZ / 10000;
-		int mm = (dg100TimeZ - hh * 10000) / 100;
-		int ss = dg100TimeZ - hh * 10000 - mm * 100;
-		int DD = dg100Date / 10000;
-		int MM = (dg100Date - DD * 10000) / 100;
-		int YY = dg100Date - DD * 10000 - MM * 100;
-		dateTime = GregorianCalendar.getInstance();
-		dateTime.set(2000 + YY, MM, DD, hh, mm, ss);
-	}
-
-	/**
-	 * @return Returns the dg100Longitude.
-	 */
-	public int getDg100Longitude()
-	{
-		return dg100Longitude;
-	}
-
-	/**
-	 * @param dg100Longitude The dg100Longitude to set.
-	 */
-	private void setDg100Longitude(int longitude)
-	{
-		this.dg100Longitude = longitude;
-	}
-
-	/**
-	 * @return Returns the dg100Speed.
-	 */
-	public int getDg100Speed()
-	{
-		return dg100Speed;
-	}
-
-	/**
-	 * @param dg100Speed The dg100Speed to set.
-	 */
-	private void setDg100Speed(int speed)
-	{
-		this.dg100Speed = speed;
-	}
-
-	/**
-	 * @return Returns the dg100TimeZ.
-	 */
-	public int getDg100TimeZ()
-	{
-		return dg100TimeZ;
-	}
-
-	/**
-	 * @param dg100TimeZ The dg100TimeZ to set.
-	 */
-	private void setDg100TimeZ(int timeZ)
-	{
-		this.dg100TimeZ = timeZ;
-		calcDateTime();
-	}
-
-	/**
-	 * @param dg100Latitude The dg100Latitude to set.
-	 */
-	private void setDg100Latitude(int latitude)
-	{
-		this.dg100Latitude = latitude;
-	}
-
-	public void updateMin(GpsRec next)
-	{
-		if (next != null)
-		{
-			if (next.getDg100Latitude() < getDg100Latitude()) {setDg100Latitude(next.getDg100Latitude());}
-			if (next.getDg100Longitude() < getDg100Longitude()) {setDg100Longitude(next.getDg100Longitude());}
-			if (next.getDg100Altitude() < getDg100Altitude()) {setDg100Altitude(next.getDg100Altitude());}
-			if (next.getDg100Date() < getDg100Date()
-				|| (next.getDg100Date() == getDg100Date() && next.getDg100TimeZ() < getDg100TimeZ())
-				)
-			{
-				setDg100Date(next.getDg100Date());
-				setDg100TimeZ(next.getDg100TimeZ());
-			}
-			if (next.getDg100Speed() < getDg100Speed()) {setDg100Speed(next.getDg100Speed());}
-		}
-	}
-
-	public void updateMax(GpsRec next)
-	{
-		if (next != null)
-		{
-			if (next.getDg100Latitude() > getDg100Latitude()) {setDg100Latitude(next.getDg100Latitude());}
-			if (next.getDg100Longitude() > getDg100Longitude()) {setDg100Longitude(next.getDg100Longitude());}
-			if (next.getDg100Altitude() > getDg100Altitude()) {setDg100Altitude(next.getDg100Altitude());}
-			if (next.getDg100Date() > getDg100Date()
-				|| (next.getDg100Date() == getDg100Date() && next.getDg100TimeZ() > getDg100TimeZ())
-				)
-			{
-				setDg100Date(next.getDg100Date());
-				setDg100TimeZ(next.getDg100TimeZ());
-			}
-			if (next.getDg100Speed() > getDg100Speed()) {setDg100Speed(next.getDg100Speed());}
-		}
-	}
-
-	/**
-	 * @return Returns the dateTime.
-	 */
-	public Calendar getDateTime()
-	{
-		return dateTime;
-	}
-
-	public double getLatitude()
-	{
-		return toDegree(dg100Latitude);
-	}
-
-	public double getLongitude()
-	{
-		return toDegree(dg100Longitude);
-	}
-
-	public double getAltitude()
-	{
-		return dg100Altitude / (double)10000.0;
-	}
-
-	public double getSpeed()
-	{
-		return dg100Speed / (double)360.0;
-	}
+    private int dg100Latitude = -1;
+    private int dg100Longitude = -1;
+    private int dg100TimeZ = -1;
+    private int dg100Date = -1;
+    private int dg100Speed = -1;
+    private int dg100Altitude = -1;
+    private int dg100Unk1 = -1;
+    private int dg100TypeOfCurRec = -1;
+    private int dg100TypeOfNextRec = -1;
+    // calculated data
+    private Calendar dateTime = null;
+
+    public GpsRec()
+    {
+        dg100TypeOfNextRec = 2;
+        dg100TypeOfCurRec = 2;
+        dg100Latitude = 0;
+        dg100Longitude = 0;
+        dg100TimeZ = 0;
+        dg100Date = 0;
+        dg100Speed = 0;
+        dg100Altitude = 0;
+        dg100Unk1 = -1;
+        dateTime = null;
+    }
+
+    public void copy(GpsRec init)
+    {
+        dg100TypeOfNextRec = init.dg100TypeOfNextRec;
+        dg100TypeOfCurRec = init.dg100TypeOfCurRec;
+        dg100Latitude = init.dg100Latitude;
+        dg100Longitude = init.dg100Longitude;
+        dg100TimeZ = init.dg100TimeZ;
+        dg100Date = init.dg100Date;
+        dg100Speed = init.dg100Speed;
+        dg100Altitude = init.dg100Altitude;
+        dg100Unk1 = init.dg100Unk1;
+        dateTime = init.dateTime;
+    }
+
+    public GpsRec(GpsRec init)
+    {
+        copy(init);
+    }
+
+    /**
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object arg0)
+    {
+        boolean isEqual = false;
+        if (arg0 != null && arg0 instanceof GpsRec)
+        {
+            GpsRec otherGpsRec = (GpsRec)arg0;
+            isEqual =
+                dg100TypeOfNextRec == otherGpsRec.dg100TypeOfNextRec
+                && dg100TypeOfCurRec == otherGpsRec.dg100TypeOfCurRec
+                && dg100Latitude == otherGpsRec.dg100Latitude
+                && dg100Longitude == otherGpsRec.dg100Longitude
+                && dg100TimeZ == otherGpsRec.dg100TimeZ
+                && dg100Date == otherGpsRec.dg100Date
+                && dg100Speed == otherGpsRec.dg100Speed
+                && dg100Altitude == otherGpsRec.dg100Altitude
+                //&& dg100Unk1 == otherGpsRec.unk1
+                ;
+        }
+        return isEqual;
+    }
+
+    public GpsRec(ByteBuffer buf, int recType)
+    {
+        dg100Latitude =  buf.getInt();
+        dg100Longitude =  buf.getInt();
+        dg100TypeOfNextRec = recType;
+        dg100TypeOfCurRec = recType;
+        dateTime = null;
+        if (dg100TypeOfNextRec >= 1)
+        {
+            dg100TimeZ = buf.getInt();
+            dg100Date = buf.getInt();
+            calcDateTime();
+            dg100Speed =  buf.getInt();
+            if (dg100TypeOfNextRec >= 1)
+            {
+                dg100Altitude =  buf.getInt();
+                dg100Unk1 =  buf.getInt();
+                dg100TypeOfNextRec =  buf.getInt();
+            }
+        }
+    }
+
+    /**
+     * Shows wether this is a valid GPS record.
+     * @return true if GPS record is valid; otherwise false.
+     */
+    public boolean isValid()
+    {
+        return
+            dg100Latitude <= 360000000
+            && dg100Latitude >= 0
+            && dg100Longitude <= 360000000
+            && dg100Longitude >= 0
+            && dg100TimeZ >= 0
+            && dg100TimeZ <= 240000
+            && dg100Unk1 >= 0
+            && dg100Unk1 <= 1
+            ;
+    }
+
+    public int getDg100TypeOfNextRec()
+    {
+        return dg100TypeOfNextRec;
+    }
+
+    public int getDg100TypeOfCurRec()
+    {
+        return dg100TypeOfCurRec;
+    }
+
+    public String toString()
+    {
+        return "[GpsRec: "
+            + " Lat = " + dg100Latitude
+            + ", Long = " + dg100Longitude
+            + ", TimeZ = " + dg100TimeZ
+            + ", Date = " + dg100Date
+            + ", Speed = " + dg100Speed
+            + ", Alt = " + dg100Altitude
+            + ", Unk1 = " + dg100Unk1
+            + ", TypeOfCurRec = " + dg100TypeOfCurRec
+            + ", TypeOfNextRec = " + dg100TypeOfNextRec
+            + "]";
+    }
+
+    /**
+     * @return Returns the dg100Latitude.
+     */
+    public int getDg100Latitude()
+    {
+        return dg100Latitude;
+    }
+
+    /**
+     * Converts this object to its GPX representation.
+     * @return this object's GPX representation as a String.
+     */
+    public String toGpxTrkpt()
+    {
+//      <trkpt lat="47.6972383333" lon="11.4178650000">
+//      <ele>662.0000000000</ele>
+//      <time>2007-04-21T13:56:05Z</time>
+//      <dg100Speed>1.0833333333</dg100Speed>
+//      </trkpt>
+        StringBuffer buf = new StringBuffer(500);
+        buf.append("<trkpt");
+        buf.append(" lat=\"").append(getLatitude()).append("\"");
+        buf.append(" lon=\"").append(getLongitude()).append("\"");
+        buf.append(">");
+        if (dg100TypeOfCurRec > 0)
+        {
+            if (dg100TypeOfCurRec > 1)
+            {
+                buf.append("<ele>").append(getAltitude()).append("</ele>");
+            }
+            buf.append("<time>").append(getStringZuluTime()).append("</time>");
+            buf.append("<speed>").append(getSpeed()).append("</speed>");
+        }
+        buf.append("</trkpt>");
+        return buf.toString();
+    }
+
+    /**
+     * Converts this object to its GPX waypoint representation.
+     * @return this object's GPX representation as a String.
+     */
+    public String toGpxWpt()
+    {
+//      <wpt lat="47.6972383333" lon="11.4178650000">
+//      <ele>662.0000000000</ele>
+//      <time>2007-04-21T13:56:05Z</time>
+//      </wpt>
+        StringBuffer buf = new StringBuffer(500);
+        buf.append("<wpt");
+        buf.append(" lat=\"").append(getLatitude()).append("\"");
+        buf.append(" lon=\"").append(getLongitude()).append("\"");
+        buf.append(">");
+        if (dg100TypeOfCurRec > 0)
+        {
+            if (dg100TypeOfCurRec > 1)
+            {
+                buf.append("<ele>").append(getAltitude()).append("</ele>");
+            }
+            buf.append("<time>").append(getStringZuluTime()).append("</time>");
+        }
+        buf.append("</wpt>");
+        return buf.toString();
+    }
+
+    /**
+     * Converts GlobalSat dg100Latitude and dg100Longitude internal format to degrees.
+     * @param gsLatOrLon
+     * @return nodeg in degrees
+     */
+    private double toDegree(int gsLatOrLon)
+    {
+        int scale = 1000000;
+        double deg = 9999.9999;
+        double degScaled = (double)(gsLatOrLon / scale);
+        double minScaled = ((double)(gsLatOrLon - degScaled * scale)) / 600000.0;
+        deg = degScaled + minScaled;
+        return deg;
+    }
+
+    /**
+     * Gets dg100Date and time as a String in GPX dg100Date-time-format (aka zulu time).
+     * @return a dg100Date-time-string in GPX dg100Date-time-format (aka zulu time).
+     */
+    public String getStringZuluTime()
+    {
+        return getStringDateTime("yyyy-MM-dd'T'HH:mm:ss'Z'");
+    }
+
+    /**
+     * Gets dg100Date and time as a String in format "yyyyMMddHHmmss".
+     * @return a dg100Date-time-string in format "yyyyMMddHHmmss".
+     */
+    public String getStringDateTime()
+    {
+        return getStringDateTime("yyyyMMddHHmmss");
+    }
+
+    /**
+     * Gets dg100Date and time as a String in given format.
+     * @param dateTimeFormat
+     * @return
+     */
+    private String getStringDateTime(String dateTimeFormat)
+    {
+        String dateTimeString = "???";
+        if (dateTime != null)
+        {
+            SimpleDateFormat sdf = new SimpleDateFormat(dateTimeFormat);
+            //logger.info(gsTime + " " + gsDate);
+            dateTimeString = sdf.format(dateTime.getTime());
+        }
+        return dateTimeString;
+    }
+
+    /**
+     * @return Returns the dg100Altitude.
+     */
+    public int getDg100Altitude()
+    {
+        return dg100Altitude;
+    }
+
+    /**
+     * @param dg100Altitude The dg100Altitude to set.
+     */
+    private void setDg100Altitude(int altitude)
+    {
+        this.dg100Altitude = altitude;
+    }
+
+    /**
+     * @return Returns the dg100Date.
+     */
+    public int getDg100Date()
+    {
+        return dg100Date;
+    }
+
+    /**
+     * @param dg100Date The dg100Date to set.
+     */
+    private void setDg100Date(int date)
+    {
+        this.dg100Date = date;
+        calcDateTime();
+    }
+
+    /**
+     * @return
+     */
+    private void calcDateTime()
+    {
+        int hh = dg100TimeZ / 10000;
+        int mm = (dg100TimeZ - hh * 10000) / 100;
+        int ss = dg100TimeZ - hh * 10000 - mm * 100;
+        int DD = dg100Date / 10000;
+        int MM = (dg100Date - DD * 10000) / 100;
+        int YY = dg100Date - DD * 10000 - MM * 100;
+        dateTime = GregorianCalendar.getInstance();
+        dateTime.set(2000 + YY, MM, DD, hh, mm, ss);
+    }
+
+    /**
+     * @return Returns the dg100Longitude.
+     */
+    public int getDg100Longitude()
+    {
+        return dg100Longitude;
+    }
+
+    /**
+     * @param dg100Longitude The dg100Longitude to set.
+     */
+    private void setDg100Longitude(int longitude)
+    {
+        this.dg100Longitude = longitude;
+    }
+
+    /**
+     * @return Returns the dg100Speed.
+     */
+    public int getDg100Speed()
+    {
+        return dg100Speed;
+    }
+
+    /**
+     * @param dg100Speed The dg100Speed to set.
+     */
+    private void setDg100Speed(int speed)
+    {
+        this.dg100Speed = speed;
+    }
+
+    /**
+     * @return Returns the dg100TimeZ.
+     */
+    public int getDg100TimeZ()
+    {
+        return dg100TimeZ;
+    }
+
+    /**
+     * @param dg100TimeZ The dg100TimeZ to set.
+     */
+    private void setDg100TimeZ(int timeZ)
+    {
+        this.dg100TimeZ = timeZ;
+        calcDateTime();
+    }
+
+    /**
+     * @param dg100Latitude The dg100Latitude to set.
+     */
+    private void setDg100Latitude(int latitude)
+    {
+        this.dg100Latitude = latitude;
+    }
+
+    public void updateMin(GpsRec next)
+    {
+        if (next != null)
+        {
+            if (next.getDg100Latitude() < getDg100Latitude()) {setDg100Latitude(next.getDg100Latitude());}
+            if (next.getDg100Longitude() < getDg100Longitude()) {setDg100Longitude(next.getDg100Longitude());}
+            if (next.getDg100Altitude() < getDg100Altitude()) {setDg100Altitude(next.getDg100Altitude());}
+            if (next.getDg100Date() < getDg100Date()
+                || (next.getDg100Date() == getDg100Date() && next.getDg100TimeZ() < getDg100TimeZ())
+                )
+            {
+                setDg100Date(next.getDg100Date());
+                setDg100TimeZ(next.getDg100TimeZ());
+            }
+            if (next.getDg100Speed() < getDg100Speed()) {setDg100Speed(next.getDg100Speed());}
+        }
+    }
+
+    public void updateMax(GpsRec next)
+    {
+        if (next != null)
+        {
+            if (next.getDg100Latitude() > getDg100Latitude()) {setDg100Latitude(next.getDg100Latitude());}
+            if (next.getDg100Longitude() > getDg100Longitude()) {setDg100Longitude(next.getDg100Longitude());}
+            if (next.getDg100Altitude() > getDg100Altitude()) {setDg100Altitude(next.getDg100Altitude());}
+            if (next.getDg100Date() > getDg100Date()
+                || (next.getDg100Date() == getDg100Date() && next.getDg100TimeZ() > getDg100TimeZ())
+                )
+            {
+                setDg100Date(next.getDg100Date());
+                setDg100TimeZ(next.getDg100TimeZ());
+            }
+            if (next.getDg100Speed() > getDg100Speed()) {setDg100Speed(next.getDg100Speed());}
+        }
+    }
+
+    /**
+     * @return Returns the dateTime.
+     */
+    public Calendar getDateTime()
+    {
+        return dateTime;
+    }
+
+    public double getLatitude()
+    {
+        return toDegree(dg100Latitude);
+    }
+
+    public double getLongitude()
+    {
+        return toDegree(dg100Longitude);
+    }
+
+    public double getAltitude()
+    {
+        return dg100Altitude / (double)10000.0;
+    }
+
+    public double getSpeed()
+    {
+        return dg100Speed / (double)360.0;
+    }
 
 }
Index: /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/Response.java
===================================================================
--- /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/Response.java	(revision 12777)
+++ /applications/editors/josm/plugins/globalsat/src/org/kaintoch/gps/globalsat/dg100/Response.java	(revision 12778)
@@ -14,148 +14,148 @@
 public class Response
 {
-	final static public byte typeFileInfo = (byte)0xBB;
-	final static public byte typeId = (byte)0xBF;
-	final static public byte typeGpsRec = (byte)0xB5;
-	final static public byte typeConfig = (byte)0xB7;
+    final static public byte typeFileInfo = (byte)0xBB;
+    final static public byte typeId = (byte)0xBF;
+    final static public byte typeGpsRec = (byte)0xB5;
+    final static public byte typeConfig = (byte)0xB7;
 
-	private int typeOfResponse = 0;
-	private int cntDataCur = 0;
-	private int nextIdx = 0;
-	private Dg100Config config = null;
-	private List data = new ArrayList(100);
-	private long id = 0;
-    
-	private Response(int typeOfResponse)
-	{
-		this.typeOfResponse = typeOfResponse;
-	}
+    private int typeOfResponse = 0;
+    private int cntDataCur = 0;
+    private int nextIdx = 0;
+    private Dg100Config config = null;
+    private List data = new ArrayList(100);
+    private long id = 0;
 
-	/**
-	 *
-	 * @param resp
-	 */
-	static public Response parseResponse(byte resp[], int len)
-	{
-		ByteBuffer buf = ByteBuffer.wrap(resp);
-		byte respType = buf.get(4);
-		Response response = new Response(respType);
-		buf.position(5);
-		if (respType == typeFileInfo) // file info
-		{
-			int cntInfoCur = buf.getShort();
-			int nextIdx = buf.getShort();
-			response.cntDataCur = cntInfoCur;
-			response.nextIdx = nextIdx;
-			for (int ii = 0 ; ii < cntInfoCur ; ++ii)
-			{
-				FileInfoRec fileInfoRec = new FileInfoRec(buf);
-				response.addRec(fileInfoRec);
-			}
-		}
-		else if (respType == typeGpsRec) // gps recs
-		{
-			int recType = 2;
-			int ii = 0;
-			// read part 1
-			while (buf.position() <= len)
-			{
-				GpsRec gpsRec = new GpsRec(buf, recType);
-				if (gpsRec.isValid() && buf.position() <= len)
-				{
-					response.addRec(gpsRec);
-				}
-				else
-				{
-					break;
-				}
-				recType = gpsRec.getDg100TypeOfNextRec();
-				++ii;
-			}
-			// read part 2
-			buf.position(1042);
-			while (buf.position() <= len)
-			{
-				GpsRec gpsRec = new GpsRec(buf, recType);
-				if (gpsRec.isValid() && buf.position() <= len)
-				{
-					response.addRec(gpsRec);
-				}
-				else
-				{
-					break;
-				}
-				recType = gpsRec.getDg100TypeOfNextRec();
-				++ii;
-			}
-		}
-		else if (respType == typeConfig) // config
-		{
-			Dg100Config config = new Dg100Config(buf);
-			response.config = config;
-		}
-		else if (respType == typeId) // id
-		{
-			response.id = 0;
-			for (int ii = 0 ; ii < 8 ; ++ii)
-			{
-				int digit = (int)buf.get();
-				response.id = response.id * 10 + digit;
-			}
-		}
-		else
-		{
-		}
-		return response;
-	}
+    private Response(int typeOfResponse)
+    {
+        this.typeOfResponse = typeOfResponse;
+    }
 
-	private void addRec(Object obj)
-	{
-		data.add(obj);
-	}
+    /**
+     *
+     * @param resp
+     */
+    static public Response parseResponse(byte resp[], int len)
+    {
+        ByteBuffer buf = ByteBuffer.wrap(resp);
+        byte respType = buf.get(4);
+        Response response = new Response(respType);
+        buf.position(5);
+        if (respType == typeFileInfo) // file info
+        {
+            int cntInfoCur = buf.getShort();
+            int nextIdx = buf.getShort();
+            response.cntDataCur = cntInfoCur;
+            response.nextIdx = nextIdx;
+            for (int ii = 0 ; ii < cntInfoCur ; ++ii)
+            {
+                FileInfoRec fileInfoRec = new FileInfoRec(buf);
+                response.addRec(fileInfoRec);
+            }
+        }
+        else if (respType == typeGpsRec) // gps recs
+        {
+            int recType = 2;
+            int ii = 0;
+            // read part 1
+            while (buf.position() <= len)
+            {
+                GpsRec gpsRec = new GpsRec(buf, recType);
+                if (gpsRec.isValid() && buf.position() <= len)
+                {
+                    response.addRec(gpsRec);
+                }
+                else
+                {
+                    break;
+                }
+                recType = gpsRec.getDg100TypeOfNextRec();
+                ++ii;
+            }
+            // read part 2
+            buf.position(1042);
+            while (buf.position() <= len)
+            {
+                GpsRec gpsRec = new GpsRec(buf, recType);
+                if (gpsRec.isValid() && buf.position() <= len)
+                {
+                    response.addRec(gpsRec);
+                }
+                else
+                {
+                    break;
+                }
+                recType = gpsRec.getDg100TypeOfNextRec();
+                ++ii;
+            }
+        }
+        else if (respType == typeConfig) // config
+        {
+            Dg100Config config = new Dg100Config(buf);
+            response.config = config;
+        }
+        else if (respType == typeId) // id
+        {
+            response.id = 0;
+            for (int ii = 0 ; ii < 8 ; ++ii)
+            {
+                int digit = (int)buf.get();
+                response.id = response.id * 10 + digit;
+            }
+        }
+        else
+        {
+        }
+        return response;
+    }
 
-	public List getRecs()
-	{
-		return data;
-	}
+    private void addRec(Object obj)
+    {
+        data.add(obj);
+    }
 
-	/**
-	 * @return Returns the cntDataCur.
-	 */
-	public int getCntDataCur()
-	{
-		return cntDataCur;
-	}
+    public List getRecs()
+    {
+        return data;
+    }
 
-	/**
-	 * @return Returns the nextIdx.
-	 */
-	public int getNextIdx()
-	{
-		return nextIdx;
-	}
+    /**
+     * @return Returns the cntDataCur.
+     */
+    public int getCntDataCur()
+    {
+        return cntDataCur;
+    }
 
-	/**
-	 * @return Returns the typeOfResponse.
-	 */
-	public int getTypeOfResponse()
-	{
-		return typeOfResponse;
-	}
+    /**
+     * @return Returns the nextIdx.
+     */
+    public int getNextIdx()
+    {
+        return nextIdx;
+    }
 
-	/**
-	 * @return Returns the config.
-	 */
-	public Dg100Config getConfig()
-	{
-		return config;
-	}
+    /**
+     * @return Returns the typeOfResponse.
+     */
+    public int getTypeOfResponse()
+    {
+        return typeOfResponse;
+    }
 
-	/**
-	 * @return Returns the id.
-	 */
-	public long getId()
-	{
-		return id;
-	}
+    /**
+     * @return Returns the config.
+     */
+    public Dg100Config getConfig()
+    {
+        return config;
+    }
+
+    /**
+     * @return Returns the id.
+     */
+    public long getId()
+    {
+        return id;
+    }
 
 }
Index: /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatConfigDialog.java
===================================================================
--- /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatConfigDialog.java	(revision 12777)
+++ /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatConfigDialog.java	(revision 12778)
@@ -50,5 +50,5 @@
 /**
  * Configuration download dialog.
- * 
+ *
  * @author Raphael Mack <ramack@raphael-mack.de>
  *
@@ -58,11 +58,11 @@
 
     public class IntegerTextField extends JTextField {
-        
+
         final static String badchars = "-`~!@#$%^&*()_+=\\|\"':;?/>.<, ";
-        
+
         public void processKeyEvent(KeyEvent ev) {
 
             char c = ev.getKeyChar();
-            if((Character.isLetter(c) && !ev.isAltDown()) 
+            if((Character.isLetter(c) && !ev.isAltDown())
                || badchars.indexOf(c) > -1) {
                 ev.consume();
@@ -74,5 +74,5 @@
 
 
-	
+
     // the JOptionPane that contains this dialog. required for the closeDialog() method.
     private JOptionPane optionPane;
@@ -103,5 +103,5 @@
 
     private List<CommPortIdentifier> ports = new LinkedList<CommPortIdentifier>();
-    
+
     private Dg100Config conf;
 
@@ -132,5 +132,5 @@
         logFormat.add(formatPosTDS);
         logFormat.add(formatPosTDSA);
-        
+
         JPanel logPanel = new JPanel();
         logPanel.setLayout(new BoxLayout(logPanel, BoxLayout.PAGE_AXIS));
@@ -209,5 +209,5 @@
         minLogSpeed.setText("" + conf.getSpeedThres());
         minLogDist.setText("" + conf.getDistThres());
-        
+
         ButtonGroup group = new ButtonGroup();
         group.add(aTime);
@@ -261,9 +261,9 @@
         c.gridy = 6;
         add(bMeters, c);
-        
+
         group = new ButtonGroup();
         group.add(cTime);
         group.add(cDist);
-        
+
         c.insets = new Insets(4,4,0,4);
         c.gridwidth = 1;
@@ -307,5 +307,5 @@
             JOptionPane.showMessageDialog(Main.parent, tr("Unknown logFormat"));
         }
-            
+
         if(conf.getSwATimeOrDist() == 0){
             aTime.setSelected(true);
Index: /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatDg100.java
===================================================================
--- /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatDg100.java	(revision 12777)
+++ /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatDg100.java	(revision 12778)
@@ -45,6 +45,6 @@
 
     public static final int TIMEOUT = 2000;
-    public static final int TRACK_TYPE = 1; 
-    
+    public static final int TRACK_TYPE = 1;
+
     /** delete file: A0 A2 00 02 BC 01 00 BD B0 B3 */
     private static byte dg100CmdSwitch2Nmea[] =
@@ -111,12 +111,12 @@
       , (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
       , (byte) 0x00, (byte) 0xC0, (byte) 0xB0, (byte) 0xB3};
-    
+
     private byte[] response = new byte[65536];
-    
+
     private CommPortIdentifier portIdentifier;
     private SerialPort port = null;
 
     private boolean cancelled = false;
-    
+
     public GlobalsatDg100(CommPortIdentifier portId){
         this.portIdentifier = portId;
@@ -178,5 +178,5 @@
         return result;
     }
-    
+
     public void deleteData() throws ConnectionException{
         if(port == null){
@@ -189,5 +189,5 @@
         }
     }
-    
+
     public void disconnect(){
         if(port != null){
@@ -210,5 +210,5 @@
         }
     }
-    
+
     private List<FileInfoRec> readFileInfoList() throws ConnectionException
     {
@@ -226,10 +226,10 @@
         }
     }
- 
+
     public List<GpsRec> readGpsRecList(List<FileInfoRec> fileInfoList) throws ConnectionException
     {
         int cnt = 0;
         List<GpsRec> result = new ArrayList<GpsRec>(200);
-        
+
         try{
             for(FileInfoRec fileInfoRec:fileInfoList){
@@ -243,5 +243,5 @@
         }
     }
- 
+
     private Response sendCmdDelFiles() throws IOException, UnsupportedCommOperationException
     {
@@ -317,5 +317,5 @@
         return Response.parseResponse(response, len);
     }
-    
+
     /**
      *
@@ -348,5 +348,5 @@
     }
 
-    
+
     private int readResponse(byte[] response, int bytesToRead) throws IOException, UnsupportedCommOperationException
     {
@@ -396,5 +396,5 @@
             }
             return ((cntBytTot > bytesToRead) ? bytesToRead : cntBytTot);
-	}
+    }
         return -1;
     }
Index: /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatImportDialog.java
===================================================================
--- /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatImportDialog.java	(revision 12777)
+++ /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatImportDialog.java	(revision 12778)
@@ -39,10 +39,10 @@
 /**
  * Main download dialog.
- * 
+ *
  * @author Raphael Mack <ramack@raphael-mack.de>
  *
  */
 public class GlobalsatImportDialog extends JPanel {
-	
+
     // the JOptionPane that contains this dialog. required for the closeDialog() method.
     private JOptionPane optionPane;
@@ -111,5 +111,5 @@
                     System.out.println("configureing the device");
                     try{
-                        
+
                         GlobalsatConfigDialog dialog = new GlobalsatConfigDialog(GlobalsatPlugin.dg100().getConfig());
                         JOptionPane pane = new JOptionPane(dialog, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
@@ -136,5 +136,5 @@
         add(configBtn, c);
 
-        
+
         delete = new JCheckBox(tr("delete data after import"));
         delete.setSelected(Main.pref.getBoolean("globalsat.deleteAfterDownload", false));
@@ -167,5 +167,5 @@
 
     }
-	
+
     public boolean deleteFilesAfterDownload(){
         return delete.isSelected();
Index: /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatPlugin.java
===================================================================
--- /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatPlugin.java	(revision 12778)
@@ -106,5 +106,5 @@
         }
     }
-    
+
     class GlobalsatImportAction extends JosmAction{
         public GlobalsatImportAction(){
Index: /applications/editors/josm/plugins/grid/src/grid/GridLayer.java
===================================================================
--- /applications/editors/josm/plugins/grid/src/grid/GridLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/grid/src/grid/GridLayer.java	(revision 12778)
@@ -45,340 +45,340 @@
  */
 public class GridLayer extends Layer {
-	
-	private static Icon icon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(GridPlugin.class.getResource("/images/grid.png")));
-	private LatLon origin, pole;
-	private float gridunits;
-	private boolean drawLabels;
-	private Helmert gridtoworld; //worldtogrid;
-	private Color majcol = Color.RED;
-	public double a, b, c;
-    	public GridLayer(String url) {
-		super(url.indexOf('/') != -1 ? url.substring(url.indexOf('/')+1) : url);
-		origin = new LatLon(0.0,0.0);
-		pole = new LatLon(0.0,90.0);
-		drawLabels = true;
-		gridtoworld = new Helmert(0.0, 0.0, 0);
-		//worldtogrid = new Helmert(0.0, 0.0, 0);
-	}
-	
-    //	private void setGrid(LatLon origin, LatLon pole){
-    //	this.origin = origin;
-    //	this.pole = pole;
-		//need to check pole is perpendicular from origin;
-    //	}
-	private void setGrid(double a, double b, double c){
-		System.out.println("Setting grid to :" + a + ", " + b + ", " + c);
-		this.origin = origin;
-		this.pole = pole;
-		//need to chech pole is perpendicular from origin;
-		this.a=a;
-		this.b=b;
-		this.c=c;
-		gridtoworld = new Helmert(a, b, c);
-		System.out.println(new LatLon(10,10) + "->" + 
-				   gridtoworld.transform(new LatLon(10,10)) + "->" + 
-				   gridtoworld.inverseTransform(gridtoworld.transform(new LatLon(10,10))));
-		//worldtogrid = new Helmert(-a, -b, -c);
-	}
-
-	private void setUnits(float units){
-		gridunits = units;
-	}
-
-	private void setUnitsToLatLon(){
-		gridunits = 0;
-	}
-	
-
-	private void toggleLabels(){
-		drawLabels=!drawLabels;
-	}
-
-	private class toggleLabelsAction extends AbstractAction {
-		GridLayer layer;
-		public toggleLabelsAction(GridLayer layer) {
-			super("show labels");
-			this.layer = layer;
-		}
-		public void actionPerformed(ActionEvent e) {
-			layer.toggleLabels();
-			Main.map.repaint();
-		}
-	}
-
-	private class setWorldAction extends AbstractAction {
-		GridLayer layer;
-		public setWorldAction(GridLayer layer) {
-			super("set to world");
-			this.layer = layer;
-		}
-		public void actionPerformed(ActionEvent e) {
-			layer.setGrid(0,0,0);
-			Main.map.repaint();
-		}
-	}
-	private class incAAction extends AbstractAction {
-		GridLayer layer;
-		public incAAction(GridLayer layer) {
-			super("increase a");
-			this.layer = layer;
-		}
-		public void actionPerformed(ActionEvent e) {
-			layer.setGrid(layer.a+10,layer.b,layer.c);
-			Main.map.repaint();
-		}
-	}
-	private class incBAction extends AbstractAction {
-		GridLayer layer;
-		public incBAction(GridLayer layer) {
-			super("increase b");
-			this.layer = layer;
-		}
-		public void actionPerformed(ActionEvent e) {
-			layer.setGrid(layer.a,layer.b+10,layer.c);
-			Main.map.repaint();
-		}
-	}
-	private class incCAction extends AbstractAction {
-		GridLayer layer;
-		public incCAction(GridLayer layer) {
-			super("increase c");
-			this.layer = layer;
-		}
-		public void actionPerformed(ActionEvent e) {
-			layer.setGrid(layer.a,layer.b,layer.c+10);
-			Main.map.repaint();
-		}
-	}
-	private class setColorAction extends AbstractAction {
-		GridLayer layer;
-		public setColorAction(GridLayer layer) {
-			super("Customize Color", ImageProvider.get("colorchooser"));
-			this.layer = layer;
-		}
-		public void actionPerformed(ActionEvent e) {
-			String col=ColorHelper.color2html(layer.majcol);
-			JColorChooser c = new JColorChooser(ColorHelper.html2color(col));
-			Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("Default")};
-			int answer = JOptionPane.showOptionDialog(Main.parent, c, tr("Choose a color"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
-			switch (answer) {
-			case 0:
-//				Main.pref.put("color.layer "+name, ColorHelper.color2html(c.getColor()));
-				majcol = c.getColor();
-				break;
-			case 1:
-				return;
-			case 2:
-//				Main.pref.put("color.layer "+name, null);
-				majcol = Color.RED;
-				break;
-			}
-			Main.map.repaint();
-		}
-	}
-
-	private class setGridLayoutAction extends AbstractAction {
-		GridLayer layer;
-		public setGridLayoutAction(GridLayer layer) {
-			super("Set grid origin");
-			this.layer = layer;
-		}
-		public void actionPerformed(ActionEvent e) {
-			NumberFormat nf = NumberFormat.getInstance();
-			JPanel p = new JPanel(new GridBagLayout());
-			JTextField latText = new JTextField(nf.format(layer.a));
-			JTextField lonText = new JTextField(nf.format(layer.b));
-			JTextField devText = new JTextField(nf.format(layer.c));
-			p.add(new JLabel(tr("Grid origin location")), GBC.eol());
-			p.add(new JLabel(tr("Latitude")));
-			p.add(latText, GBC.eol());
-			p.add(new JLabel(tr("Longitude")));
-			p.add(lonText, GBC.eol());
-			p.add(new JLabel(tr("Grid rotation")));
-			p.add(devText, GBC.eol());
-			Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("World")};	
-			int answer = JOptionPane.showOptionDialog(Main.parent, p,tr("Grid layout"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
-			switch (answer) {
-			case 0:
-				layer.setGrid(
-					-Double.parseDouble(latText.getText()),
-					-Double.parseDouble(lonText.getText()),
-					Double.parseDouble(devText.getText()));
-
-			case 1:
-				return;
-			case 2:
-				layer.setGrid(0,0,0);
-			}
-			Main.map.repaint();
-		}
-	}
-
-	@Override public Icon getIcon() {
-		return icon;
-	}
-	
-	@Override public String getToolTipText() {
-		return tr("Grid layer:" + a + "," + b + "," + c);
-	}
-
-	@Override public boolean isMergable(Layer other) {
-		return false;
-	}
-
-	@Override public void mergeFrom(Layer from) {
-	}
-
-	@Override public void paint(Graphics g, final MapView mv) {
-	    //establish viewport size
-	    int w = mv.getWidth();
-	    int h = mv.getHeight();
-
-	    //establish viewport world coordinates
+
+    private static Icon icon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(GridPlugin.class.getResource("/images/grid.png")));
+    private LatLon origin, pole;
+    private float gridunits;
+    private boolean drawLabels;
+    private Helmert gridtoworld; //worldtogrid;
+    private Color majcol = Color.RED;
+    public double a, b, c;
+        public GridLayer(String url) {
+        super(url.indexOf('/') != -1 ? url.substring(url.indexOf('/')+1) : url);
+        origin = new LatLon(0.0,0.0);
+        pole = new LatLon(0.0,90.0);
+        drawLabels = true;
+        gridtoworld = new Helmert(0.0, 0.0, 0);
+        //worldtogrid = new Helmert(0.0, 0.0, 0);
+    }
+
+    //  private void setGrid(LatLon origin, LatLon pole){
+    //  this.origin = origin;
+    //  this.pole = pole;
+        //need to check pole is perpendicular from origin;
+    //  }
+    private void setGrid(double a, double b, double c){
+        System.out.println("Setting grid to :" + a + ", " + b + ", " + c);
+        this.origin = origin;
+        this.pole = pole;
+        //need to chech pole is perpendicular from origin;
+        this.a=a;
+        this.b=b;
+        this.c=c;
+        gridtoworld = new Helmert(a, b, c);
+        System.out.println(new LatLon(10,10) + "->" +
+                   gridtoworld.transform(new LatLon(10,10)) + "->" +
+                   gridtoworld.inverseTransform(gridtoworld.transform(new LatLon(10,10))));
+        //worldtogrid = new Helmert(-a, -b, -c);
+    }
+
+    private void setUnits(float units){
+        gridunits = units;
+    }
+
+    private void setUnitsToLatLon(){
+        gridunits = 0;
+    }
+
+
+    private void toggleLabels(){
+        drawLabels=!drawLabels;
+    }
+
+    private class toggleLabelsAction extends AbstractAction {
+        GridLayer layer;
+        public toggleLabelsAction(GridLayer layer) {
+            super("show labels");
+            this.layer = layer;
+        }
+        public void actionPerformed(ActionEvent e) {
+            layer.toggleLabels();
+            Main.map.repaint();
+        }
+    }
+
+    private class setWorldAction extends AbstractAction {
+        GridLayer layer;
+        public setWorldAction(GridLayer layer) {
+            super("set to world");
+            this.layer = layer;
+        }
+        public void actionPerformed(ActionEvent e) {
+            layer.setGrid(0,0,0);
+            Main.map.repaint();
+        }
+    }
+    private class incAAction extends AbstractAction {
+        GridLayer layer;
+        public incAAction(GridLayer layer) {
+            super("increase a");
+            this.layer = layer;
+        }
+        public void actionPerformed(ActionEvent e) {
+            layer.setGrid(layer.a+10,layer.b,layer.c);
+            Main.map.repaint();
+        }
+    }
+    private class incBAction extends AbstractAction {
+        GridLayer layer;
+        public incBAction(GridLayer layer) {
+            super("increase b");
+            this.layer = layer;
+        }
+        public void actionPerformed(ActionEvent e) {
+            layer.setGrid(layer.a,layer.b+10,layer.c);
+            Main.map.repaint();
+        }
+    }
+    private class incCAction extends AbstractAction {
+        GridLayer layer;
+        public incCAction(GridLayer layer) {
+            super("increase c");
+            this.layer = layer;
+        }
+        public void actionPerformed(ActionEvent e) {
+            layer.setGrid(layer.a,layer.b,layer.c+10);
+            Main.map.repaint();
+        }
+    }
+    private class setColorAction extends AbstractAction {
+        GridLayer layer;
+        public setColorAction(GridLayer layer) {
+            super("Customize Color", ImageProvider.get("colorchooser"));
+            this.layer = layer;
+        }
+        public void actionPerformed(ActionEvent e) {
+            String col=ColorHelper.color2html(layer.majcol);
+            JColorChooser c = new JColorChooser(ColorHelper.html2color(col));
+            Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("Default")};
+            int answer = JOptionPane.showOptionDialog(Main.parent, c, tr("Choose a color"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
+            switch (answer) {
+            case 0:
+//              Main.pref.put("color.layer "+name, ColorHelper.color2html(c.getColor()));
+                majcol = c.getColor();
+                break;
+            case 1:
+                return;
+            case 2:
+//              Main.pref.put("color.layer "+name, null);
+                majcol = Color.RED;
+                break;
+            }
+            Main.map.repaint();
+        }
+    }
+
+    private class setGridLayoutAction extends AbstractAction {
+        GridLayer layer;
+        public setGridLayoutAction(GridLayer layer) {
+            super("Set grid origin");
+            this.layer = layer;
+        }
+        public void actionPerformed(ActionEvent e) {
+            NumberFormat nf = NumberFormat.getInstance();
+            JPanel p = new JPanel(new GridBagLayout());
+            JTextField latText = new JTextField(nf.format(layer.a));
+            JTextField lonText = new JTextField(nf.format(layer.b));
+            JTextField devText = new JTextField(nf.format(layer.c));
+            p.add(new JLabel(tr("Grid origin location")), GBC.eol());
+            p.add(new JLabel(tr("Latitude")));
+            p.add(latText, GBC.eol());
+            p.add(new JLabel(tr("Longitude")));
+            p.add(lonText, GBC.eol());
+            p.add(new JLabel(tr("Grid rotation")));
+            p.add(devText, GBC.eol());
+            Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("World")};
+            int answer = JOptionPane.showOptionDialog(Main.parent, p,tr("Grid layout"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
+            switch (answer) {
+            case 0:
+                layer.setGrid(
+                    -Double.parseDouble(latText.getText()),
+                    -Double.parseDouble(lonText.getText()),
+                    Double.parseDouble(devText.getText()));
+
+            case 1:
+                return;
+            case 2:
+                layer.setGrid(0,0,0);
+            }
+            Main.map.repaint();
+        }
+    }
+
+    @Override public Icon getIcon() {
+        return icon;
+    }
+
+    @Override public String getToolTipText() {
+        return tr("Grid layer:" + a + "," + b + "," + c);
+    }
+
+    @Override public boolean isMergable(Layer other) {
+        return false;
+    }
+
+    @Override public void mergeFrom(Layer from) {
+    }
+
+    @Override public void paint(Graphics g, final MapView mv) {
+        //establish viewport size
+        int w = mv.getWidth();
+        int h = mv.getHeight();
+
+        //establish viewport world coordinates
             LatLon tl = mv.getLatLon(0,0);
             LatLon br = mv.getLatLon(w,h);
 
-            //establish max visible world coordinates 
+            //establish max visible world coordinates
             double wminlat = Math.max(Math.min(tl.lat(),br.lat()),-Main.proj.MAX_LAT);
             double wmaxlat = Math.min(Math.max(tl.lat(),br.lat()), Main.proj.MAX_LAT);
             double wminlon = Math.max(Math.min(tl.lon(),br.lon()),-Main.proj.MAX_LON);
             double wmaxlon = Math.min(Math.max(tl.lon(),br.lon()), Main.proj.MAX_LON);
-	    
-	    //establish viewport grid coordinates
-	    //because grid is arbitrarily orientated and may be curved check several points on border
-	    double minlat = 180, maxlat=-180, minlon=90, maxlon=-90;
-	    
-	    for(double x=0;x<=1;x+=0.2){
-		    LatLon[] p = new LatLon[] {
-			    gridtoworld.inverseTransform(new LatLon(wminlat, x*wminlon+(1-x)*wmaxlon)),
-			    gridtoworld.inverseTransform(new LatLon(wmaxlat, x*wminlon+(1-x)*wmaxlon)),
-			    gridtoworld.inverseTransform(new LatLon(x*wminlat+(1-x)*wmaxlat, wminlon)),
-			    gridtoworld.inverseTransform(new LatLon(x*wminlat+(1-x)*wmaxlat, wmaxlon))};
-		    for(int i=0;i<4;i++){
-			    maxlat=Math.max(p[i].lat(),maxlat);
-			    minlat=Math.min(p[i].lat(),minlat);
-			    maxlon=Math.max(p[i].lon(),maxlon);
-			    minlon=Math.min(p[i].lon(),minlon);
-		    }
-	    }
-	   
-	    //also check if the singularities are visible
-	    LatLon northpole = gridtoworld.transform(new LatLon(90,0));
-	    LatLon southpole = gridtoworld.transform(new LatLon(-90,0));
-	    if((northpole.lat()>=wminlat) && (northpole.lat()<=wmaxlat) && (northpole.lon()>=wminlon) && (northpole.lon()<=wmaxlon)){
-		    maxlat=90;
-		    minlon=-180; 
-		    maxlon=180;
-	    }
-	    if((southpole.lat()>=wminlat) && (southpole.lat()<=wmaxlat) && (southpole.lon()>=wminlon) && (southpole.lon()<=wmaxlon)){
-		    minlat=-90;
-		    minlon=-180; 
-		    maxlon=180;
-	    }
-
-	    //span is maximum lat/lon span across visible grid normalised to 1600pixels
-	    double latspan = (maxlat-minlat) * 1600.0/Math.max(h,w);
-	    double lonspan = (maxlon-minlon) * 1600.0/Math.max(h,w);
-
-	    //grid spacing is power of ten to use for grid interval.
-	    double latspacing = Math.pow(10,Math.floor(Math.log(latspan)/Math.log(10.0))-1.0);
-	    double lonspacing = Math.pow(10,Math.floor(Math.log(lonspan)/Math.log(10.0))-1.0);
-	    if (Math.max(latspan,lonspan)/Math.min(latspan,lonspan)<4){
-		    lonspacing = latspacing = Math.max(latspacing,lonspacing);
-	    }
-	    double latmaj = (latspacing>=10)?3:10;
-	    double lonmaj = (lonspacing>=10)?3:10;
-
-	    //set up stuff need to draw grid
-	    NumberFormat nf = NumberFormat.getInstance();
-	    Color mincol = (majcol.darker()).darker();
-
-	    g.setFont (new Font("Helvetica", Font.PLAIN, 8));
-	    FontMetrics fm = g.getFontMetrics();
-//	    g.setWidth(0);
-	    for(double lat=latspacing*Math.floor(minlat/latspacing);lat<maxlat;lat+=latspacing){
-		for(double lon=lonspacing*Math.floor(minlon/lonspacing);lon<maxlon;lon+=lonspacing){
-		    LatLon ll0, lli, llj; 
-		    ll0 = gridtoworld.transform(new LatLon(lat,lon));
-		    lli = gridtoworld.transform(new LatLon(lat+latspacing,lon));
-		    llj = gridtoworld.transform(new LatLon(lat,lon+lonspacing));
-		    Point p0=mv.getPoint(Main.proj.latlon2eastNorth(ll0));
-		    Point pi=mv.getPoint(Main.proj.latlon2eastNorth(lli));
-		    Point pj=mv.getPoint(Main.proj.latlon2eastNorth(llj));
-
-		    if(Math.round(lon/lonspacing)%lonmaj==0)
-			g.setColor(majcol);
-		    else
-			g.setColor(mincol);
-
-		    drawGridLine(g, mv, ll0, lli);
-
-
-		    if(Math.round(lat/latspacing)%latmaj==0)
-			g.setColor(majcol);
-		    else
-			g.setColor(mincol);
-
-		    drawGridLine(g, mv, ll0, llj);
-
-		    if((Math.round(lon/lonspacing))%lonmaj==0 && (Math.round(lat/latspacing))%latmaj==0 && drawLabels){
-			String label = nf.format(lat);
-			int tw = fm.stringWidth(label); 
-			g.drawString(label,p0.x-tw,p0.y-8);
-			label = nf.format(lon);
-			g.drawString(label,p0.x+2,p0.y+8);
-		    }
-		}		
-	    }
-
-	}
-
-	private void drawGridLine(Graphics g, final MapView mv, LatLon ll0, LatLon ll1){
-		Point p0=mv.getPoint(Main.proj.latlon2eastNorth(ll0));
-		Point p1=mv.getPoint(Main.proj.latlon2eastNorth(ll1));
-
-		if(Math.abs(ll0.lon()-ll1.lon())<180){
-			g.drawLine(p0.x,p0.y,p1.x,p1.y);
-		} else {
-			double lat0, lat1, lon0, lon1, latm;
-			lon0 = ll0.lon();
-			lon1 = ll1.lon();
-			if(lon0<0) lon0+=360;
-			if(lon1<0) lon1+=360;
-			latm = ll0.lat() + (180-lon0)*(ll1.lat()-ll0.lat())/(lon1-lon0);
-			Point pm1 = mv.getPoint(Main.proj.latlon2eastNorth(new LatLon(latm,180)));
-			Point pm2 = mv.getPoint(Main.proj.latlon2eastNorth(new LatLon(latm,-180)));
-			if(lon0<=180){
-				g.drawLine(p0.x,p0.y,pm1.x,pm1.y);
-				g.drawLine(p1.x,p1.y,pm2.x,pm2.y);
-			} else {
-				g.drawLine(p0.x,p0.y,pm2.x,pm2.y);
-				g.drawLine(p1.x,p1.y,pm1.x,pm1.y);
-			}
-		}
-	}
-
-	@Override public void visitBoundingBox(BoundingXYVisitor v) {
-		// doesn't have a bounding box
-	}
-
-	@Override public Object getInfoComponent() {
-		return getToolTipText();
-	}
-
-	@Override public Component[] getMenuEntries() {
-		return new Component[]{
-				new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
-				new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
-				new JMenuItem(new toggleLabelsAction(this)),
-				new JSeparator(),
-				new JMenuItem(new setGridLayoutAction(this)),
-				new JMenuItem(new setWorldAction(this)),
-				new JMenuItem(new incAAction(this)),
-				new JMenuItem(new incBAction(this)),
-				new JMenuItem(new incCAction(this)),
-				new JMenuItem(new setColorAction(this)),
-				new JSeparator(),
-				new JMenuItem(new LayerListPopup.InfoAction(this))};
-	}
+
+        //establish viewport grid coordinates
+        //because grid is arbitrarily orientated and may be curved check several points on border
+        double minlat = 180, maxlat=-180, minlon=90, maxlon=-90;
+
+        for(double x=0;x<=1;x+=0.2){
+            LatLon[] p = new LatLon[] {
+                gridtoworld.inverseTransform(new LatLon(wminlat, x*wminlon+(1-x)*wmaxlon)),
+                gridtoworld.inverseTransform(new LatLon(wmaxlat, x*wminlon+(1-x)*wmaxlon)),
+                gridtoworld.inverseTransform(new LatLon(x*wminlat+(1-x)*wmaxlat, wminlon)),
+                gridtoworld.inverseTransform(new LatLon(x*wminlat+(1-x)*wmaxlat, wmaxlon))};
+            for(int i=0;i<4;i++){
+                maxlat=Math.max(p[i].lat(),maxlat);
+                minlat=Math.min(p[i].lat(),minlat);
+                maxlon=Math.max(p[i].lon(),maxlon);
+                minlon=Math.min(p[i].lon(),minlon);
+            }
+        }
+
+        //also check if the singularities are visible
+        LatLon northpole = gridtoworld.transform(new LatLon(90,0));
+        LatLon southpole = gridtoworld.transform(new LatLon(-90,0));
+        if((northpole.lat()>=wminlat) && (northpole.lat()<=wmaxlat) && (northpole.lon()>=wminlon) && (northpole.lon()<=wmaxlon)){
+            maxlat=90;
+            minlon=-180;
+            maxlon=180;
+        }
+        if((southpole.lat()>=wminlat) && (southpole.lat()<=wmaxlat) && (southpole.lon()>=wminlon) && (southpole.lon()<=wmaxlon)){
+            minlat=-90;
+            minlon=-180;
+            maxlon=180;
+        }
+
+        //span is maximum lat/lon span across visible grid normalised to 1600pixels
+        double latspan = (maxlat-minlat) * 1600.0/Math.max(h,w);
+        double lonspan = (maxlon-minlon) * 1600.0/Math.max(h,w);
+
+        //grid spacing is power of ten to use for grid interval.
+        double latspacing = Math.pow(10,Math.floor(Math.log(latspan)/Math.log(10.0))-1.0);
+        double lonspacing = Math.pow(10,Math.floor(Math.log(lonspan)/Math.log(10.0))-1.0);
+        if (Math.max(latspan,lonspan)/Math.min(latspan,lonspan)<4){
+            lonspacing = latspacing = Math.max(latspacing,lonspacing);
+        }
+        double latmaj = (latspacing>=10)?3:10;
+        double lonmaj = (lonspacing>=10)?3:10;
+
+        //set up stuff need to draw grid
+        NumberFormat nf = NumberFormat.getInstance();
+        Color mincol = (majcol.darker()).darker();
+
+        g.setFont (new Font("Helvetica", Font.PLAIN, 8));
+        FontMetrics fm = g.getFontMetrics();
+//      g.setWidth(0);
+        for(double lat=latspacing*Math.floor(minlat/latspacing);lat<maxlat;lat+=latspacing){
+        for(double lon=lonspacing*Math.floor(minlon/lonspacing);lon<maxlon;lon+=lonspacing){
+            LatLon ll0, lli, llj;
+            ll0 = gridtoworld.transform(new LatLon(lat,lon));
+            lli = gridtoworld.transform(new LatLon(lat+latspacing,lon));
+            llj = gridtoworld.transform(new LatLon(lat,lon+lonspacing));
+            Point p0=mv.getPoint(Main.proj.latlon2eastNorth(ll0));
+            Point pi=mv.getPoint(Main.proj.latlon2eastNorth(lli));
+            Point pj=mv.getPoint(Main.proj.latlon2eastNorth(llj));
+
+            if(Math.round(lon/lonspacing)%lonmaj==0)
+            g.setColor(majcol);
+            else
+            g.setColor(mincol);
+
+            drawGridLine(g, mv, ll0, lli);
+
+
+            if(Math.round(lat/latspacing)%latmaj==0)
+            g.setColor(majcol);
+            else
+            g.setColor(mincol);
+
+            drawGridLine(g, mv, ll0, llj);
+
+            if((Math.round(lon/lonspacing))%lonmaj==0 && (Math.round(lat/latspacing))%latmaj==0 && drawLabels){
+            String label = nf.format(lat);
+            int tw = fm.stringWidth(label);
+            g.drawString(label,p0.x-tw,p0.y-8);
+            label = nf.format(lon);
+            g.drawString(label,p0.x+2,p0.y+8);
+            }
+        }
+        }
+
+    }
+
+    private void drawGridLine(Graphics g, final MapView mv, LatLon ll0, LatLon ll1){
+        Point p0=mv.getPoint(Main.proj.latlon2eastNorth(ll0));
+        Point p1=mv.getPoint(Main.proj.latlon2eastNorth(ll1));
+
+        if(Math.abs(ll0.lon()-ll1.lon())<180){
+            g.drawLine(p0.x,p0.y,p1.x,p1.y);
+        } else {
+            double lat0, lat1, lon0, lon1, latm;
+            lon0 = ll0.lon();
+            lon1 = ll1.lon();
+            if(lon0<0) lon0+=360;
+            if(lon1<0) lon1+=360;
+            latm = ll0.lat() + (180-lon0)*(ll1.lat()-ll0.lat())/(lon1-lon0);
+            Point pm1 = mv.getPoint(Main.proj.latlon2eastNorth(new LatLon(latm,180)));
+            Point pm2 = mv.getPoint(Main.proj.latlon2eastNorth(new LatLon(latm,-180)));
+            if(lon0<=180){
+                g.drawLine(p0.x,p0.y,pm1.x,pm1.y);
+                g.drawLine(p1.x,p1.y,pm2.x,pm2.y);
+            } else {
+                g.drawLine(p0.x,p0.y,pm2.x,pm2.y);
+                g.drawLine(p1.x,p1.y,pm1.x,pm1.y);
+            }
+        }
+    }
+
+    @Override public void visitBoundingBox(BoundingXYVisitor v) {
+        // doesn't have a bounding box
+    }
+
+    @Override public Object getInfoComponent() {
+        return getToolTipText();
+    }
+
+    @Override public Component[] getMenuEntries() {
+        return new Component[]{
+                new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
+                new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
+                new JMenuItem(new toggleLabelsAction(this)),
+                new JSeparator(),
+                new JMenuItem(new setGridLayoutAction(this)),
+                new JMenuItem(new setWorldAction(this)),
+                new JMenuItem(new incAAction(this)),
+                new JMenuItem(new incBAction(this)),
+                new JMenuItem(new incCAction(this)),
+                new JMenuItem(new setColorAction(this)),
+                new JSeparator(),
+                new JMenuItem(new LayerListPopup.InfoAction(this))};
+    }
 }
Index: /applications/editors/josm/plugins/grid/src/grid/GridPlugin.java
===================================================================
--- /applications/editors/josm/plugins/grid/src/grid/GridPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/grid/src/grid/GridPlugin.java	(revision 12778)
@@ -25,47 +25,47 @@
 
     private class Action extends AbstractAction {
-	public Action() {
-	    super("add grid");
-	}
-	public void actionPerformed(ActionEvent e) {
-	    GridLayer gridLayer = new GridLayer("");
-	    if (gridLayer != null)
-			Main.main.addLayer(gridLayer);
-	}
+    public Action() {
+        super("add grid");
+    }
+    public void actionPerformed(ActionEvent e) {
+        GridLayer gridLayer = new GridLayer("");
+        if (gridLayer != null)
+            Main.main.addLayer(gridLayer);
+    }
     }
     private JMenu edit;
     private JMenuItem addGridMenu = new JMenuItem(new Action());
-    
+
     public GridPlugin() {
-	JMenuBar menu = Main.main.menu;
-	edit = null;
-	for (int i = 0; i < menu.getMenuCount(); ++i) {
-	    if (menu.getMenu(i) != null && tr("Edit").equals(menu.getMenu(i).getName())) {
-		edit = menu.getMenu(i);
-		break;
-	    }
-	}
-	if (edit == null) {
-	    edit = new JMenu(tr("Edit"));
-	    menu.add(edit, 2);
-	    edit.setVisible(false);
-	}
-	edit.add(addGridMenu);
-	addGridMenu.setVisible(false);
+    JMenuBar menu = Main.main.menu;
+    edit = null;
+    for (int i = 0; i < menu.getMenuCount(); ++i) {
+        if (menu.getMenu(i) != null && tr("Edit").equals(menu.getMenu(i).getName())) {
+        edit = menu.getMenu(i);
+        break;
+        }
     }
-	@Override
-	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-		if (oldFrame != null && newFrame == null) {
-			// disable
-			addGridMenu.setVisible(false);
-			if (edit.getMenuComponentCount() == 1)
-				edit.setVisible(false);
-		} else if (oldFrame == null && newFrame != null) {
-			// enable
-			addGridMenu.setVisible(true);
-			if (edit.getMenuComponentCount() == 1)
-				edit.setVisible(true);
-		}
-	}
+    if (edit == null) {
+        edit = new JMenu(tr("Edit"));
+        menu.add(edit, 2);
+        edit.setVisible(false);
+    }
+    edit.add(addGridMenu);
+    addGridMenu.setVisible(false);
+    }
+    @Override
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+        if (oldFrame != null && newFrame == null) {
+            // disable
+            addGridMenu.setVisible(false);
+            if (edit.getMenuComponentCount() == 1)
+                edit.setVisible(false);
+        } else if (oldFrame == null && newFrame != null) {
+            // enable
+            addGridMenu.setVisible(true);
+            if (edit.getMenuComponentCount() == 1)
+                edit.setVisible(true);
+        }
+    }
 
 }
Index: /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java
===================================================================
--- /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java	(revision 12777)
+++ /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java	(revision 12778)
@@ -15,15 +15,15 @@
 public final class ImageEntries {
     private static final class ImageReadyListener implements
-	    IImageReadyListener {
-	private final ImageEntries imageEntries;
-
-	public ImageReadyListener(final ImageEntries imageEntries) {
-	    this.imageEntries = imageEntries;
-	}
-
-	public final void onImageReady(final ImageEntry imageEntry,
-	    final Image image) {
-	    this.imageEntries.setCurrentImage(imageEntry, image);
-	}
+        IImageReadyListener {
+    private final ImageEntries imageEntries;
+
+    public ImageReadyListener(final ImageEntries imageEntries) {
+        this.imageEntries = imageEntries;
+    }
+
+    public final void onImageReady(final ImageEntry imageEntry,
+        final Image image) {
+        this.imageEntries.setCurrentImage(imageEntry, image);
+    }
     }
 
@@ -39,86 +39,86 @@
 
     private ImageEntries() {
-	this.images = new ArrayList<ImageEntry>();
-	this.locatedImages = new ArrayList<ImageEntry>();
-	this.listeners = new ArrayList<IImageChangeListener>();
-	this.listener = new ImageReadyListener(this);
-
-	this.currentImageEntry = null;
-	this.currentImage = null;
+    this.images = new ArrayList<ImageEntry>();
+    this.locatedImages = new ArrayList<ImageEntry>();
+    this.listeners = new ArrayList<IImageChangeListener>();
+    this.listener = new ImageReadyListener(this);
+
+    this.currentImageEntry = null;
+    this.currentImage = null;
     }
 
     public static final ImageEntries getInstance() {
-	return ImageEntries.INSTANCE;
+    return ImageEntries.INSTANCE;
     }
 
     public final void addListener(final IImageChangeListener listener) {
-	this.listeners.add(listener);
+    this.listeners.add(listener);
     }
 
     public final void removeListener(final IImageChangeListener listener) {
-	this.listeners.remove(listener);
+    this.listeners.remove(listener);
     }
 
     public final void add(final File[] imageFiles) {
-	if (null != imageFiles) {
-	    for (int index = 0; index < imageFiles.length; index++) {
-		this.images.add(new ImageEntry(imageFiles[index]));
-	    }
-	    this.associateAllLayers();
-	}
+    if (null != imageFiles) {
+        for (int index = 0; index < imageFiles.length; index++) {
+        this.images.add(new ImageEntry(imageFiles[index]));
+        }
+        this.associateAllLayers();
+    }
     }
 
     public final void associateAllLayers() {
-	for (int index = 0; index < this.images.size(); index++) {
-	    this.images.get(index).setWayPoint(null);
-	}
-	this.locatedImages.clear();
-
-	if (null != Main.map && null != Main.map.mapView) {
-	    final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers();
-	    final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]);
-
-	    for (int index = 0; index < layers.length; index++) {
-		if (layers[index] instanceof GpxLayer
-			&& null != ((GpxLayer) layers[index]).data
-			&& !((GpxLayer) layers[index]).data.fromServer) {
-		    this.doAssociateLayer((GpxLayer) layers[index]);
-		}
-	    }
-
-	    for (IImageChangeListener listener : this.listeners) {
-		listener.onSelectedImageEntryChanged(this);
-	    }
-	}
+    for (int index = 0; index < this.images.size(); index++) {
+        this.images.get(index).setWayPoint(null);
+    }
+    this.locatedImages.clear();
+
+    if (null != Main.map && null != Main.map.mapView) {
+        final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers();
+        final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]);
+
+        for (int index = 0; index < layers.length; index++) {
+        if (layers[index] instanceof GpxLayer
+            && null != ((GpxLayer) layers[index]).data
+            && !((GpxLayer) layers[index]).data.fromServer) {
+            this.doAssociateLayer((GpxLayer) layers[index]);
+        }
+        }
+
+        for (IImageChangeListener listener : this.listeners) {
+        listener.onSelectedImageEntryChanged(this);
+        }
+    }
     }
 
     private final void doAssociateLayer(final GpxLayer gpxLayer) {
-	if (null != gpxLayer && null != gpxLayer.data
-		&& !gpxLayer.data.fromServer) {
-	    for (WayPoint wayPoint : gpxLayer.data.waypoints) {
-		final List<String> texts = this.getTextContentsFromWayPoint(wayPoint);
-
-		for (String text : texts) {
-		    final ImageEntry image = this.findImageEntryWithFileName(text);
-		    if (null != image) {
-			image.setWayPoint(wayPoint);
-			this.locatedImages.add(image);
-		    }
-		}
-	    }
-	}
+    if (null != gpxLayer && null != gpxLayer.data
+        && !gpxLayer.data.fromServer) {
+        for (WayPoint wayPoint : gpxLayer.data.waypoints) {
+        final List<String> texts = this.getTextContentsFromWayPoint(wayPoint);
+
+        for (String text : texts) {
+            final ImageEntry image = this.findImageEntryWithFileName(text);
+            if (null != image) {
+            image.setWayPoint(wayPoint);
+            this.locatedImages.add(image);
+            }
+        }
+        }
+    }
     }
 
     private final List<String> getTextContentsFromWayPoint(
-	final WayPoint wayPoint) {
-	final List<String> texts = new ArrayList<String>();
-	for(String s : new String[]{"name", "cmt", "desc"})
-	{
-		String t = wayPoint.getString(s);
-		if(null != t && 0 < t.length())
-			texts.add(t);
-	}
-
-	return texts;
+    final WayPoint wayPoint) {
+    final List<String> texts = new ArrayList<String>();
+    for(String s : new String[]{"name", "cmt", "desc"})
+    {
+        String t = wayPoint.getString(s);
+        if(null != t && 0 < t.length())
+            texts.add(t);
+    }
+
+    return texts;
     }
 
@@ -134,98 +134,98 @@
 
     private final ImageEntry findImageEntryWithFileName(final String fileName) {
-	ImageEntry foundimage = null;
-
-	for (int index = 0; index < this.images.size() && null == foundimage; index++) {
-	    final ImageEntry image = this.images.get(index);
-	    if (null == image.getWayPoint()
-		    && image.getFileName().startsWith(fileName)) {
-		foundimage = image;
-	    }
-	}
-
-	return foundimage;
+    ImageEntry foundimage = null;
+
+    for (int index = 0; index < this.images.size() && null == foundimage; index++) {
+        final ImageEntry image = this.images.get(index);
+        if (null == image.getWayPoint()
+            && image.getFileName().startsWith(fileName)) {
+        foundimage = image;
+        }
+    }
+
+    return foundimage;
     }
 
     private final void setCurrentImage(final ImageEntry imageEntry,
-	final Image image) {
-	if (imageEntry == this.currentImageEntry) {
-	    this.currentImage = image;
-	}
-
-	for (IImageChangeListener listener : this.listeners) {
-	    listener.onSelectedImageEntryChanged(this);
-	}
+    final Image image) {
+    if (imageEntry == this.currentImageEntry) {
+        this.currentImage = image;
+    }
+
+    for (IImageChangeListener listener : this.listeners) {
+        listener.onSelectedImageEntryChanged(this);
+    }
     }
 
     public final ImageEntry[] getImages() {
-	return this.locatedImages.toArray(new ImageEntry[this.locatedImages.size()]);
+    return this.locatedImages.toArray(new ImageEntry[this.locatedImages.size()]);
     }
 
     public final ImageEntry getCurrentImageEntry() {
-	return this.currentImageEntry;
+    return this.currentImageEntry;
     }
 
     public final Image getCurrentImage() {
-	return this.currentImage;
+    return this.currentImage;
     }
 
     public final boolean hasNext() {
-	return null != this.currentImageEntry
-		&& this.locatedImages.indexOf(this.currentImageEntry) < this.locatedImages.size() - 1;
+    return null != this.currentImageEntry
+        && this.locatedImages.indexOf(this.currentImageEntry) < this.locatedImages.size() - 1;
     }
 
     public final boolean hasPrevious() {
-	return null != this.currentImageEntry
-		&& this.locatedImages.indexOf(this.currentImageEntry) > 0;
+    return null != this.currentImageEntry
+        && this.locatedImages.indexOf(this.currentImageEntry) > 0;
     }
 
     public final void next() {
-	if (null != this.currentImageEntry
-		&& this.locatedImages.indexOf(this.currentImageEntry) < this.locatedImages.size() - 1) {
-	    this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) + 1));
-	}
+    if (null != this.currentImageEntry
+        && this.locatedImages.indexOf(this.currentImageEntry) < this.locatedImages.size() - 1) {
+        this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) + 1));
+    }
     }
 
     public final void previous() {
-	if (null != this.currentImageEntry
-		&& this.locatedImages.indexOf(this.currentImageEntry) > 0) {
-	    this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) - 1));
-	}
+    if (null != this.currentImageEntry
+        && this.locatedImages.indexOf(this.currentImageEntry) > 0) {
+        this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) - 1));
+    }
     }
 
     public final void rotateCurrentImageLeft() {
-	if (null != this.currentImageEntry) {
-	    this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()
-		.rotateLeft());
-	}
-
-	this.setCurrentImageEntry(this.currentImageEntry);
+    if (null != this.currentImageEntry) {
+        this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()
+        .rotateLeft());
+    }
+
+    this.setCurrentImageEntry(this.currentImageEntry);
     }
 
     public final void rotateCurrentImageRight() {
-	if (null != this.currentImageEntry) {
-	    this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()
-		.rotateRight());
-	}
-
-	this.setCurrentImageEntry(this.currentImageEntry);
+    if (null != this.currentImageEntry) {
+        this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()
+        .rotateRight());
+    }
+
+    this.setCurrentImageEntry(this.currentImageEntry);
     }
 
     public final void setCurrentImageEntry(final ImageEntry imageEntry) {
-	if (null == imageEntry || this.locatedImages.contains(imageEntry)) {
-	    if (null != this.currentImageEntry) {
-		this.currentImageEntry.flush();
-	    }
-
-	    this.currentImageEntry = imageEntry;
-	    this.currentImage = null;
-
-	    for (IImageChangeListener listener : this.listeners) {
-		listener.onSelectedImageEntryChanged(this);
-	    }
-
-	    // now try to get the image
-	    this.currentImageEntry.requestImage(this.listener);
-	}
+    if (null == imageEntry || this.locatedImages.contains(imageEntry)) {
+        if (null != this.currentImageEntry) {
+        this.currentImageEntry.flush();
+        }
+
+        this.currentImageEntry = imageEntry;
+        this.currentImage = null;
+
+        for (IImageChangeListener listener : this.listeners) {
+        listener.onSelectedImageEntryChanged(this);
+        }
+
+        // now try to get the image
+        this.currentImageEntry.requestImage(this.listener);
+    }
     }
 }
Index: /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntry.java
===================================================================
--- /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntry.java	(revision 12777)
+++ /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntry.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package org.insignificant.josm.plugins.imagewaypoint;
@@ -23,72 +23,72 @@
 public final class ImageEntry implements Comparable<ImageEntry> {
     public interface IImageReadyListener {
-	void onImageReady(ImageEntry imageEntry, Image image);
+    void onImageReady(ImageEntry imageEntry, Image image);
     }
 
     private static final class Observer implements ImageObserver {
-	private final ImageEntry imageEntry;
-
-	public Observer(final ImageEntry imageEntry) {
-	    this.imageEntry = imageEntry;
-	}
-
-	/**
-	 * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int,
-	 *      int, int, int, int)
-	 * @return true if this ImageObserver still wants to be updates about
-	 *         image loading progress
-	 */
-	public final boolean imageUpdate(final Image image,
-	    final int infoflags, final int x, final int y, final int width,
-	    final int height) {
-	    final boolean complete = ImageObserver.ALLBITS == (infoflags | ImageObserver.ALLBITS);
-	    if (complete) {
-		this.imageEntry.imageLoaded(image);
-	    }
-
-	    return !complete;
-	}
+    private final ImageEntry imageEntry;
+
+    public Observer(final ImageEntry imageEntry) {
+        this.imageEntry = imageEntry;
+    }
+
+    /**
+     * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int,
+     *      int, int, int, int)
+     * @return true if this ImageObserver still wants to be updates about
+     *         image loading progress
+     */
+    public final boolean imageUpdate(final Image image,
+        final int infoflags, final int x, final int y, final int width,
+        final int height) {
+        final boolean complete = ImageObserver.ALLBITS == (infoflags | ImageObserver.ALLBITS);
+        if (complete) {
+        this.imageEntry.imageLoaded(image);
+        }
+
+        return !complete;
+    }
     }
 
     public static final class Orientation {
-	private static final Orientation[] orientations = new Orientation[4];
-
-	public static final Orientation NORMAL = new Orientation(tr("Normal"), 0);
-	public static final Orientation ROTATE_90 = new Orientation(tr("Rotate 90"),
-	    1);
-	public static final Orientation ROTATE_180 = new Orientation(tr("Rotate 180"),
-	    2);
-	public static final Orientation ROTATE_270 = new Orientation(tr("Rotate 270"),
-	    3);
-
-	private final String name;
-	private final int index;
-
-	private Orientation(final String name, final int index) {
-	    this.name = name;
-	    this.index = index;
-	    Orientation.orientations[index] = this;
-	}
-
-	public final Orientation rotateRight() {
-	    if (this.index < Orientation.orientations.length - 1) {
-		return Orientation.orientations[this.index + 1];
-	    } else {
-		return Orientation.orientations[0];
-	    }
-	}
-
-	public final Orientation rotateLeft() {
-	    if (this.index == 0) {
-		return Orientation.orientations[Orientation.orientations.length - 1];
-	    } else {
-		return Orientation.orientations[this.index - 1];
-	    }
-	}
-
-	@Override
-	public String toString() {
-	    return "[" + this.name + "]";
-	}
+    private static final Orientation[] orientations = new Orientation[4];
+
+    public static final Orientation NORMAL = new Orientation(tr("Normal"), 0);
+    public static final Orientation ROTATE_90 = new Orientation(tr("Rotate 90"),
+        1);
+    public static final Orientation ROTATE_180 = new Orientation(tr("Rotate 180"),
+        2);
+    public static final Orientation ROTATE_270 = new Orientation(tr("Rotate 270"),
+        3);
+
+    private final String name;
+    private final int index;
+
+    private Orientation(final String name, final int index) {
+        this.name = name;
+        this.index = index;
+        Orientation.orientations[index] = this;
+    }
+
+    public final Orientation rotateRight() {
+        if (this.index < Orientation.orientations.length - 1) {
+        return Orientation.orientations[this.index + 1];
+        } else {
+        return Orientation.orientations[0];
+        }
+    }
+
+    public final Orientation rotateLeft() {
+        if (this.index == 0) {
+        return Orientation.orientations[Orientation.orientations.length - 1];
+        } else {
+        return Orientation.orientations[this.index - 1];
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "[" + this.name + "]";
+    }
     }
 
@@ -108,153 +108,153 @@
 
     public ImageEntry(final File file) {
-	this.filePath = file.getAbsolutePath();
-	this.fileName = file.getName();
-	this.observer = new Observer(this);
-
-	this.wayPoint = null;
-	this.orientation = Orientation.NORMAL;
-	this.listener = null;
-	this.normalImage = null;
-	this.rotatedImage = null;
+    this.filePath = file.getAbsolutePath();
+    this.fileName = file.getName();
+    this.observer = new Observer(this);
+
+    this.wayPoint = null;
+    this.orientation = Orientation.NORMAL;
+    this.listener = null;
+    this.normalImage = null;
+    this.rotatedImage = null;
     }
 
     public final int compareTo(final ImageEntry image) {
-	return this.fileName.compareTo(image.fileName);
+    return this.fileName.compareTo(image.fileName);
     }
 
     public final String getFileName() {
-	return fileName;
+    return fileName;
     }
 
     public final WayPoint getWayPoint() {
-	return wayPoint;
+    return wayPoint;
     }
 
     public final void setWayPoint(final WayPoint wayPoint) {
-	this.wayPoint = wayPoint;
+    this.wayPoint = wayPoint;
     }
 
     public final Orientation getOrientation() {
-	return orientation;
+    return orientation;
     }
 
     public final void setOrientation(final Orientation orientation) {
-	this.orientation = orientation;
-	this.normalImage = null;
-	this.rotatedImage = null;
+    this.orientation = orientation;
+    this.normalImage = null;
+    this.rotatedImage = null;
     }
 
     public final Rectangle getBounds(final MapView mapView) {
-	final Rectangle bounds;
-
-	if (null == this.wayPoint) {
-	    bounds = null;
-	} else {
-	    final Point point = mapView.getPoint(this.getWayPoint().eastNorth);
-	    bounds = new Rectangle(point.x - ImageEntry.ICON_WIDTH,
-		point.y - ImageEntry.ICON_HEIGHT,
-		ImageEntry.ICON_WIDTH,
-		ImageEntry.ICON_WIDTH);
-	}
-
-	return bounds;
+    final Rectangle bounds;
+
+    if (null == this.wayPoint) {
+        bounds = null;
+    } else {
+        final Point point = mapView.getPoint(this.getWayPoint().eastNorth);
+        bounds = new Rectangle(point.x - ImageEntry.ICON_WIDTH,
+        point.y - ImageEntry.ICON_HEIGHT,
+        ImageEntry.ICON_WIDTH,
+        ImageEntry.ICON_WIDTH);
+    }
+
+    return bounds;
     }
 
     public final void requestImage(final IImageReadyListener imageReadyListener) {
-	this.listener = imageReadyListener;
-
-	if (null == this.rotatedImage) {
-	    final Image image = Toolkit.getDefaultToolkit()
-		.getImage(this.filePath);
-	    if (Toolkit.getDefaultToolkit().prepareImage(image,
-		-1,
-		-1,
-		this.observer)) {
-		this.imageLoaded(image);
-	    }
-	} else if (null != this.listener) {
-	    this.listener.onImageReady(this, this.rotatedImage);
-	}
+    this.listener = imageReadyListener;
+
+    if (null == this.rotatedImage) {
+        final Image image = Toolkit.getDefaultToolkit()
+        .getImage(this.filePath);
+        if (Toolkit.getDefaultToolkit().prepareImage(image,
+        -1,
+        -1,
+        this.observer)) {
+        this.imageLoaded(image);
+        }
+    } else if (null != this.listener) {
+        this.listener.onImageReady(this, this.rotatedImage);
+    }
     }
 
     public final void flush() {
-	if (null != this.normalImage) {
-	    this.normalImage.flush();
-	    this.normalImage = null;
-	}
-
-	if (null != this.rotatedImage) {
-	    this.rotatedImage.flush();
-	    this.rotatedImage = null;
-	}
+    if (null != this.normalImage) {
+        this.normalImage.flush();
+        this.normalImage = null;
+    }
+
+    if (null != this.rotatedImage) {
+        this.rotatedImage.flush();
+        this.rotatedImage = null;
+    }
     }
 
     private final void imageLoaded(final Image image) {
-	if (Orientation.NORMAL == this.getOrientation()) {
-	    this.rotatedImage = image;
-	} else {
-	    final int[] buffer = new int[image.getWidth(null)
-		    * image.getHeight(null)];
-	    PixelGrabber grabber = new PixelGrabber(image,
-		0,
-		0,
-		image.getWidth(null),
-		image.getHeight(null),
-		buffer,
-		0,
-		image.getWidth(null));
-	    try {
-		grabber.grabPixels();
-
-		final int newHeight;
-		final int newWidth;
-
-		if (Orientation.ROTATE_180 == this.getOrientation()) {
-		    newHeight = image.getHeight(null);
-		    newWidth = image.getWidth(null);
-		} else {
-		    newHeight = image.getWidth(null);
-		    newWidth = image.getHeight(null);
-		}
-
-		final int[] destination = new int[image.getWidth(null)
-			* image.getHeight(null)];
-		for (int x = 0; x < image.getWidth(null); x++) {
-		    for (int y = 0; y < image.getHeight(null); y++) {
-			final int pix = buffer[x + (y * image.getWidth(null))];
-			final int newX;
-			final int newY;
-			if (Orientation.ROTATE_90 == this.getOrientation()) {
-			    newX = newWidth - y;
-			    newY = x;
-			} else if (Orientation.ROTATE_180 == this.getOrientation()) {
-			    newX = newWidth - x;
-			    newY = newHeight - y;
-			} else { // Orientation.ROTATE_270 ==
-			    // this.getOrientation()
-			    newX = y;
-			    newY = newHeight - x;
-			}
-			final int newIndex = newX + (newY * newWidth);
-			if (newIndex < destination.length) {
-			    destination[newIndex] = pix;
-			}
-		    }
-		}
-
-		this.rotatedImage = Toolkit.getDefaultToolkit()
-		    .createImage(new MemoryImageSource(newWidth,
-			newHeight,
-			destination,
-			0,
-			newWidth));
-	    } catch (final InterruptedException e) {
-		this.rotatedImage = null;
-	    }
-	}
-
-	if (null != this.listener) {
-	    this.listener.onImageReady(this, this.rotatedImage);
-	}
+    if (Orientation.NORMAL == this.getOrientation()) {
+        this.rotatedImage = image;
+    } else {
+        final int[] buffer = new int[image.getWidth(null)
+            * image.getHeight(null)];
+        PixelGrabber grabber = new PixelGrabber(image,
+        0,
+        0,
+        image.getWidth(null),
+        image.getHeight(null),
+        buffer,
+        0,
+        image.getWidth(null));
+        try {
+        grabber.grabPixels();
+
+        final int newHeight;
+        final int newWidth;
+
+        if (Orientation.ROTATE_180 == this.getOrientation()) {
+            newHeight = image.getHeight(null);
+            newWidth = image.getWidth(null);
+        } else {
+            newHeight = image.getWidth(null);
+            newWidth = image.getHeight(null);
+        }
+
+        final int[] destination = new int[image.getWidth(null)
+            * image.getHeight(null)];
+        for (int x = 0; x < image.getWidth(null); x++) {
+            for (int y = 0; y < image.getHeight(null); y++) {
+            final int pix = buffer[x + (y * image.getWidth(null))];
+            final int newX;
+            final int newY;
+            if (Orientation.ROTATE_90 == this.getOrientation()) {
+                newX = newWidth - y;
+                newY = x;
+            } else if (Orientation.ROTATE_180 == this.getOrientation()) {
+                newX = newWidth - x;
+                newY = newHeight - y;
+            } else { // Orientation.ROTATE_270 ==
+                // this.getOrientation()
+                newX = y;
+                newY = newHeight - x;
+            }
+            final int newIndex = newX + (newY * newWidth);
+            if (newIndex < destination.length) {
+                destination[newIndex] = pix;
+            }
+            }
+        }
+
+        this.rotatedImage = Toolkit.getDefaultToolkit()
+            .createImage(new MemoryImageSource(newWidth,
+            newHeight,
+            destination,
+            0,
+            newWidth));
+        } catch (final InterruptedException e) {
+        this.rotatedImage = null;
+        }
+    }
+
+    if (null != this.listener) {
+        this.listener.onImageReady(this, this.rotatedImage);
+    }
     }
 }
Index: /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointDialog.java
===================================================================
--- /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointDialog.java	(revision 12777)
+++ /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointDialog.java	(revision 12778)
@@ -23,153 +23,153 @@
 public final class ImageWayPointDialog {
     private static final class ImageComponent extends JComponent {
-	private static final long serialVersionUID = -5207198660736375133L;
-
-	private Image image;
-
-	public ImageComponent() {
-	    this.image = null;
-	}
-
-	@Override
-	public final void paint(final Graphics g) {
-	    if (null == this.image || 0 >= this.image.getWidth(null)
-		    || 0 >= this.image.getHeight(null)) {
-		g.setColor(Color.white);
-		g.fillRect(0, 0, this.getSize().width, this.getSize().height);
-	    } else {
-		final int maxWidth = this.getSize().width;
-		final int maxHeight = this.getSize().height;
-		final int imageWidth = this.image.getWidth(null);
-		final int imageHeight = this.image.getHeight(null);
-
-		final double aspect = 1.0 * imageWidth / imageHeight;
-
-		// what's the width if the height is 100%?
-		final int widthIfHeightIsMax = (int) (aspect * maxHeight);
-
-		// now find the real width and height
-		final int resizedWidth;
-		final int resizedHeight;
-		if (widthIfHeightIsMax > maxWidth) {
-		    // oops - burst the width - so width should be the max, and
-		    // work out the resulting height
-		    resizedWidth = maxWidth;
-		    resizedHeight = (int) (resizedWidth / aspect);
-		} else {
-		    // that'll do...
-		    resizedWidth = widthIfHeightIsMax;
-		    resizedHeight = maxHeight;
-		}
-
-		g.drawImage(this.image,
-		    (maxWidth - resizedWidth) / 2,
-		    (maxHeight - resizedHeight) / 2,
-		    resizedWidth,
-		    resizedHeight,
-		    Color.black,
-		    null);
-	    }
-	}
-
-	public final void setImage(final Image image) {
-	    this.image = image;
-	    this.repaint();
-	}
+    private static final long serialVersionUID = -5207198660736375133L;
+
+    private Image image;
+
+    public ImageComponent() {
+        this.image = null;
+    }
+
+    @Override
+    public final void paint(final Graphics g) {
+        if (null == this.image || 0 >= this.image.getWidth(null)
+            || 0 >= this.image.getHeight(null)) {
+        g.setColor(Color.white);
+        g.fillRect(0, 0, this.getSize().width, this.getSize().height);
+        } else {
+        final int maxWidth = this.getSize().width;
+        final int maxHeight = this.getSize().height;
+        final int imageWidth = this.image.getWidth(null);
+        final int imageHeight = this.image.getHeight(null);
+
+        final double aspect = 1.0 * imageWidth / imageHeight;
+
+        // what's the width if the height is 100%?
+        final int widthIfHeightIsMax = (int) (aspect * maxHeight);
+
+        // now find the real width and height
+        final int resizedWidth;
+        final int resizedHeight;
+        if (widthIfHeightIsMax > maxWidth) {
+            // oops - burst the width - so width should be the max, and
+            // work out the resulting height
+            resizedWidth = maxWidth;
+            resizedHeight = (int) (resizedWidth / aspect);
+        } else {
+            // that'll do...
+            resizedWidth = widthIfHeightIsMax;
+            resizedHeight = maxHeight;
+        }
+
+        g.drawImage(this.image,
+            (maxWidth - resizedWidth) / 2,
+            (maxHeight - resizedHeight) / 2,
+            resizedWidth,
+            resizedHeight,
+            Color.black,
+            null);
+        }
+    }
+
+    public final void setImage(final Image image) {
+        this.image = image;
+        this.repaint();
+    }
     }
 
     private static final class ImageChangeListener implements
-	    IImageChangeListener {
-	private final ImageWayPointDialog dialog;
-
-	public ImageChangeListener(final ImageWayPointDialog dialog) {
-	    this.dialog = dialog;
-	}
-
-	public final void onAvailableImageEntriesChanged(
-	    final ImageEntries entries) {
-	    this.dialog.imageDisplay.setImage(entries.getCurrentImage());
-	    this.dialog.updateUI();
-	}
-
-	public final void onSelectedImageEntryChanged(final ImageEntries entries) {
-	    this.dialog.imageDisplay.setImage(entries.getCurrentImage());
-	    this.dialog.updateUI();
-	}
+        IImageChangeListener {
+    private final ImageWayPointDialog dialog;
+
+    public ImageChangeListener(final ImageWayPointDialog dialog) {
+        this.dialog = dialog;
+    }
+
+    public final void onAvailableImageEntriesChanged(
+        final ImageEntries entries) {
+        this.dialog.imageDisplay.setImage(entries.getCurrentImage());
+        this.dialog.updateUI();
+    }
+
+    public final void onSelectedImageEntryChanged(final ImageEntries entries) {
+        this.dialog.imageDisplay.setImage(entries.getCurrentImage());
+        this.dialog.updateUI();
+    }
     }
 
     private static final class PreviousAction extends JosmAction {
-	private static final long serialVersionUID = -7899209365124237890L;
-
-	private final ImageWayPointDialog dialog;
-
-	public PreviousAction(final ImageWayPointDialog dialog) {
-	    super(tr("Previous"),
-		null,
-		tr("Previous image"),
-		null,
-		false);
-	    this.dialog = dialog;
-	}
-
-	public final void actionPerformed(final ActionEvent actionEvent) {
-	    if (ImageEntries.getInstance().hasPrevious()) {
-		ImageEntries.getInstance().previous();
-	    }
-	}
+    private static final long serialVersionUID = -7899209365124237890L;
+
+    private final ImageWayPointDialog dialog;
+
+    public PreviousAction(final ImageWayPointDialog dialog) {
+        super(tr("Previous"),
+        null,
+        tr("Previous image"),
+        null,
+        false);
+        this.dialog = dialog;
+    }
+
+    public final void actionPerformed(final ActionEvent actionEvent) {
+        if (ImageEntries.getInstance().hasPrevious()) {
+        ImageEntries.getInstance().previous();
+        }
+    }
     }
 
     private static final class NextAction extends JosmAction {
-	private static final long serialVersionUID = 176134010956760988L;
-
-	private final ImageWayPointDialog dialog;
-
-	public NextAction(final ImageWayPointDialog dialog) {
-	    super(tr("Next"), null, tr("Next image"), null, false);
-	    this.dialog = dialog;
-	}
-
-	public final void actionPerformed(final ActionEvent actionEvent) {
-	    if (ImageEntries.getInstance().hasNext()) {
-		ImageEntries.getInstance().next();
-	    }
-	}
+    private static final long serialVersionUID = 176134010956760988L;
+
+    private final ImageWayPointDialog dialog;
+
+    public NextAction(final ImageWayPointDialog dialog) {
+        super(tr("Next"), null, tr("Next image"), null, false);
+        this.dialog = dialog;
+    }
+
+    public final void actionPerformed(final ActionEvent actionEvent) {
+        if (ImageEntries.getInstance().hasNext()) {
+        ImageEntries.getInstance().next();
+        }
+    }
     }
 
     private static final class RotateLeftAction extends JosmAction {
-	private static final long serialVersionUID = 3536922796446259943L;
-
-	private final ImageWayPointDialog dialog;
-
-	public RotateLeftAction(final ImageWayPointDialog dialog) {
-	    super(tr("Rotate left"),
-		null,
-		tr("Rotate image left"),
-		null,
-		false);
-	    this.dialog = dialog;
-	}
-
-	public final void actionPerformed(final ActionEvent actionEvent) {
-	    ImageEntries.getInstance().rotateCurrentImageLeft();
-	}
+    private static final long serialVersionUID = 3536922796446259943L;
+
+    private final ImageWayPointDialog dialog;
+
+    public RotateLeftAction(final ImageWayPointDialog dialog) {
+        super(tr("Rotate left"),
+        null,
+        tr("Rotate image left"),
+        null,
+        false);
+        this.dialog = dialog;
+    }
+
+    public final void actionPerformed(final ActionEvent actionEvent) {
+        ImageEntries.getInstance().rotateCurrentImageLeft();
+    }
     }
 
     private static final class RotateRightAction extends JosmAction {
-	private static final long serialVersionUID = 1760186810341888993L;
-
-	private final ImageWayPointDialog dialog;
-
-	public RotateRightAction(final ImageWayPointDialog dialog) {
-	    super(tr("Rotate right"),
-		null,
-		tr("Rotate image right"),
-		null,
-		false);
-	    this.dialog = dialog;
-	}
-
-	public final void actionPerformed(final ActionEvent actionEvent) {
-	    ImageEntries.getInstance().rotateCurrentImageRight();
-	}
+    private static final long serialVersionUID = 1760186810341888993L;
+
+    private final ImageWayPointDialog dialog;
+
+    public RotateRightAction(final ImageWayPointDialog dialog) {
+        super(tr("Rotate right"),
+        null,
+        tr("Rotate image right"),
+        null,
+        false);
+        this.dialog = dialog;
+    }
+
+    public final void actionPerformed(final ActionEvent actionEvent) {
+        ImageEntries.getInstance().rotateCurrentImageRight();
+    }
     }
 
@@ -185,61 +185,61 @@
 
     private ImageWayPointDialog() {
-	this.dialog = new ToggleDialog(tr("WayPoint Image"),
-	    "imagewaypoint",
-	    tr("Display non-geotagged photos"),
-	    Shortcut.registerShortcut("subwindow:imagewaypoint", tr("Toggle: {0}", tr("WayPoint Image")),
-	    KeyEvent.VK_Y, Shortcut.GROUP_LAYER),
-	    200);
-
-	this.previousAction = new PreviousAction(this);
-	this.nextAction = new NextAction(this);
-	this.rotateLeftAction = new RotateLeftAction(this);
-	this.rotateRightAction = new RotateRightAction(this);
-
-	final JButton previousButton = new JButton(this.previousAction);
-	final JButton nextButton = new JButton(this.nextAction);
-	final JButton rotateLeftButton = new JButton(this.rotateLeftAction);
-	final JButton rotateRightButton = new JButton(this.rotateRightAction);
-
-	// default layout, FlowLayout, is fine
-	final JPanel buttonPanel = new JPanel();
-	buttonPanel.add(previousButton);
-	buttonPanel.add(nextButton);
-	buttonPanel.add(rotateLeftButton);
-	buttonPanel.add(rotateRightButton);
-
-	final JPanel mainPanel = new JPanel();
-	mainPanel.setLayout(new BorderLayout());
-
-	this.imageDisplay = new ImageComponent();
-	mainPanel.add(buttonPanel, BorderLayout.SOUTH);
-	mainPanel.add(this.imageDisplay, BorderLayout.CENTER);
-
-	this.listener = new ImageChangeListener(this);
-	ImageEntries.getInstance().addListener(this.listener);
-
-	this.updateUI();
-	dialog.add(mainPanel);
+    this.dialog = new ToggleDialog(tr("WayPoint Image"),
+        "imagewaypoint",
+        tr("Display non-geotagged photos"),
+        Shortcut.registerShortcut("subwindow:imagewaypoint", tr("Toggle: {0}", tr("WayPoint Image")),
+        KeyEvent.VK_Y, Shortcut.GROUP_LAYER),
+        200);
+
+    this.previousAction = new PreviousAction(this);
+    this.nextAction = new NextAction(this);
+    this.rotateLeftAction = new RotateLeftAction(this);
+    this.rotateRightAction = new RotateRightAction(this);
+
+    final JButton previousButton = new JButton(this.previousAction);
+    final JButton nextButton = new JButton(this.nextAction);
+    final JButton rotateLeftButton = new JButton(this.rotateLeftAction);
+    final JButton rotateRightButton = new JButton(this.rotateRightAction);
+
+    // default layout, FlowLayout, is fine
+    final JPanel buttonPanel = new JPanel();
+    buttonPanel.add(previousButton);
+    buttonPanel.add(nextButton);
+    buttonPanel.add(rotateLeftButton);
+    buttonPanel.add(rotateRightButton);
+
+    final JPanel mainPanel = new JPanel();
+    mainPanel.setLayout(new BorderLayout());
+
+    this.imageDisplay = new ImageComponent();
+    mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+    mainPanel.add(this.imageDisplay, BorderLayout.CENTER);
+
+    this.listener = new ImageChangeListener(this);
+    ImageEntries.getInstance().addListener(this.listener);
+
+    this.updateUI();
+    dialog.add(mainPanel);
     }
 
     private final void updateUI() {
-	this.previousAction.setEnabled(ImageEntries.getInstance().hasPrevious());
-	this.nextAction.setEnabled(ImageEntries.getInstance().hasNext());
-	this.rotateLeftAction.setEnabled(null != ImageEntries.getInstance()
-	    .getCurrentImageEntry());
-	this.rotateRightAction.setEnabled(null != ImageEntries.getInstance()
-	    .getCurrentImageEntry());
-
-	if (null != Main.map) {
-	    Main.map.repaint();
-	}
+    this.previousAction.setEnabled(ImageEntries.getInstance().hasPrevious());
+    this.nextAction.setEnabled(ImageEntries.getInstance().hasNext());
+    this.rotateLeftAction.setEnabled(null != ImageEntries.getInstance()
+        .getCurrentImageEntry());
+    this.rotateRightAction.setEnabled(null != ImageEntries.getInstance()
+        .getCurrentImageEntry());
+
+    if (null != Main.map) {
+        Main.map.repaint();
+    }
     }
 
     public static ImageWayPointDialog getInstance() {
-	return ImageWayPointDialog.INSTANCE;
+    return ImageWayPointDialog.INSTANCE;
     }
 
     public final ToggleDialog getDisplayComponent() {
-	return this.dialog;
+    return this.dialog;
     }
 }
Index: /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointLayer.java
===================================================================
--- /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointLayer.java	(revision 12778)
@@ -20,50 +20,50 @@
 public final class ImageWayPointLayer extends Layer {
     private static final class ImageWayPointMouseListener extends MouseAdapter {
-	private final ImageWayPointLayer layer;
+    private final ImageWayPointLayer layer;
 
-	public ImageWayPointMouseListener(final ImageWayPointLayer layer) {
-	    this.layer = layer;
-	}
+    public ImageWayPointMouseListener(final ImageWayPointLayer layer) {
+        this.layer = layer;
+    }
 
-	@Override
-	public final void mouseClicked(final MouseEvent event) {
-	    if (MouseEvent.BUTTON1 == event.getButton() && this.layer.visible) {
-		final ImageEntry[] images = ImageEntries.getInstance()
-		    .getImages();
+    @Override
+    public final void mouseClicked(final MouseEvent event) {
+        if (MouseEvent.BUTTON1 == event.getButton() && this.layer.visible) {
+        final ImageEntry[] images = ImageEntries.getInstance()
+            .getImages();
 
-		if (null != images) {
-		    boolean found = false;
-		    // Note: the images are checked in the *reverse* order to
-		    // which they're painted - this means than an image which
-		    // partly obscures another will match the click first
-		    for (int index = images.length - 1; !found && index >= 0; index--) {
-			final Rectangle bounds = images[index].getBounds(Main.map.mapView);
-			if (null != bounds && bounds.contains(event.getPoint())) {
-			    found = true;
-			    ImageEntries.getInstance()
-				.setCurrentImageEntry(images[index]);
-			}
-		    }
-		}
-	    }
-	}
+        if (null != images) {
+            boolean found = false;
+            // Note: the images are checked in the *reverse* order to
+            // which they're painted - this means than an image which
+            // partly obscures another will match the click first
+            for (int index = images.length - 1; !found && index >= 0; index--) {
+            final Rectangle bounds = images[index].getBounds(Main.map.mapView);
+            if (null != bounds && bounds.contains(event.getPoint())) {
+                found = true;
+                ImageEntries.getInstance()
+                .setCurrentImageEntry(images[index]);
+            }
+            }
+        }
+        }
+    }
     }
 
     private static final class ImageChangeListener implements
-	    IImageChangeListener {
-	private final ImageWayPointLayer layer;
+        IImageChangeListener {
+    private final ImageWayPointLayer layer;
 
-	public ImageChangeListener(final ImageWayPointLayer layer) {
-	    this.layer = layer;
-	}
+    public ImageChangeListener(final ImageWayPointLayer layer) {
+        this.layer = layer;
+    }
 
-	public final void onAvailableImageEntriesChanged(
-	    final ImageEntries entries) {
-	    Main.map.repaint();
-	}
+    public final void onAvailableImageEntriesChanged(
+        final ImageEntries entries) {
+        Main.map.repaint();
+    }
 
-	public final void onSelectedImageEntryChanged(final ImageEntries entries) {
-	    Main.map.repaint();
-	}
+    public final void onSelectedImageEntryChanged(final ImageEntries entries) {
+        Main.map.repaint();
+    }
     }
 
@@ -72,96 +72,96 @@
 
     public ImageWayPointLayer() {
-	super(tr("Imported Images"));
+    super(tr("Imported Images"));
 
-	Main.main.addLayer(this);
+    Main.main.addLayer(this);
 
-	this.layerMouseListener = new ImageWayPointMouseListener(this);
-	Main.map.mapView.addMouseListener(this.layerMouseListener);
+    this.layerMouseListener = new ImageWayPointMouseListener(this);
+    Main.map.mapView.addMouseListener(this.layerMouseListener);
 
-	this.imageChangeListener = new ImageChangeListener(this);
-	ImageEntries.getInstance().addListener(this.imageChangeListener);
+    this.imageChangeListener = new ImageChangeListener(this);
+    ImageEntries.getInstance().addListener(this.imageChangeListener);
     }
 
     @Override
     public final Icon getIcon() {
-	return ImageProvider.get("dialogs/imagewaypoint");
+    return ImageProvider.get("dialogs/imagewaypoint");
     }
 
     @Override
     public final Object getInfoComponent() {
-	return null;
+    return null;
     }
 
     @Override
     public final Component[] getMenuEntries() {
-	return new Component[0];
+    return new Component[0];
     }
 
     @Override
     public final String getToolTipText() {
-	// TODO
-	return "";
+    // TODO
+    return "";
     }
 
     @Override
     public final boolean isMergable(final Layer other) {
-	// TODO
-	return false;
+    // TODO
+    return false;
     }
 
     @Override
     public final void mergeFrom(final Layer from) {
-	// TODO not supported yet
+    // TODO not supported yet
     }
 
     @Override
     public final void paint(final Graphics graphics, final MapView mapView) {
-	final ImageEntry[] images = ImageEntries.getInstance().getImages();
+    final ImageEntry[] images = ImageEntries.getInstance().getImages();
 
-	if (null != images) {
-	    final ImageEntry currentImage = ImageEntries.getInstance()
-		.getCurrentImageEntry();
+    if (null != images) {
+        final ImageEntry currentImage = ImageEntries.getInstance()
+        .getCurrentImageEntry();
 
-	    for (int index = 0; index < images.length; index++) {
-		final Rectangle bounds = images[index].getBounds(mapView);
-		if (null != bounds) {
-		    if (images[index] == currentImage) {
-			ImageEntry.SELECTED_ICON.paintIcon(mapView,
-			    graphics,
-			    bounds.x,
-			    bounds.y);
-		    } else {
-			ImageEntry.ICON.paintIcon(mapView,
-			    graphics,
-			    bounds.x,
-			    bounds.y);
-		    }
-		}
-	    }
-	}
+        for (int index = 0; index < images.length; index++) {
+        final Rectangle bounds = images[index].getBounds(mapView);
+        if (null != bounds) {
+            if (images[index] == currentImage) {
+            ImageEntry.SELECTED_ICON.paintIcon(mapView,
+                graphics,
+                bounds.x,
+                bounds.y);
+            } else {
+            ImageEntry.ICON.paintIcon(mapView,
+                graphics,
+                bounds.x,
+                bounds.y);
+            }
+        }
+        }
+    }
     }
 
     @Override
     public final void visitBoundingBox(final BoundingXYVisitor visitor) {
-	final ImageEntry[] images = ImageEntries.getInstance().getImages();
+    final ImageEntry[] images = ImageEntries.getInstance().getImages();
 
-	if (null != images) {
-	    for (int index = 0; index < images.length; index++) {
-		final ImageEntry imageEntry = images[index];
+    if (null != images) {
+        for (int index = 0; index < images.length; index++) {
+        final ImageEntry imageEntry = images[index];
 
-		if (null != imageEntry.getWayPoint()
-			&& null != imageEntry.getWayPoint().eastNorth) {
-		    visitor.visit(imageEntry.getWayPoint().eastNorth);
-		}
-	    }
-	}
+        if (null != imageEntry.getWayPoint()
+            && null != imageEntry.getWayPoint().eastNorth) {
+            visitor.visit(imageEntry.getWayPoint().eastNorth);
+        }
+        }
+    }
     }
 
     @Override
     public final void destroy() {
-	super.destroy();
+    super.destroy();
 
-	Main.map.mapView.removeMouseListener(this.layerMouseListener);
-	ImageEntries.getInstance().removeListener(this.imageChangeListener);
+    Main.map.mapView.removeMouseListener(this.layerMouseListener);
+    ImageEntries.getInstance().removeListener(this.imageChangeListener);
     }
 }
Index: /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java
===================================================================
--- /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java	(revision 12778)
@@ -24,72 +24,72 @@
 public final class ImageWayPointPlugin extends org.openstreetmap.josm.plugins.Plugin {
     private static final class ImageFileFilter extends FileFilter {
-	@Override
-	public final boolean accept(final File file) {
-	    return file.isDirectory()
-		    || file.getName().toLowerCase().endsWith(".jpg")
-		    || file.getName().toLowerCase().endsWith(".jpeg")
-		    || file.getName().toLowerCase().endsWith(".png")
-		    || file.getName().toLowerCase().endsWith(".gif");
-	}
+    @Override
+    public final boolean accept(final File file) {
+        return file.isDirectory()
+            || file.getName().toLowerCase().endsWith(".jpg")
+            || file.getName().toLowerCase().endsWith(".jpeg")
+            || file.getName().toLowerCase().endsWith(".png")
+            || file.getName().toLowerCase().endsWith(".gif");
+    }
 
-	@Override
-	public final String getDescription() {
-	    return tr("Image files (*.jpg, *.jpeg, *.png, *.gif)");
-	}
+    @Override
+    public final String getDescription() {
+        return tr("Image files (*.jpg, *.jpeg, *.png, *.gif)");
+    }
     }
 
     private static final class LoadImagesAction extends JosmAction {
-	private static final long serialVersionUID = 4480306223276347301L;
+    private static final long serialVersionUID = 4480306223276347301L;
 
-	private final ImageWayPointPlugin plugin;
+    private final ImageWayPointPlugin plugin;
 
-	public LoadImagesAction(final ImageWayPointPlugin plugin) {
-	    super(tr("Open images with ImageWayPoint"),
-		"imagewaypoint-open",
-		tr("Load set of images as a new layer."),
-		null,
-		false);
+    public LoadImagesAction(final ImageWayPointPlugin plugin) {
+        super(tr("Open images with ImageWayPoint"),
+        "imagewaypoint-open",
+        tr("Load set of images as a new layer."),
+        null,
+        false);
 
-	    this.plugin = plugin;
-	}
+        this.plugin = plugin;
+    }
 
-	public final void actionPerformed(final ActionEvent actionEvent) {
-	    final JFileChooser fileChooser = new JFileChooser(Main.pref.get("tagimages.lastdirectory"));
-	    fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
-	    fileChooser.setMultiSelectionEnabled(true);
-	    fileChooser.setAcceptAllFileFilterUsed(false);
-	    fileChooser.setFileFilter(new ImageFileFilter());
+    public final void actionPerformed(final ActionEvent actionEvent) {
+        final JFileChooser fileChooser = new JFileChooser(Main.pref.get("tagimages.lastdirectory"));
+        fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
+        fileChooser.setMultiSelectionEnabled(true);
+        fileChooser.setAcceptAllFileFilterUsed(false);
+        fileChooser.setFileFilter(new ImageFileFilter());
 
-	    fileChooser.showOpenDialog(Main.parent);
+        fileChooser.showOpenDialog(Main.parent);
 
-	    final File[] selectedFiles = fileChooser.getSelectedFiles();
-	    if (null != selectedFiles && 0 != selectedFiles.length) {
-		Main.pref.put("tagimages.lastdirectory",
-		    fileChooser.getCurrentDirectory().getPath());
+        final File[] selectedFiles = fileChooser.getSelectedFiles();
+        if (null != selectedFiles && 0 != selectedFiles.length) {
+        Main.pref.put("tagimages.lastdirectory",
+            fileChooser.getCurrentDirectory().getPath());
 
-		// recursively find all files
-		final List<File> allFiles = new ArrayList<File>();
-		this.plugin.addFiles(allFiles, selectedFiles);
+        // recursively find all files
+        final List<File> allFiles = new ArrayList<File>();
+        this.plugin.addFiles(allFiles, selectedFiles);
 
-		// add files to ImageEntries
-		ImageEntries.getInstance()
-		    .add(allFiles.toArray(new File[allFiles.size()]));
+        // add files to ImageEntries
+        ImageEntries.getInstance()
+            .add(allFiles.toArray(new File[allFiles.size()]));
 
-		// check to see whether there's already an ImageWayPointLayer
-		boolean foundImageWayPointLayer = false;
-		if (null != Main.map && null != Main.map.mapView) {
-		    final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers();
-		    final Iterator<Layer> layerIterator = layerCollection.iterator();
-		    while (layerIterator.hasNext() && !foundImageWayPointLayer) {
-			if (layerIterator.next() instanceof ImageWayPointLayer) {
-			    foundImageWayPointLayer = true;
-			}
-		    }
-		}
-		if (!foundImageWayPointLayer) {
-		    new ImageWayPointLayer();
-		}
-	    }
-	}
+        // check to see whether there's already an ImageWayPointLayer
+        boolean foundImageWayPointLayer = false;
+        if (null != Main.map && null != Main.map.mapView) {
+            final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers();
+            final Iterator<Layer> layerIterator = layerCollection.iterator();
+            while (layerIterator.hasNext() && !foundImageWayPointLayer) {
+            if (layerIterator.next() instanceof ImageWayPointLayer) {
+                foundImageWayPointLayer = true;
+            }
+            }
+        }
+        if (!foundImageWayPointLayer) {
+            new ImageWayPointLayer();
+        }
+        }
+    }
     }
 
@@ -98,44 +98,44 @@
      */
     public ImageWayPointPlugin() {
-	// find the File menu
-	final JMenuBar menuBar = Main.main.menu;
-	JMenu fileMenu = null;
+    // find the File menu
+    final JMenuBar menuBar = Main.main.menu;
+    JMenu fileMenu = null;
 
-	if (null != menuBar) {
-	    for (int index = 0; index < menuBar.getMenuCount()
-		    && null == fileMenu; index++) {
-		if (I18n.tr("File").equals(menuBar.getMenu(index).getText())) {
-		    fileMenu = menuBar.getMenu(index);
-		}
-	    }
-	}
+    if (null != menuBar) {
+        for (int index = 0; index < menuBar.getMenuCount()
+            && null == fileMenu; index++) {
+        if (I18n.tr("File").equals(menuBar.getMenu(index).getText())) {
+            fileMenu = menuBar.getMenu(index);
+        }
+        }
+    }
 
-	if (null != fileMenu) {
-	    // now create our 'load' menu item and add to the file menu
-	    final JMenuItem menuItem = new JMenuItem(new LoadImagesAction(this));
-	    fileMenu.add(menuItem, 2);
-	}
+    if (null != fileMenu) {
+        // now create our 'load' menu item and add to the file menu
+        final JMenuItem menuItem = new JMenuItem(new LoadImagesAction(this));
+        fileMenu.add(menuItem, 2);
+    }
     }
 
     @Override
     public final void mapFrameInitialized(final MapFrame oldFrame,
-	final MapFrame newFrame) {
-	if (newFrame != null) {
-	    newFrame.addToggleDialog(ImageWayPointDialog.getInstance()
-		.getDisplayComponent());
-	} else {
-	    ImageEntries.getInstance().setCurrentImageEntry(null);
-	}
+    final MapFrame newFrame) {
+    if (newFrame != null) {
+        newFrame.addToggleDialog(ImageWayPointDialog.getInstance()
+        .getDisplayComponent());
+    } else {
+        ImageEntries.getInstance().setCurrentImageEntry(null);
+    }
     }
 
     private void addFiles(List<File> allFiles, File[] selectedFiles) {
-	for (int index = 0; index < selectedFiles.length; index++) {
-	    final File selectedFile = selectedFiles[index];
-	    if (selectedFile.isDirectory()) {
-		this.addFiles(allFiles, selectedFile.listFiles());
-	    } else if (selectedFile.getName().toLowerCase().endsWith(".jpg")) {
-		allFiles.add(selectedFile);
-	    }
-	}
+    for (int index = 0; index < selectedFiles.length; index++) {
+        final File selectedFile = selectedFiles[index];
+        if (selectedFile.isDirectory()) {
+        this.addFiles(allFiles, selectedFile.listFiles());
+        } else if (selectedFile.getName().toLowerCase().endsWith(".jpg")) {
+        allFiles.add(selectedFile);
+        }
+    }
     }
 }
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java	(revision 12777)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java	(revision 12778)
@@ -16,461 +16,461 @@
 
 public class Lakewalker {
-	protected Collection<Command> commands = new LinkedList<Command>();
-	protected Collection<Way> ways = new ArrayList<Way>();
-	protected boolean cancel;
-	  
-	private int waylen;
-	private int maxnode;
-	private int threshold;
-	private double epsilon;
-	private int resolution;
-	private int tilesize;
-	private String startdir;
-	private String wmslayer;
-	
-	private File workingdir;
-	
-	private int[] dirslat = new int[] {0,1,1,1,0,-1,-1,-1};
-	private int[] dirslon = new int[] {1,1,0,-1,-1,-1,0,1};
-	
-	double start_radius_big = 0.001;
-	double start_radius_small = 0.0002;
-	
-	public Lakewalker(int waylen, int maxnode, int threshold, double epsilon, int resolution, int tilesize, String startdir, String wmslayer, File workingdir){
-		this.waylen = waylen;
-		this.maxnode = maxnode;
-		this.threshold = threshold;
-		this.epsilon = epsilon;
-		this.resolution = resolution;
-		this.tilesize = tilesize;
-		this.startdir = startdir;
-		this.wmslayer = wmslayer;
-		
-		this.workingdir = workingdir;			
-	}
-	
-	/**
-	 *  east = 0
-	 *  northeast = 1
-	 *  north = 2
-	 *  northwest = 3
-	 *  west = 4
-	 *  southwest = 5
-	 *  south = 6
-	 *  southeast = 7  
-	 */
-	private int getDirectionIndex(String direction) throws ArrayIndexOutOfBoundsException{
-		int i=0;
-		if(direction.equals("East") || direction.equals("east")){
-			i = 0;
-		} else if(direction.equals("Northeast") || direction.equals("northeast")){
-			i =  1;
-		} else if(direction.equals("North") || direction.equals("north")){
-			i =  2;
-		} else if(direction.equals("Northwest") || direction.equals("northwest")){
-			i =  3;
-		} else if(direction.equals("West") || direction.equals("west")){
-			i =  4;
-		} else if(direction.equals("Southwest") || direction.equals("southwest")){
-			i =  5;
-		} else if(direction.equals("South") || direction.equals("south")){
-			i =  6;
-		} else if(direction.equals("Southeast") || direction.equals("southeast")){
-			i =  7;
-		} else {
-			throw new ArrayIndexOutOfBoundsException(tr("Direction index '{0}' not found",direction));
-		}
-		return i;
-	}
-	
-	/**
-	 * Do a trace
-	 * 
-	 * @param lat
-	 * @param lon
-	 * @param tl_lon
-	 * @param br_lon
-	 * @param tl_lat
-	 * @param br_lat
-	 */
-	public ArrayList<double[]> trace(double lat, double lon, double tl_lon, double br_lon, double tl_lat, double br_lat) throws LakewalkerException {
-				
-		LakewalkerWMS wms = new LakewalkerWMS(this.resolution, this.tilesize, this.wmslayer, this.workingdir);
-		LakewalkerBBox bbox = new LakewalkerBBox(tl_lat,tl_lon,br_lat,br_lon);
-		
-		Boolean detect_loop = false;
-		
-		ArrayList<double[]> nodelist = new ArrayList<double[]>();
-
-		int[] xy = geo_to_xy(lat,lon,this.resolution); 
-		
-		if(!bbox.contains(lat, lon)){
-			throw new LakewalkerException(tr("The starting location was not within the bbox"));
-		}
-		
-		int v;
-		
-		setStatus(tr("Looking for shoreline..."));
-		
-		while(true){
-			double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
-			if(bbox.contains(geo[0],geo[1])==false){
-				break;
-			}
-			
-			v = wms.getPixel(xy[0], xy[1]);
-			if(v > this.threshold){
-				break;
-			}
-			
-			int delta_lat = this.dirslat[getDirectionIndex(this.startdir)];
-			int delta_lon = this.dirslon[getDirectionIndex(this.startdir)];
-			
-			xy[0] = xy[0]+delta_lon;
-			xy[1] = xy[1]+delta_lat;
-			
-		}
-		
-		int[] startxy = new int[] {xy[0], xy[1]};
-		double[] startgeo = xy_to_geo(xy[0],xy[1],this.resolution);
-
-		//System.out.printf("Found shore at lat %.4f lon %.4f\n",lat,lon);
-		
-		int last_dir = this.getDirectionIndex(this.startdir);
-		
-		for(int i = 0; i < this.maxnode; i++){
-			
-			// Print a counter
-			if(i % 250 == 0){
-				setStatus(tr("{0} nodes so far...",i));
-				//System.out.println(i+" nodes so far...");
-			}
-			
-			// Some variables we need
-			int d;
-			int test_x=0;
-			int test_y=0;
-			int new_dir = 0;
-			
-			// Loop through all the directions we can go
-			for(d = 1; d <= this.dirslat.length; d++){
-				
-				// Decide which direction we want to look at from this pixel
-				new_dir = (last_dir + d + 4) % 8;
-
-				test_x = xy[0] + this.dirslon[new_dir];
-				test_y = xy[1] + this.dirslat[new_dir];
-				
-				double[] geo = xy_to_geo(test_x,test_y,this.resolution);
-				
-				if(!bbox.contains(geo[0], geo[1])){
-					System.out.println("Outside bbox");
-					break;
-				}
-				
-				v = wms.getPixel(test_x, test_y);
-				if(v > this.threshold){
-					break;
-				}
-				
-				if(d == this.dirslat.length-1){
-					System.out.println("Got stuck");
-					break;
-				}
-			}
-
-			// Remember this direction
-			last_dir = new_dir;
-			
-			// Set the pixel we found as current
-			xy[0] = test_x;
-			xy[1] = test_y;
-			
-			// Break the loop if we managed to get back to our starting point
-			if(xy[0] == startxy[0] && xy[1] == startxy[1]){
-				break;
-			}
-			
-			// Store this node
-			double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
-			nodelist.add(geo);
-			//System.out.println("Adding node at "+xy[0]+","+xy[1]+" ("+geo[1]+","+geo[0]+")");
-			
-			// Check if we got stuck in a loop 
-	        double start_proximity = Math.pow((geo[0] - startgeo[0]),2) + Math.pow((geo[1] - startgeo[1]),2);
-	        
-			if(detect_loop){
-	            if(start_proximity < Math.pow(start_radius_small,2)){
-	            	System.out.println("Detected loop");
-	                break;
-	            }
-			}else{
-	            if(start_proximity > Math.pow(start_radius_big,2)){
-	                detect_loop = true;
-	            }
-			}			
-		}
-
-		return nodelist;
-	}
-	
-	/**
-	 * Remove duplicate nodes from the list
-	 * 
-	 * @param nodes
-	 * @return
-	 */
-	public ArrayList<double[]> duplicateNodeRemove(ArrayList<double[]> nodes){
-		
-		if(nodes.size() <= 1){
-			return nodes;
-		}
-		
-		double lastnode[] = new double[] {nodes.get(0)[0], nodes.get(0)[1]};
-		
-		for(int i = 1; i < nodes.size(); i++){
-			double[] thisnode = new double[] {nodes.get(i)[0], nodes.get(i)[1]};
-			
-			if(thisnode[0] == lastnode[0] && thisnode[1] == lastnode[1]){
-				// Remove the node
-				nodes.remove(i);
-				
-				// Shift back one index 
-				i = i - 1;
-			}
-			lastnode = thisnode;
-		}
-		
-		return nodes;
-	}
-	
-	/**
-	 * Reduce the number of vertices based on their proximity to each other 
-	 * 
-	 * @param nodes
-	 * @param proximity
-	 * @return
-	 */
-	public ArrayList<double[]> vertexReduce(ArrayList<double[]> nodes, double proximity){
-		
-		// Check if node list is empty
-		if(nodes.size()<=1){
-			return nodes;
-		}
-		
-		double[] test_v = nodes.get(0);
-		ArrayList<double[]> reducednodes = new ArrayList<double[]>();
-		
-		double prox_sq = Math.pow(proximity, 2);
-		
-		for(int v = 0; v < nodes.size(); v++){
-			if(Math.pow(nodes.get(v)[0] - test_v[0],2) + Math.pow(nodes.get(v)[1] - test_v[1],2) > prox_sq){
-				reducednodes.add(nodes.get(v));
-				test_v = nodes.get(v);
-			}
-		}
-		
-		return reducednodes;
-	}
-	
-	public double pointLineDistance(double[] p1, double[] p2, double[] p3){
-		
-		double x0 = p1[0]; 
-		double y0 = p1[1];
-		double x1 = p2[0]; 
-		double y1 = p2[1]; 
-		double x2 = p3[0]; 
-		double y2 = p3[1];
-		
-		if(x2 == x1 && y2 == y1){
-			return Math.sqrt(Math.pow(x1-x0,2) + Math.pow(y1-y0,2));
-		} else {
-			return Math.abs((x2-x1)*(y1-y0) - (x1-x0)*(y2-y1)) / Math.sqrt(Math.pow(x2-x1,2) + Math.pow(y2-y1,2));
-		}
-	}
-	
-	public ArrayList<double[]> douglasPeuckerNR(ArrayList<double[]> nodes, double epsilon){
-		/*
-		command_stack = [(0, len(nodes) - 1)]
-		                 
-		Vector result_stack = new Vector();
+    protected Collection<Command> commands = new LinkedList<Command>();
+    protected Collection<Way> ways = new ArrayList<Way>();
+    protected boolean cancel;
+
+    private int waylen;
+    private int maxnode;
+    private int threshold;
+    private double epsilon;
+    private int resolution;
+    private int tilesize;
+    private String startdir;
+    private String wmslayer;
+
+    private File workingdir;
+
+    private int[] dirslat = new int[] {0,1,1,1,0,-1,-1,-1};
+    private int[] dirslon = new int[] {1,1,0,-1,-1,-1,0,1};
+
+    double start_radius_big = 0.001;
+    double start_radius_small = 0.0002;
+
+    public Lakewalker(int waylen, int maxnode, int threshold, double epsilon, int resolution, int tilesize, String startdir, String wmslayer, File workingdir){
+        this.waylen = waylen;
+        this.maxnode = maxnode;
+        this.threshold = threshold;
+        this.epsilon = epsilon;
+        this.resolution = resolution;
+        this.tilesize = tilesize;
+        this.startdir = startdir;
+        this.wmslayer = wmslayer;
+
+        this.workingdir = workingdir;
+    }
+
+    /**
+     *  east = 0
+     *  northeast = 1
+     *  north = 2
+     *  northwest = 3
+     *  west = 4
+     *  southwest = 5
+     *  south = 6
+     *  southeast = 7
+     */
+    private int getDirectionIndex(String direction) throws ArrayIndexOutOfBoundsException{
+        int i=0;
+        if(direction.equals("East") || direction.equals("east")){
+            i = 0;
+        } else if(direction.equals("Northeast") || direction.equals("northeast")){
+            i =  1;
+        } else if(direction.equals("North") || direction.equals("north")){
+            i =  2;
+        } else if(direction.equals("Northwest") || direction.equals("northwest")){
+            i =  3;
+        } else if(direction.equals("West") || direction.equals("west")){
+            i =  4;
+        } else if(direction.equals("Southwest") || direction.equals("southwest")){
+            i =  5;
+        } else if(direction.equals("South") || direction.equals("south")){
+            i =  6;
+        } else if(direction.equals("Southeast") || direction.equals("southeast")){
+            i =  7;
+        } else {
+            throw new ArrayIndexOutOfBoundsException(tr("Direction index '{0}' not found",direction));
+        }
+        return i;
+    }
+
+    /**
+     * Do a trace
+     *
+     * @param lat
+     * @param lon
+     * @param tl_lon
+     * @param br_lon
+     * @param tl_lat
+     * @param br_lat
+     */
+    public ArrayList<double[]> trace(double lat, double lon, double tl_lon, double br_lon, double tl_lat, double br_lat) throws LakewalkerException {
+
+        LakewalkerWMS wms = new LakewalkerWMS(this.resolution, this.tilesize, this.wmslayer, this.workingdir);
+        LakewalkerBBox bbox = new LakewalkerBBox(tl_lat,tl_lon,br_lat,br_lon);
+
+        Boolean detect_loop = false;
+
+        ArrayList<double[]> nodelist = new ArrayList<double[]>();
+
+        int[] xy = geo_to_xy(lat,lon,this.resolution);
+
+        if(!bbox.contains(lat, lon)){
+            throw new LakewalkerException(tr("The starting location was not within the bbox"));
+        }
+
+        int v;
+
+        setStatus(tr("Looking for shoreline..."));
+
+        while(true){
+            double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
+            if(bbox.contains(geo[0],geo[1])==false){
+                break;
+            }
+
+            v = wms.getPixel(xy[0], xy[1]);
+            if(v > this.threshold){
+                break;
+            }
+
+            int delta_lat = this.dirslat[getDirectionIndex(this.startdir)];
+            int delta_lon = this.dirslon[getDirectionIndex(this.startdir)];
+
+            xy[0] = xy[0]+delta_lon;
+            xy[1] = xy[1]+delta_lat;
+
+        }
+
+        int[] startxy = new int[] {xy[0], xy[1]};
+        double[] startgeo = xy_to_geo(xy[0],xy[1],this.resolution);
+
+        //System.out.printf("Found shore at lat %.4f lon %.4f\n",lat,lon);
+
+        int last_dir = this.getDirectionIndex(this.startdir);
+
+        for(int i = 0; i < this.maxnode; i++){
+
+            // Print a counter
+            if(i % 250 == 0){
+                setStatus(tr("{0} nodes so far...",i));
+                //System.out.println(i+" nodes so far...");
+            }
+
+            // Some variables we need
+            int d;
+            int test_x=0;
+            int test_y=0;
+            int new_dir = 0;
+
+            // Loop through all the directions we can go
+            for(d = 1; d <= this.dirslat.length; d++){
+
+                // Decide which direction we want to look at from this pixel
+                new_dir = (last_dir + d + 4) % 8;
+
+                test_x = xy[0] + this.dirslon[new_dir];
+                test_y = xy[1] + this.dirslat[new_dir];
+
+                double[] geo = xy_to_geo(test_x,test_y,this.resolution);
+
+                if(!bbox.contains(geo[0], geo[1])){
+                    System.out.println("Outside bbox");
+                    break;
+                }
+
+                v = wms.getPixel(test_x, test_y);
+                if(v > this.threshold){
+                    break;
+                }
+
+                if(d == this.dirslat.length-1){
+                    System.out.println("Got stuck");
+                    break;
+                }
+            }
+
+            // Remember this direction
+            last_dir = new_dir;
+
+            // Set the pixel we found as current
+            xy[0] = test_x;
+            xy[1] = test_y;
+
+            // Break the loop if we managed to get back to our starting point
+            if(xy[0] == startxy[0] && xy[1] == startxy[1]){
+                break;
+            }
+
+            // Store this node
+            double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
+            nodelist.add(geo);
+            //System.out.println("Adding node at "+xy[0]+","+xy[1]+" ("+geo[1]+","+geo[0]+")");
+
+            // Check if we got stuck in a loop
+            double start_proximity = Math.pow((geo[0] - startgeo[0]),2) + Math.pow((geo[1] - startgeo[1]),2);
+
+            if(detect_loop){
+                if(start_proximity < Math.pow(start_radius_small,2)){
+                    System.out.println("Detected loop");
+                    break;
+                }
+            }else{
+                if(start_proximity > Math.pow(start_radius_big,2)){
+                    detect_loop = true;
+                }
+            }
+        }
+
+        return nodelist;
+    }
+
+    /**
+     * Remove duplicate nodes from the list
+     *
+     * @param nodes
+     * @return
+     */
+    public ArrayList<double[]> duplicateNodeRemove(ArrayList<double[]> nodes){
+
+        if(nodes.size() <= 1){
+            return nodes;
+        }
+
+        double lastnode[] = new double[] {nodes.get(0)[0], nodes.get(0)[1]};
+
+        for(int i = 1; i < nodes.size(); i++){
+            double[] thisnode = new double[] {nodes.get(i)[0], nodes.get(i)[1]};
+
+            if(thisnode[0] == lastnode[0] && thisnode[1] == lastnode[1]){
+                // Remove the node
+                nodes.remove(i);
+
+                // Shift back one index
+                i = i - 1;
+            }
+            lastnode = thisnode;
+        }
+
+        return nodes;
+    }
+
+    /**
+     * Reduce the number of vertices based on their proximity to each other
+     *
+     * @param nodes
+     * @param proximity
+     * @return
+     */
+    public ArrayList<double[]> vertexReduce(ArrayList<double[]> nodes, double proximity){
+
+        // Check if node list is empty
+        if(nodes.size()<=1){
+            return nodes;
+        }
+
+        double[] test_v = nodes.get(0);
+        ArrayList<double[]> reducednodes = new ArrayList<double[]>();
+
+        double prox_sq = Math.pow(proximity, 2);
+
+        for(int v = 0; v < nodes.size(); v++){
+            if(Math.pow(nodes.get(v)[0] - test_v[0],2) + Math.pow(nodes.get(v)[1] - test_v[1],2) > prox_sq){
+                reducednodes.add(nodes.get(v));
+                test_v = nodes.get(v);
+            }
+        }
+
+        return reducednodes;
+    }
+
+    public double pointLineDistance(double[] p1, double[] p2, double[] p3){
+
+        double x0 = p1[0];
+        double y0 = p1[1];
+        double x1 = p2[0];
+        double y1 = p2[1];
+        double x2 = p3[0];
+        double y2 = p3[1];
+
+        if(x2 == x1 && y2 == y1){
+            return Math.sqrt(Math.pow(x1-x0,2) + Math.pow(y1-y0,2));
+        } else {
+            return Math.abs((x2-x1)*(y1-y0) - (x1-x0)*(y2-y1)) / Math.sqrt(Math.pow(x2-x1,2) + Math.pow(y2-y1,2));
+        }
+    }
+
+    public ArrayList<double[]> douglasPeuckerNR(ArrayList<double[]> nodes, double epsilon){
+        /*
+        command_stack = [(0, len(nodes) - 1)]
+
+        Vector result_stack = new Vector();
 
         while(command_stack.size() > 0){
-        	cmd = command_stack.pop();
-        	if(type(cmd) == tuple){
-        		(start, end) = cmd
-        		(node, dist) = dp_findpoint(nodes, start, end)
-        		if(dist > epsilon){
-        			command_stack.append("+")
-        			command_stack.append((start, node))
-        			command_stack.append((node, end))
-        		} else {
-        			result_stack.append((start, end))
-        		}
-        	} elseif(cmd == "+"){
-        		first = result_stack.pop()
-        		second = result_stack.pop()
-        		if(first[-1] == second[0]){
-        			result_stack.append(first + second[1:])
-        			//print "Added %s and %s; result is %s" % (first, second, result_stack[-1])
-        		}else {
-        			error("ERROR: Cannot connect nodestrings!")
-        			#print first
-        			#print second
-        			return;
-        		}
-        	} else {
-        		error("ERROR: Can't understand command \"%s\"" % (cmd,))
-        		return
- 
-		if(len(result_stack) == 1){
-			return [nodes[x] for x in result_stack[0]];
-		} else {
-			error("ERROR: Command stack is empty but result stack has %d nodes!" % len(result_stack));
-			return;
-		}
-        		
-		farthest_node = None
-		farthest_dist = 0
-		first = nodes[0]
-		last = nodes[-1]
-             
-		for(i in xrange(1, len(nodes) - 1){
-			d = point_line_distance(nodes[i], first, last)
-			if(d > farthest_dist){
-				farthest_dist = d
-				farthest_node = i
-     		}
-		}
-		if(farthest_dist > epsilon){
-			seg_a = douglas_peucker(nodes[0:farthest_node+1], epsilon)
-			seg_b = douglas_peucker(nodes[farthest_node:-1], epsilon)
-			//print "Minimized %d nodes to %d + %d nodes" % (len(nodes), len(seg_a), len(seg_b))
-			nodes = seg_a[:-1] + seg_b
-		} else {
-			return [nodes[0], nodes[-1]];
-		}
-		*/
-		return nodes;
-	}
-	
-	public ArrayList<double[]> douglasPeucker(ArrayList<double[]> nodes, double epsilon){
-		
-		// Check if node list is empty
-		if(nodes.size()<=1){
-			return nodes;
-		}
-		
-		int farthest_node = -1;
-		double farthest_dist = 0;
-		double[] first = nodes.get(0);
-		double[] last = nodes.get(nodes.size()-1);
-		
-		ArrayList<double[]> new_nodes = new ArrayList<double[]>();
-		
-		double d = 0;
-		
-		for(int i = 1; i < nodes.size(); i++){
-			d = pointLineDistance(nodes.get(i),first,last);
-			if(d>farthest_dist){
-				farthest_dist = d;
-				farthest_node = i;
-			}
-		}
-		
-		ArrayList<double[]> seg_a = new ArrayList<double[]>();
-		ArrayList<double[]> seg_b = new ArrayList<double[]>();
-		
-		if(farthest_dist > epsilon){
-			seg_a = douglasPeucker(sublist(nodes,0,farthest_node+1),epsilon);
-			seg_b = douglasPeucker(sublist(nodes,farthest_node,nodes.size()-1),epsilon);
-				
-			new_nodes.addAll(seg_a);
-			new_nodes.addAll(seg_b);
-		} else {
-			new_nodes.add(nodes.get(0));
-			new_nodes.add(nodes.get(nodes.size()-1));
-		}
-		return new_nodes;
-	}
-	
-	private ArrayList<double[]> sublist(ArrayList<double[]> l, int i, int f) throws ArrayIndexOutOfBoundsException {
-		ArrayList<double[]> sub = new ArrayList<double[]>();
-		
-		if(f<i || i < 0 || f < 0 || f > l.size()){
-			throw new ArrayIndexOutOfBoundsException();
-		}
-		
-		for(int j = i; j < f; j++){
-			sub.add(l.get(j));
-		}
-		return sub;
-	}
-	
-	public double[] xy_to_geo(int x, int y, double resolution){
-		double[] geo = new double[2];
-	    geo[0] = y / resolution;
-	    geo[1] = x / resolution;
-	    return geo;
-	}
-	
-	public int[] geo_to_xy(double lat, double lon, double resolution){
-		int[] xy = new int[2];
-		
-		xy[0] = (int)Math.floor(lon * resolution + 0.5);
-		xy[1] = (int)Math.floor(lat * resolution + 0.5);
-				
-		return xy;
-	}
-	
-	/*
+            cmd = command_stack.pop();
+            if(type(cmd) == tuple){
+                (start, end) = cmd
+                (node, dist) = dp_findpoint(nodes, start, end)
+                if(dist > epsilon){
+                    command_stack.append("+")
+                    command_stack.append((start, node))
+                    command_stack.append((node, end))
+                } else {
+                    result_stack.append((start, end))
+                }
+            } elseif(cmd == "+"){
+                first = result_stack.pop()
+                second = result_stack.pop()
+                if(first[-1] == second[0]){
+                    result_stack.append(first + second[1:])
+                    //print "Added %s and %s; result is %s" % (first, second, result_stack[-1])
+                }else {
+                    error("ERROR: Cannot connect nodestrings!")
+                    #print first
+                    #print second
+                    return;
+                }
+            } else {
+                error("ERROR: Can't understand command \"%s\"" % (cmd,))
+                return
+
+        if(len(result_stack) == 1){
+            return [nodes[x] for x in result_stack[0]];
+        } else {
+            error("ERROR: Command stack is empty but result stack has %d nodes!" % len(result_stack));
+            return;
+        }
+
+        farthest_node = None
+        farthest_dist = 0
+        first = nodes[0]
+        last = nodes[-1]
+
+        for(i in xrange(1, len(nodes) - 1){
+            d = point_line_distance(nodes[i], first, last)
+            if(d > farthest_dist){
+                farthest_dist = d
+                farthest_node = i
+            }
+        }
+        if(farthest_dist > epsilon){
+            seg_a = douglas_peucker(nodes[0:farthest_node+1], epsilon)
+            seg_b = douglas_peucker(nodes[farthest_node:-1], epsilon)
+            //print "Minimized %d nodes to %d + %d nodes" % (len(nodes), len(seg_a), len(seg_b))
+            nodes = seg_a[:-1] + seg_b
+        } else {
+            return [nodes[0], nodes[-1]];
+        }
+        */
+        return nodes;
+    }
+
+    public ArrayList<double[]> douglasPeucker(ArrayList<double[]> nodes, double epsilon){
+
+        // Check if node list is empty
+        if(nodes.size()<=1){
+            return nodes;
+        }
+
+        int farthest_node = -1;
+        double farthest_dist = 0;
+        double[] first = nodes.get(0);
+        double[] last = nodes.get(nodes.size()-1);
+
+        ArrayList<double[]> new_nodes = new ArrayList<double[]>();
+
+        double d = 0;
+
+        for(int i = 1; i < nodes.size(); i++){
+            d = pointLineDistance(nodes.get(i),first,last);
+            if(d>farthest_dist){
+                farthest_dist = d;
+                farthest_node = i;
+            }
+        }
+
+        ArrayList<double[]> seg_a = new ArrayList<double[]>();
+        ArrayList<double[]> seg_b = new ArrayList<double[]>();
+
+        if(farthest_dist > epsilon){
+            seg_a = douglasPeucker(sublist(nodes,0,farthest_node+1),epsilon);
+            seg_b = douglasPeucker(sublist(nodes,farthest_node,nodes.size()-1),epsilon);
+
+            new_nodes.addAll(seg_a);
+            new_nodes.addAll(seg_b);
+        } else {
+            new_nodes.add(nodes.get(0));
+            new_nodes.add(nodes.get(nodes.size()-1));
+        }
+        return new_nodes;
+    }
+
+    private ArrayList<double[]> sublist(ArrayList<double[]> l, int i, int f) throws ArrayIndexOutOfBoundsException {
+        ArrayList<double[]> sub = new ArrayList<double[]>();
+
+        if(f<i || i < 0 || f < 0 || f > l.size()){
+            throw new ArrayIndexOutOfBoundsException();
+        }
+
+        for(int j = i; j < f; j++){
+            sub.add(l.get(j));
+        }
+        return sub;
+    }
+
+    public double[] xy_to_geo(int x, int y, double resolution){
+        double[] geo = new double[2];
+        geo[0] = y / resolution;
+        geo[1] = x / resolution;
+        return geo;
+    }
+
+    public int[] geo_to_xy(double lat, double lon, double resolution){
+        int[] xy = new int[2];
+
+        xy[0] = (int)Math.floor(lon * resolution + 0.5);
+        xy[1] = (int)Math.floor(lat * resolution + 0.5);
+
+        return xy;
+    }
+
+    /*
      * User has hit the cancel button
-	 */
-	public void cancel() {
-	  cancel = true;
-	}
-		
-	protected void setStatus(String s) {
-	  Main.pleaseWaitDlg.currentAction.setText(s);
-	  Main.pleaseWaitDlg.repaint();
-	}
-	
-	/**
-	 * Class to do checking of whether the point is within our bbox
-	 * 
-	 * @author Jason Reid
-	 */
-	private class LakewalkerBBox {
-		
-		private double top = 90;
-		private double left = -180;
-		private double bottom = -90;
-		private double right = 180;
-		
-		protected LakewalkerBBox(double top, double left, double bottom, double right){
-		  this.left = left;
-		  this.right = right;
-		  this.top = top;
-		  this.bottom = bottom;
-		}
-		
-		protected Boolean contains(double lat, double lon){
-		  if(lat >= this.top || lat <= this.bottom){
-		    return false;
-		  }
-		  if(lon >= this.right || lon <= this.left){
-			  return false;
-		  }
-		  if((this.right - this.left) % 360 == 0){
-		    return true;
-		  }
-		  return (lon - this.left) % 360 <= (this.right - this.left) % 360;
-		}
-	}
-	private void printarr(int[] a){
-		for(int i = 0; i<a.length; i++){
-			System.out.println(i+": "+a[i]);
-		}
-	}
+     */
+    public void cancel() {
+      cancel = true;
+    }
+
+    protected void setStatus(String s) {
+      Main.pleaseWaitDlg.currentAction.setText(s);
+      Main.pleaseWaitDlg.repaint();
+    }
+
+    /**
+     * Class to do checking of whether the point is within our bbox
+     *
+     * @author Jason Reid
+     */
+    private class LakewalkerBBox {
+
+        private double top = 90;
+        private double left = -180;
+        private double bottom = -90;
+        private double right = 180;
+
+        protected LakewalkerBBox(double top, double left, double bottom, double right){
+          this.left = left;
+          this.right = right;
+          this.top = top;
+          this.bottom = bottom;
+        }
+
+        protected Boolean contains(double lat, double lon){
+          if(lat >= this.top || lat <= this.bottom){
+            return false;
+          }
+          if(lon >= this.right || lon <= this.left){
+              return false;
+          }
+          if((this.right - this.left) % 360 == 0){
+            return true;
+          }
+          return (lon - this.left) % 360 <= (this.right - this.left) % 360;
+        }
+    }
+    private void printarr(int[] a){
+        for(int i = 0; i<a.length; i++){
+            System.out.println(i+": "+a[i]);
+        }
+    }
 }
 
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 12778)
@@ -35,5 +35,5 @@
 /**
  * Interface to Darryl Shpak's Lakewalker module
- * 
+ *
  * @author Brent Easton
  */
@@ -45,5 +45,5 @@
   protected Thread executeThread;
   protected boolean cancel;
-  
+
   protected Collection<Command> commands = new LinkedList<Command>();
   protected Collection<Way> ways = new ArrayList<Way>();
@@ -56,5 +56,5 @@
     setEnabled(true);
   }
-  
+
   public void actionPerformed(ActionEvent e) {
     if(Main.map == null || Main.map.mapView == null)
@@ -78,84 +78,84 @@
    */
   private void cleanupCache() {
-	  final long maxCacheAge = System.currentTimeMillis()-Main.pref.getInteger(LakewalkerPreferences.PREF_MAXCACHEAGE, 100)*24*60*60*1000L;
-	  final long maxCacheSize = Main.pref.getInteger(LakewalkerPreferences.PREF_MAXCACHESIZE, 300)*1024*1024;
-
-	  for (String wmsFolder : LakewalkerPreferences.WMSLAYERS) {
-		  String wmsCacheDirName = Main.pref.getPreferencesDir()+"plugins/Lakewalker/"+wmsFolder;
-		  File wmsCacheDir = new File(wmsCacheDirName);
-
-		  if (wmsCacheDir.exists() && wmsCacheDir.isDirectory()) {
-			  File wmsCache[] = wmsCacheDir.listFiles();
-
-			  // sort files by date (most recent first)
-			  Arrays.sort(wmsCache, new Comparator<File>() {
-				  public int compare(File f1, File f2) {
-					  return (int)(f2.lastModified()-f1.lastModified());
-				  }
-			  });
-			  
-			  // delete aged or oversized, keep newest. Once size/age limit was reached delete all older files
-			  long folderSize = 0;
-			  boolean quickdelete = false;
-			  for (File cacheEntry : wmsCache) {
-				  if (!cacheEntry.isFile()) continue;
-				  if (!quickdelete) {
-					  folderSize += cacheEntry.length();
-					  if (folderSize > maxCacheSize) {
-						  quickdelete = true;
-					  } else if (cacheEntry.lastModified() < maxCacheAge) {
-						  quickdelete = true;
-					  }
-				  }
-					  
-				  if (quickdelete) {
-					  cacheEntry.delete();
-				  }
-			  }
-			  
-		  } else {
-			  // create cache directory
-			  if (!wmsCacheDir.mkdirs()) {
-				  JOptionPane.showMessageDialog(Main.parent, tr("Error creating cache directory: {0}", wmsCacheDirName));
-			  }
-		  }
-	  }
-  }
-  
+      final long maxCacheAge = System.currentTimeMillis()-Main.pref.getInteger(LakewalkerPreferences.PREF_MAXCACHEAGE, 100)*24*60*60*1000L;
+      final long maxCacheSize = Main.pref.getInteger(LakewalkerPreferences.PREF_MAXCACHESIZE, 300)*1024*1024;
+
+      for (String wmsFolder : LakewalkerPreferences.WMSLAYERS) {
+          String wmsCacheDirName = Main.pref.getPreferencesDir()+"plugins/Lakewalker/"+wmsFolder;
+          File wmsCacheDir = new File(wmsCacheDirName);
+
+          if (wmsCacheDir.exists() && wmsCacheDir.isDirectory()) {
+              File wmsCache[] = wmsCacheDir.listFiles();
+
+              // sort files by date (most recent first)
+              Arrays.sort(wmsCache, new Comparator<File>() {
+                  public int compare(File f1, File f2) {
+                      return (int)(f2.lastModified()-f1.lastModified());
+                  }
+              });
+
+              // delete aged or oversized, keep newest. Once size/age limit was reached delete all older files
+              long folderSize = 0;
+              boolean quickdelete = false;
+              for (File cacheEntry : wmsCache) {
+                  if (!cacheEntry.isFile()) continue;
+                  if (!quickdelete) {
+                      folderSize += cacheEntry.length();
+                      if (folderSize > maxCacheSize) {
+                          quickdelete = true;
+                      } else if (cacheEntry.lastModified() < maxCacheAge) {
+                          quickdelete = true;
+                      }
+                  }
+
+                  if (quickdelete) {
+                      cacheEntry.delete();
+                  }
+              }
+
+          } else {
+              // create cache directory
+              if (!wmsCacheDir.mkdirs()) {
+                  JOptionPane.showMessageDialog(Main.parent, tr("Error creating cache directory: {0}", wmsCacheDirName));
+              }
+          }
+      }
+  }
+
   protected void lakewalk(Point clickPoint){
-	/**
-	 * Positional data
-	 */
-	final LatLon pos = Main.map.mapView.getLatLon(clickPoint.x, clickPoint.y);
-	final LatLon topLeft = Main.map.mapView.getLatLon(0, 0);
-	final LatLon botRight = Main.map.mapView.getLatLon(Main.map.mapView.getWidth(), Main.map.mapView
-	     .getHeight());	    
-
-	/**
-	 * Cache/working directory location
-	 */
-	final File working_dir = new File(Main.pref.getPreferencesDir(), "plugins/Lakewalker");
-	
-	/*
-	 * Collect options
-	 */
-	final int waylen = Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_SEG, 500);
-	final int maxnode = Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_NODES, 50000);
-	final int threshold = Main.pref.getInteger(LakewalkerPreferences.PREF_THRESHOLD_VALUE, 90);
-	final double epsilon = Main.pref.getDouble(LakewalkerPreferences.PREF_EPSILON, 0.0003);
-	final int resolution = Main.pref.getInteger(LakewalkerPreferences.PREF_LANDSAT_RES, 4000);
-	final int tilesize = Main.pref.getInteger(LakewalkerPreferences.PREF_LANDSAT_SIZE, 2000);
-	final String startdir = Main.pref.get(LakewalkerPreferences.PREF_START_DIR, "east");
-	final String wmslayer = Main.pref.get(LakewalkerPreferences.PREF_WMS, "IR1");
-
-	try {
+    /**
+     * Positional data
+     */
+    final LatLon pos = Main.map.mapView.getLatLon(clickPoint.x, clickPoint.y);
+    final LatLon topLeft = Main.map.mapView.getLatLon(0, 0);
+    final LatLon botRight = Main.map.mapView.getLatLon(Main.map.mapView.getWidth(), Main.map.mapView
+         .getHeight());
+
+    /**
+     * Cache/working directory location
+     */
+    final File working_dir = new File(Main.pref.getPreferencesDir(), "plugins/Lakewalker");
+
+    /*
+     * Collect options
+     */
+    final int waylen = Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_SEG, 500);
+    final int maxnode = Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_NODES, 50000);
+    final int threshold = Main.pref.getInteger(LakewalkerPreferences.PREF_THRESHOLD_VALUE, 90);
+    final double epsilon = Main.pref.getDouble(LakewalkerPreferences.PREF_EPSILON, 0.0003);
+    final int resolution = Main.pref.getInteger(LakewalkerPreferences.PREF_LANDSAT_RES, 4000);
+    final int tilesize = Main.pref.getInteger(LakewalkerPreferences.PREF_LANDSAT_SIZE, 2000);
+    final String startdir = Main.pref.get(LakewalkerPreferences.PREF_START_DIR, "east");
+    final String wmslayer = Main.pref.get(LakewalkerPreferences.PREF_WMS, "IR1");
+
+    try {
         PleaseWaitRunnable lakewalkerTask = new PleaseWaitRunnable(tr("Tracing")){
           @Override protected void realRun() throws SAXException {
-        	  setStatus(tr("checking cache..."));
-        	  cleanupCache();
-        	  processnodelist(pos, topLeft, botRight, waylen,maxnode,threshold,epsilon,resolution,tilesize,startdir,wmslayer,working_dir);
+              setStatus(tr("checking cache..."));
+              cleanupCache();
+              processnodelist(pos, topLeft, botRight, waylen,maxnode,threshold,epsilon,resolution,tilesize,startdir,wmslayer,working_dir);
           }
           @Override protected void finish() {
-            
+
           }
           @Override protected void cancel() {
@@ -168,133 +168,133 @@
       catch (Exception ex) {
         System.out.println("Exception caught: " + ex.getMessage());
-      }      
-  }
-  
+      }
+  }
+
   private void processnodelist(LatLon pos, LatLon topLeft, LatLon botRight, int waylen, int maxnode, int threshold, double epsilon, int resolution, int tilesize, String startdir, String wmslayer, File workingdir){
-	  
-	ArrayList<double[]> nodelist = new ArrayList<double[]>();
-	  
-	Lakewalker lw = new Lakewalker(waylen,maxnode,threshold,epsilon,resolution,tilesize,startdir,wmslayer,workingdir);
-	try {
-		nodelist = lw.trace(pos.lat(),pos.lon(),topLeft.lon(),botRight.lon(),topLeft.lat(),botRight.lat());
-	} catch(LakewalkerException e){
-		System.out.println(e.getError());
-	}
-	
-	System.out.println(nodelist.size()+" nodes generated");
-	
-	/**
-	 * Run the nodelist through a vertex reduction algorithm
-	 */
-	
-	setStatus(tr("Running vertex reduction..."));
-	
-	nodelist = lw.vertexReduce(nodelist, epsilon);
-	
-	//System.out.println("After vertex reduction "+nodelist.size()+" nodes remain.");
-	
-	/**
-	 * And then through douglas-peucker approximation
-	 */
-	
-	setStatus(tr("Running Douglas-Peucker approximation..."));
-	
-	nodelist = lw.douglasPeucker(nodelist, epsilon);
-	
-	//System.out.println("After Douglas-Peucker approximation "+nodelist.size()+" nodes remain.");
-	  
-	/**
-	 * And then through a duplicate node remover
-	 */
-	
-	setStatus(tr("Removing duplicate nodes..."));
-	
-	nodelist = lw.duplicateNodeRemove(nodelist);
-	
-	//System.out.println("After removing duplicate nodes, "+nodelist.size()+" nodes remain.");
-	  
-	
-	// if for some reason (image loading failed, ...) nodelist is empty, no more processing required.
-	if (nodelist.size() == 0) {
-		return;
-	}
-	
-	/**
-	 * Turn the arraylist into osm nodes
-	 */
-	
-	Way way = new Way();
-	Node n = null;
-	Node fn = null;
-	
-	double eastOffset = Main.pref.getDouble(LakewalkerPreferences.PREF_EAST_OFFSET, 0.0);
-	double northOffset = Main.pref.getDouble(LakewalkerPreferences.PREF_NORTH_OFFSET, 0.0);
-	
-	int nodesinway = 0;
-	
-	for(int i = 0; i< nodelist.size(); i++){
-		if (cancel) {
-			return;
-	    }
-		 	
-		try {        	
-		  LatLon ll = new LatLon(nodelist.get(i)[0]+northOffset, nodelist.get(i)[1]+eastOffset);
-		  n = new Node(ll);
-		  if(fn==null){
-		    fn = n;
-		  }
-		  commands.add(new AddCommand(n));
-		  
-		} catch (Exception ex) {		 
-		}	    
-	      
-		way.nodes.add(n);
-		
-		if(nodesinway > Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_SEG, 500)){
-			String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water");
-	        
-	        if(!waytype.equals("none")){
-	      	  way.put("natural",waytype);
-	        }
-	        
-	        way.put("created_by", "Dshpak_landsat_lakes");
-	        commands.add(new AddCommand(way));
-	        
-	        way = new Way();
-
-	        way.nodes.add(n);
-	        
-	        nodesinway = 0;
-		}
-		nodesinway++;
-	}
-	
-	
-	String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water");
-    
+
+    ArrayList<double[]> nodelist = new ArrayList<double[]>();
+
+    Lakewalker lw = new Lakewalker(waylen,maxnode,threshold,epsilon,resolution,tilesize,startdir,wmslayer,workingdir);
+    try {
+        nodelist = lw.trace(pos.lat(),pos.lon(),topLeft.lon(),botRight.lon(),topLeft.lat(),botRight.lat());
+    } catch(LakewalkerException e){
+        System.out.println(e.getError());
+    }
+
+    System.out.println(nodelist.size()+" nodes generated");
+
+    /**
+     * Run the nodelist through a vertex reduction algorithm
+     */
+
+    setStatus(tr("Running vertex reduction..."));
+
+    nodelist = lw.vertexReduce(nodelist, epsilon);
+
+    //System.out.println("After vertex reduction "+nodelist.size()+" nodes remain.");
+
+    /**
+     * And then through douglas-peucker approximation
+     */
+
+    setStatus(tr("Running Douglas-Peucker approximation..."));
+
+    nodelist = lw.douglasPeucker(nodelist, epsilon);
+
+    //System.out.println("After Douglas-Peucker approximation "+nodelist.size()+" nodes remain.");
+
+    /**
+     * And then through a duplicate node remover
+     */
+
+    setStatus(tr("Removing duplicate nodes..."));
+
+    nodelist = lw.duplicateNodeRemove(nodelist);
+
+    //System.out.println("After removing duplicate nodes, "+nodelist.size()+" nodes remain.");
+
+
+    // if for some reason (image loading failed, ...) nodelist is empty, no more processing required.
+    if (nodelist.size() == 0) {
+        return;
+    }
+
+    /**
+     * Turn the arraylist into osm nodes
+     */
+
+    Way way = new Way();
+    Node n = null;
+    Node fn = null;
+
+    double eastOffset = Main.pref.getDouble(LakewalkerPreferences.PREF_EAST_OFFSET, 0.0);
+    double northOffset = Main.pref.getDouble(LakewalkerPreferences.PREF_NORTH_OFFSET, 0.0);
+
+    int nodesinway = 0;
+
+    for(int i = 0; i< nodelist.size(); i++){
+        if (cancel) {
+            return;
+        }
+
+        try {
+          LatLon ll = new LatLon(nodelist.get(i)[0]+northOffset, nodelist.get(i)[1]+eastOffset);
+          n = new Node(ll);
+          if(fn==null){
+            fn = n;
+          }
+          commands.add(new AddCommand(n));
+
+        } catch (Exception ex) {
+        }
+
+        way.nodes.add(n);
+
+        if(nodesinway > Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_SEG, 500)){
+            String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water");
+
+            if(!waytype.equals("none")){
+              way.put("natural",waytype);
+            }
+
+            way.put("created_by", "Dshpak_landsat_lakes");
+            commands.add(new AddCommand(way));
+
+            way = new Way();
+
+            way.nodes.add(n);
+
+            nodesinway = 0;
+        }
+        nodesinway++;
+    }
+
+
+    String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water");
+
     if(!waytype.equals("none")){
-  	  way.put("natural",waytype);
-    }
-    
+      way.put("natural",waytype);
+    }
+
     way.put("created_by", "Dshpak_landsat_lakes");
-    
-	way.nodes.add(fn);
-	
-	commands.add(new AddCommand(way));
-	
-	if (!commands.isEmpty()) {
+
+    way.nodes.add(fn);
+
+    commands.add(new AddCommand(way));
+
+    if (!commands.isEmpty()) {
         Main.main.undoRedo.add(new SequenceCommand(tr("Lakewalker trace"), commands));
         Main.ds.setSelected(ways);
     } else {
-  	  System.out.println("Failed");
-    }
-	
-	commands = new LinkedList<Command>();
-	ways = new ArrayList<Way>();
-	
-  }
-  
+      System.out.println("Failed");
+    }
+
+    commands = new LinkedList<Command>();
+    ways = new ArrayList<Way>();
+
+  }
+
   public void cancel() {
-	  cancel = true;
+      cancel = true;
   }
 
@@ -317,6 +317,6 @@
   }
   protected void setStatus(String s) {
-	  Main.pleaseWaitDlg.currentAction.setText(s);
-	  Main.pleaseWaitDlg.repaint();
+      Main.pleaseWaitDlg.currentAction.setText(s);
+      Main.pleaseWaitDlg.repaint();
   }
 }
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerApp.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerApp.java	(revision 12777)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerApp.java	(revision 12778)
@@ -5,53 +5,53 @@
 
 public class LakewalkerApp {
-	public static void main(String[] args){
-		double lat = 52.31384;
-		double lon = -79.135;
-		double toplat = 52.3165;
-		double botlat = 52.3041;
-		double leftlon = -79.1442;
-		double rightlon = -79.1093;
-		
-		// ?lat=39.15579999999999&lon=2.9411&zoom=12&layers=B000F000F
-		lat = 39.1422;
-		lon = 2.9102;
-		
-		toplat = 39.2229;
-		botlat = 39.0977;
-		leftlon = 2.8560;
-		rightlon = 3.0462;
-		
-		int waylen = 250;
-		int maxnode = 5000;
-		int threshold = 100;
-		double dp = 0.0003;
-		int tilesize = 2000;
-		int resolution = 4000;
-		String startdir = "East";
-		String wmslayer = "IR2";
-		
-		File working_dir = new File("Lakewalker");
-		
-		ArrayList<double[]> nodelist = null;
-		
-		Lakewalker lw = new Lakewalker(waylen,maxnode,threshold,dp,resolution,tilesize,startdir,wmslayer,working_dir);
-	    try {
-	    	nodelist = lw.trace(lat,lon,leftlon,rightlon,toplat,botlat);
-	    } catch(LakewalkerException e){
-	    	System.out.println(e.getError());
-	    }
-	    
-	    System.out.println(nodelist.size()+" nodes generated");
-	    
-	    nodelist = lw.vertexReduce(nodelist, dp);
-	    
-	    System.out.println("After vertex reduction, "+nodelist.size()+" nodes remain.");
-	    
-	    nodelist = lw.douglasPeucker(nodelist, dp);
-	    
-	    System.out.println("After dp approximation, "+nodelist.size()+" nodes remain.");
-	 
-	    
-	    
-	}
+    public static void main(String[] args){
+        double lat = 52.31384;
+        double lon = -79.135;
+        double toplat = 52.3165;
+        double botlat = 52.3041;
+        double leftlon = -79.1442;
+        double rightlon = -79.1093;
+
+        // ?lat=39.15579999999999&lon=2.9411&zoom=12&layers=B000F000F
+        lat = 39.1422;
+        lon = 2.9102;
+
+        toplat = 39.2229;
+        botlat = 39.0977;
+        leftlon = 2.8560;
+        rightlon = 3.0462;
+
+        int waylen = 250;
+        int maxnode = 5000;
+        int threshold = 100;
+        double dp = 0.0003;
+        int tilesize = 2000;
+        int resolution = 4000;
+        String startdir = "East";
+        String wmslayer = "IR2";
+
+        File working_dir = new File("Lakewalker");
+
+        ArrayList<double[]> nodelist = null;
+
+        Lakewalker lw = new Lakewalker(waylen,maxnode,threshold,dp,resolution,tilesize,startdir,wmslayer,working_dir);
+        try {
+            nodelist = lw.trace(lat,lon,leftlon,rightlon,toplat,botlat);
+        } catch(LakewalkerException e){
+            System.out.println(e.getError());
+        }
+
+        System.out.println(nodelist.size()+" nodes generated");
+
+        nodelist = lw.vertexReduce(nodelist, dp);
+
+        System.out.println("After vertex reduction, "+nodelist.size()+" nodes remain.");
+
+        nodelist = lw.douglasPeucker(nodelist, dp);
+
+        System.out.println("After dp approximation, "+nodelist.size()+" nodes remain.");
+
+
+
+    }
 }
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java	(revision 12777)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java	(revision 12778)
@@ -2,18 +2,18 @@
 
 class LakewalkerException extends Exception {
-	String error;
-	
-	public LakewalkerException(){
-		super();
-		this.error = "An unknown error has occured";
-	}
-	
-	public LakewalkerException(String err){
-		super();
-		this.error = err;
-	}
-	
-	public String getError(){
-	  return this.error;
-	}
+    String error;
+
+    public LakewalkerException(){
+        super();
+        this.error = "An unknown error has occured";
+    }
+
+    public LakewalkerException(String err){
+        super();
+        this.error = err;
+    }
+
+    public String getError(){
+      return this.error;
+    }
 }
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java	(revision 12778)
@@ -10,5 +10,5 @@
 /**
  * Interface to Darryl Shpak's Lakewalker python module
- * 
+ *
  * @author Brent Easton
  */
@@ -18,5 +18,5 @@
   }
 
-  public PreferenceSetting getPreferenceSetting() 
+  public PreferenceSetting getPreferenceSetting()
   {
     return new LakewalkerPreferences();
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java	(revision 12777)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java	(revision 12778)
@@ -51,9 +51,9 @@
     
     try {
-    	
-	  Node n = null;  // The current node being created
-	  Node tn = null; // The last node of the previous way
+        
+      Node n = null;  // The current node being created
+      Node tn = null; // The last node of the previous way
       Node fn = null; // Node to hold the first node in the trace
-    	
+        
       while ((line = input.readLine()) != null) {
         if (cancel) {
@@ -67,24 +67,24 @@
           
           if(tn==null){
-		      try {        	
-		        LatLon ll = new LatLon(Double.parseDouble(tokens[1])+northOffset, Double.parseDouble(tokens[2])+eastOffset);
-		        n = new Node(ll);
-		        if(fn==null){
-		          fn = n;
-		        }
-		        commands.add(new AddCommand(n));
-		      }
-	          catch (Exception ex) {
-	        	  
-		      }
+              try {         
+                LatLon ll = new LatLon(Double.parseDouble(tokens[1])+northOffset, Double.parseDouble(tokens[2])+eastOffset);
+                n = new Node(ll);
+                if(fn==null){
+                  fn = n;
+                }
+                commands.add(new AddCommand(n));
+              }
+              catch (Exception ex) {
+                  
+              }
           
           } else {
             // If there is a last node, and this node has the same coordinates
             // then we substitute for the previous node
-      		n = tn;
-        	tn = null;       	
+            n = tn;
+            tn = null;          
           }
-	      
-	      way.nodes.add(n);
+          
+          way.nodes.add(n);
           
           break;
@@ -98,5 +98,5 @@
           
           if(!waytype.equals("none")){
-        	  way.put("natural",waytype);
+              way.put("natural",waytype);
           }
           
@@ -106,8 +106,8 @@
           break;
         
-        case 't':      	
-        	way = new Way();
-        	tn = n;
-        	break;
+        case 't':       
+            way = new Way();
+            tn = n;
+            break;
           
         case 'e':
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java	(revision 12777)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java	(revision 12778)
@@ -17,228 +17,228 @@
 
 public class LakewalkerWMS {
-	
-	private BufferedImage image;
-	private int imagex;
-	private int imagey;
-	
-	// Vector to cache images in memory
-	private Vector<BufferedImage> images = new Vector<BufferedImage>();
-	// Hashmap to hold the mapping of cached images 
-	private HashMap<String,Integer> imageindex = new HashMap<String,Integer>();
-	
-	private int resolution;
-	private int tilesize;
-	
-	private String wmslayer;
-	
-	private File working_dir;
-	
-	public LakewalkerWMS(int resolution, int tilesize, String wmslayer, File workdir){
-		this.resolution = resolution;
-		this.tilesize = tilesize;
-		this.working_dir = workdir;
-		this.wmslayer = wmslayer;
-	}
-	
-	public BufferedImage getTile(int x, int y) throws LakewalkerException {
-		String status = getStatus();
-		setStatus(tr("Downloading image tile..."));
-		
-		String layer = "global_mosaic_base";
-		
-		int[] bottom_left_xy = new int[2]; 
-		bottom_left_xy[0] = floor(x,this.tilesize);
-		bottom_left_xy[1] = floor(y,this.tilesize);
-		
-        int[] top_right_xy = new int[2]; 
+
+    private BufferedImage image;
+    private int imagex;
+    private int imagey;
+
+    // Vector to cache images in memory
+    private Vector<BufferedImage> images = new Vector<BufferedImage>();
+    // Hashmap to hold the mapping of cached images
+    private HashMap<String,Integer> imageindex = new HashMap<String,Integer>();
+
+    private int resolution;
+    private int tilesize;
+
+    private String wmslayer;
+
+    private File working_dir;
+
+    public LakewalkerWMS(int resolution, int tilesize, String wmslayer, File workdir){
+        this.resolution = resolution;
+        this.tilesize = tilesize;
+        this.working_dir = workdir;
+        this.wmslayer = wmslayer;
+    }
+
+    public BufferedImage getTile(int x, int y) throws LakewalkerException {
+        String status = getStatus();
+        setStatus(tr("Downloading image tile..."));
+
+        String layer = "global_mosaic_base";
+
+        int[] bottom_left_xy = new int[2];
+        bottom_left_xy[0] = floor(x,this.tilesize);
+        bottom_left_xy[1] = floor(y,this.tilesize);
+
+        int[] top_right_xy = new int[2];
         top_right_xy[0] = (int)bottom_left_xy[0] + this.tilesize;
         top_right_xy[1] = (int)bottom_left_xy[1] + this.tilesize;
-        
+
         double[] topright_geo = xy_to_geo(top_right_xy[0],top_right_xy[1],this.resolution);
         double[] bottomleft_geo = xy_to_geo(bottom_left_xy[0],bottom_left_xy[1],this.resolution);
-                  
-		String filename = this.wmslayer+"/landsat_"+this.resolution+"_"+this.tilesize+
-			"_xy_"+bottom_left_xy[0]+"_"+bottom_left_xy[1]+".png";
-		
-		// The WMS server only understands decimal points using periods, so we need
-		// to convert to a locale that uses that to build the proper URL
+
+        String filename = this.wmslayer+"/landsat_"+this.resolution+"_"+this.tilesize+
+            "_xy_"+bottom_left_xy[0]+"_"+bottom_left_xy[1]+".png";
+
+        // The WMS server only understands decimal points using periods, so we need
+        // to convert to a locale that uses that to build the proper URL
         NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
-		DecimalFormat df = (DecimalFormat)nf;
-		df.applyLocalizedPattern("0.000000");
-		
-		String urlloc = "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers="+layer+
-			"&styles="+wmslayer+"&srs=EPSG:4326&format=image/png"+
-			"&bbox="+df.format(bottomleft_geo[1])+","+df.format(bottomleft_geo[0])+
-			","+df.format(topright_geo[1])+","+df.format(topright_geo[0])+
-			"&width="+this.tilesize+"&height="+this.tilesize;
-				
+        DecimalFormat df = (DecimalFormat)nf;
+        df.applyLocalizedPattern("0.000000");
+
+        String urlloc = "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers="+layer+
+            "&styles="+wmslayer+"&srs=EPSG:4326&format=image/png"+
+            "&bbox="+df.format(bottomleft_geo[1])+","+df.format(bottomleft_geo[0])+
+            ","+df.format(topright_geo[1])+","+df.format(topright_geo[0])+
+            "&width="+this.tilesize+"&height="+this.tilesize;
+
         File file = new File(this.working_dir,filename);
-        
+
         // Calculate the hashmap key
-    	String hashkey = Integer.toString(bottom_left_xy[0])+":"+Integer.toString(bottom_left_xy[1]);
-    	
+        String hashkey = Integer.toString(bottom_left_xy[0])+":"+Integer.toString(bottom_left_xy[1]);
+
         // See if this image is already loaded
-        if(this.image != null){  
-        	if(this.imagex != bottom_left_xy[0] || this.imagey != bottom_left_xy[1]){
-        		
-        		// Check if this image exists in the hashmap
-        		if(this.imageindex.containsKey(hashkey)){
-        			// Store which image we have
-        			this.imagex = bottom_left_xy[0];
-        			this.imagey = bottom_left_xy[1];
-        			
-        			// Retrieve from cache
-        			this.image = this.images.get(this.imageindex.get(hashkey));
-        			return this.image;
-        		} else {
-        			this.image = null;
-        		}
-        	} else {
-        		return this.image;
-        	}
-        }
-        
-	    try {	    	
-	    	System.out.println("Looking for image in disk cache: "+filename);
-	    	
-	        // Read from a file
-	        this.image = ImageIO.read(file);
-	    
-	        this.images.add(this.image);
-	        this.imageindex.put(hashkey,this.images.size()-1);
-	        
-	    } catch(FileNotFoundException e){
-	    	System.out.println("Could not find cached image, downloading.");
-	    } catch(IOException e){
-	    	System.out.println(e.getMessage());
-	    } catch(Exception e){
-	    	System.out.println(e.getMessage());
-	    }
-	    
-	    if(this.image == null){
-	    	/**
-	    	 * Try downloading the image
-	    	 */
-		    try {	        	
-	        	System.out.println("Downloading from "+urlloc);
-	        	
-	        	// Read from a URL
-	        	URL url = new URL(urlloc);
-	        	this.image = ImageIO.read(url); // this can return null!
-	        } catch(MalformedURLException e){
-	        	System.out.println(e.getMessage());
-	        } catch(IOException e){
-	        	System.out.println(e.getMessage());
-	        } catch(Exception e){
-	        	System.out.println(e.getMessage());
-		    }
-	        
-	        if (this.image != null) {
-		        this.images.add(this.image);
-		        this.imageindex.put(hashkey,this.images.size()-1);
-		        
-		        this.saveimage(file,this.image);
-	        }
-	    }
-	    
-	    this.imagex = bottom_left_xy[0];
-	    this.imagey = bottom_left_xy[1];
-	    
-	    if(this.image == null){
-	    	throw new LakewalkerException(tr("Could not acquire image"));
-	    }
-		
-	    setStatus(status);
-	    
-		return this.image;
-	}
-	
-	public void saveimage(File file, BufferedImage image){
+        if(this.image != null){
+            if(this.imagex != bottom_left_xy[0] || this.imagey != bottom_left_xy[1]){
+
+                // Check if this image exists in the hashmap
+                if(this.imageindex.containsKey(hashkey)){
+                    // Store which image we have
+                    this.imagex = bottom_left_xy[0];
+                    this.imagey = bottom_left_xy[1];
+
+                    // Retrieve from cache
+                    this.image = this.images.get(this.imageindex.get(hashkey));
+                    return this.image;
+                } else {
+                    this.image = null;
+                }
+            } else {
+                return this.image;
+            }
+        }
+
+        try {
+            System.out.println("Looking for image in disk cache: "+filename);
+
+            // Read from a file
+            this.image = ImageIO.read(file);
+
+            this.images.add(this.image);
+            this.imageindex.put(hashkey,this.images.size()-1);
+
+        } catch(FileNotFoundException e){
+            System.out.println("Could not find cached image, downloading.");
+        } catch(IOException e){
+            System.out.println(e.getMessage());
+        } catch(Exception e){
+            System.out.println(e.getMessage());
+        }
+
+        if(this.image == null){
+            /**
+             * Try downloading the image
+             */
+            try {
+                System.out.println("Downloading from "+urlloc);
+
+                // Read from a URL
+                URL url = new URL(urlloc);
+                this.image = ImageIO.read(url); // this can return null!
+            } catch(MalformedURLException e){
+                System.out.println(e.getMessage());
+            } catch(IOException e){
+                System.out.println(e.getMessage());
+            } catch(Exception e){
+                System.out.println(e.getMessage());
+            }
+
+            if (this.image != null) {
+                this.images.add(this.image);
+                this.imageindex.put(hashkey,this.images.size()-1);
+
+                this.saveimage(file,this.image);
+            }
+        }
+
+        this.imagex = bottom_left_xy[0];
+        this.imagey = bottom_left_xy[1];
+
+        if(this.image == null){
+            throw new LakewalkerException(tr("Could not acquire image"));
+        }
+
+        setStatus(status);
+
+        return this.image;
+    }
+
+    public void saveimage(File file, BufferedImage image){
         /**
          * Save the image to the cache
          */
         try {
-        	ImageIO.write(image, "png", file);
-        	System.out.println("Saved image to cache");
+            ImageIO.write(image, "png", file);
+            System.out.println("Saved image to cache");
         } catch(Exception e){
-        	System.out.println(e.getMessage());
-        }
-	}
-	
-	public int getPixel(int x, int y) throws LakewalkerException{
-
-		// Get the previously shown text
-		
-		
-		BufferedImage image = null;
-
-		try {
-			image = this.getTile(x,y);
-		} catch(LakewalkerException e){
-			System.out.println(e.getError());
-			throw new LakewalkerException(e.getMessage());			
-		}
-	
-		int tx = floor(x,this.tilesize);
-		int ty = floor(y,this.tilesize);
-				
-		int pixel_x = (x-tx);
-		int pixel_y = (this.tilesize-1)-(y-ty);
-					
-		//System.out.println("("+x+","+y+") maps to ("+pixel_x+","+pixel_y+") by ("+tx+", "+ty+")");
-		
-		int rgb = image.getRGB(pixel_x,pixel_y);
-		
-		int pixel;
-		
-		int r = (rgb >> 16) & 0xff;
+            System.out.println(e.getMessage());
+        }
+    }
+
+    public int getPixel(int x, int y) throws LakewalkerException{
+
+        // Get the previously shown text
+
+
+        BufferedImage image = null;
+
+        try {
+            image = this.getTile(x,y);
+        } catch(LakewalkerException e){
+            System.out.println(e.getError());
+            throw new LakewalkerException(e.getMessage());
+        }
+
+        int tx = floor(x,this.tilesize);
+        int ty = floor(y,this.tilesize);
+
+        int pixel_x = (x-tx);
+        int pixel_y = (this.tilesize-1)-(y-ty);
+
+        //System.out.println("("+x+","+y+") maps to ("+pixel_x+","+pixel_y+") by ("+tx+", "+ty+")");
+
+        int rgb = image.getRGB(pixel_x,pixel_y);
+
+        int pixel;
+
+        int r = (rgb >> 16) & 0xff;
         int g = (rgb >>  8) & 0xff;
         int b = (rgb >>  0) & 0xff;
 
         pixel = (int)((0.30 * r) + (0.59 * b) + (0.11 * g));
-                
-		return pixel; 
-	}
-	
-	public int floor(int num, int precision){
-		double dnum = num/(double)precision;
-		BigDecimal val = new BigDecimal(dnum) ;
-		val = val.setScale(0, BigDecimal.ROUND_FLOOR);
-		return val.intValue()*precision;
-	}
-	
-	public double floor(double num) {
-		BigDecimal val = new BigDecimal(num) ;
-		val = val.setScale(0, BigDecimal.ROUND_FLOOR);
-		return val.doubleValue() ;
-	}
-	
-	public double[] xy_to_geo(int x, int y, double resolution){
-		double[] geo = new double[2];
-	    geo[0] = y / resolution;
-	    geo[1] = x / resolution;
-	    return geo;
-	}
-	
-	public int[] geo_to_xy(double lat, double lon, double resolution){
-		int[] xy = new int[2];
-		
-		xy[0] = (int)Math.floor(lon * resolution + 0.5);
-		xy[1] = (int)Math.floor(lat * resolution + 0.5);
-				
-		return xy;
-	}
-	
-	private void printarr(int[] a){
-		for(int i = 0; i<a.length; i++){
-			System.out.println(i+": "+a[i]);
-		}
-	}
-	protected void setStatus(String s) {
-		Main.pleaseWaitDlg.currentAction.setText(s);
-		Main.pleaseWaitDlg.repaint();
-	}
-	protected String getStatus(){
-		return Main.pleaseWaitDlg.currentAction.getText();
-	}
+
+        return pixel;
+    }
+
+    public int floor(int num, int precision){
+        double dnum = num/(double)precision;
+        BigDecimal val = new BigDecimal(dnum) ;
+        val = val.setScale(0, BigDecimal.ROUND_FLOOR);
+        return val.intValue()*precision;
+    }
+
+    public double floor(double num) {
+        BigDecimal val = new BigDecimal(num) ;
+        val = val.setScale(0, BigDecimal.ROUND_FLOOR);
+        return val.doubleValue() ;
+    }
+
+    public double[] xy_to_geo(int x, int y, double resolution){
+        double[] geo = new double[2];
+        geo[0] = y / resolution;
+        geo[1] = x / resolution;
+        return geo;
+    }
+
+    public int[] geo_to_xy(double lat, double lon, double resolution){
+        int[] xy = new int[2];
+
+        xy[0] = (int)Math.floor(lon * resolution + 0.5);
+        xy[1] = (int)Math.floor(lat * resolution + 0.5);
+
+        return xy;
+    }
+
+    private void printarr(int[] a){
+        for(int i = 0; i<a.length; i++){
+            System.out.println(i+": "+a[i]);
+        }
+    }
+    protected void setStatus(String s) {
+        Main.pleaseWaitDlg.currentAction.setText(s);
+        Main.pleaseWaitDlg.repaint();
+    }
+    protected String getStatus(){
+        return Main.pleaseWaitDlg.currentAction.getText();
+    }
 }
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java	(revision 12777)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java	(revision 12778)
@@ -96,9 +96,9 @@
 
   public void setValidValues(String[] s) {
-  	validValues = s;
-  	if (box == null) {
-  	  getControls();
-  	}
-	box.setModel(new DefaultComboBoxModel(validValues));
+    validValues = s;
+    if (box == null) {
+      getControls();
+    }
+    box.setModel(new DefaultComboBoxModel(validValues));
   }
   
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsAcquirer.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsAcquirer.java	(revision 12777)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsAcquirer.java	(revision 12778)
@@ -18,50 +18,50 @@
 
 public class LiveGpsAcquirer implements Runnable {
-	Socket gpsdSocket;
-	BufferedReader gpsdReader;
-	boolean connected = false;
-	String gpsdHost = "localhost";
-	int gpsdPort = 2947;
-	String configFile = "liveGPS.conf";
-	boolean shutdownFlag = false;
+    Socket gpsdSocket;
+    BufferedReader gpsdReader;
+    boolean connected = false;
+    String gpsdHost = "localhost";
+    int gpsdPort = 2947;
+    String configFile = "liveGPS.conf";
+    boolean shutdownFlag = false;
     private List<PropertyChangeListener> propertyChangeListener = new ArrayList<PropertyChangeListener>();
     private PropertyChangeEvent lastStatusEvent;
     private PropertyChangeEvent lastDataEvent;
-	
-	public LiveGpsAcquirer(String pluginDir) {
-				
-		Properties liveGPSconfig = new Properties();
-		
-		FileInputStream fis = null;
-				
-		try {
-			fis = new FileInputStream(pluginDir + configFile);
-		} catch (FileNotFoundException e) {
-			System.err.println("No liveGPS.conf found, using defaults");
-		}
-		
-		if(fis != null)
-		{		
-			try {
-				liveGPSconfig.load(fis);
-				this.gpsdHost = liveGPSconfig.getProperty("host");
-				this.gpsdPort = Integer.parseInt(liveGPSconfig.getProperty("port"));
-				
-			} catch (IOException e) {
-				System.err.println("Error while loading liveGPS.conf, using defaults");
-			}
-			
-			if(this.gpsdHost == null || this.gpsdPort == 0)
-			{
-				System.err.println("Error in liveGPS.conf, using defaults");
-				this.gpsdHost = "localhost";
-				this.gpsdPort = 2947;
-			}
-		}
-		
-	}
-    
-    /**
-     * Adds a property change listener to the acquirer. 
+
+    public LiveGpsAcquirer(String pluginDir) {
+
+        Properties liveGPSconfig = new Properties();
+
+        FileInputStream fis = null;
+
+        try {
+            fis = new FileInputStream(pluginDir + configFile);
+        } catch (FileNotFoundException e) {
+            System.err.println("No liveGPS.conf found, using defaults");
+        }
+
+        if(fis != null)
+        {
+            try {
+                liveGPSconfig.load(fis);
+                this.gpsdHost = liveGPSconfig.getProperty("host");
+                this.gpsdPort = Integer.parseInt(liveGPSconfig.getProperty("port"));
+
+            } catch (IOException e) {
+                System.err.println("Error while loading liveGPS.conf, using defaults");
+            }
+
+            if(this.gpsdHost == null || this.gpsdPort == 0)
+            {
+                System.err.println("Error in liveGPS.conf, using defaults");
+                this.gpsdHost = "localhost";
+                this.gpsdPort = 2947;
+            }
+        }
+
+    }
+
+    /**
+     * Adds a property change listener to the acquirer.
      * @param listener the new listener
      */
@@ -71,5 +71,5 @@
         }
     }
-    
+
     /**
      * Fire a gps status change event. Fires events with key "gpsstatus" and a {@link LiveGpsStatus}
@@ -87,5 +87,5 @@
 
     /**
-     * Fire a gps data change event to all listeners. Fires events with key "gpsdata" and a 
+     * Fire a gps data change event to all listeners. Fires events with key "gpsdata" and a
      * {@link LiveGpsData} object as values.
      * @param oldData the old gps data.
@@ -99,5 +99,5 @@
         }
     }
-    
+
     /**
      * Fires the given event to all listeners.
@@ -107,44 +107,44 @@
         for (PropertyChangeListener listener : propertyChangeListener) {
             listener.propertyChange(event);
-        }        
-    }
-
-	public void run() {	
-	    LiveGpsData oldGpsData = null;
-	    LiveGpsData gpsData = null;
+        }
+    }
+
+    public void run() {
+        LiveGpsData oldGpsData = null;
+        LiveGpsData gpsData = null;
         shutdownFlag = false;
-		while(!shutdownFlag) {
-			double lat = 0;
-			double lon = 0;
+        while(!shutdownFlag) {
+            double lat = 0;
+            double lon = 0;
             float speed = 0;
             float course = 0;
-			boolean haveFix = false;
-
-			try
-			{
-				if (!connected)
-				{
-				    System.out.println("LiveGps tries to connect to gpsd");
+            boolean haveFix = false;
+
+            try
+            {
+                if (!connected)
+                {
+                    System.out.println("LiveGps tries to connect to gpsd");
                     fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTING, tr("Connecting"));
-					InetAddress[] addrs = InetAddress.getAllByName(gpsdHost);
-					for (int i=0; i < addrs.length && gpsdSocket == null; i++) {
-						try {
-							gpsdSocket = new Socket(addrs[i], gpsdPort);
-							break;
-						} catch (Exception e) {
-							System.out.println("LiveGps: Could not open connection to gpsd: " + e);
-							gpsdSocket = null;
-						}
-					}
-					
-					if (gpsdSocket != null)
-					{
-						gpsdReader = new BufferedReader(new InputStreamReader(gpsdSocket.getInputStream()));
-						gpsdSocket.getOutputStream().write(new byte[] { 'w', 13, 10 });
+                    InetAddress[] addrs = InetAddress.getAllByName(gpsdHost);
+                    for (int i=0; i < addrs.length && gpsdSocket == null; i++) {
+                        try {
+                            gpsdSocket = new Socket(addrs[i], gpsdPort);
+                            break;
+                        } catch (Exception e) {
+                            System.out.println("LiveGps: Could not open connection to gpsd: " + e);
+                            gpsdSocket = null;
+                        }
+                    }
+
+                    if (gpsdSocket != null)
+                    {
+                        gpsdReader = new BufferedReader(new InputStreamReader(gpsdSocket.getInputStream()));
+                        gpsdSocket.getOutputStream().write(new byte[] { 'w', 13, 10 });
                         fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTING, tr("Connecting"));
-						connected = true;
-					System.out.println("LiveGps: Connected to gpsd");
-					}
-				}
+                        connected = true;
+                    System.out.println("LiveGps: Connected to gpsd");
+                    }
+                }
 
 
@@ -153,5 +153,5 @@
                     // TODO this read is blocking if gps is connected but has no fix, so gpsd does not send positions
                     String line = gpsdReader.readLine();
-                    // </FIXXME> 
+                    // </FIXXME>
                     if (line == null) break;
                     String words[] = line.split(",");
@@ -189,5 +189,5 @@
                             }
                             break;
-                        case 'P':	
+                        case 'P':
                             // position report, tab delimited.
                             String[] pos = value.split("\\s+");
@@ -217,33 +217,33 @@
                     try { Thread.sleep(1000); } catch (InterruptedException ignore) {};
                 }
-			} catch(IOException iox) {
-				connected = false;
-				if(gpsData != null) {
-				    gpsData.setFix(false);
-				    fireGpsDataChangeEvent(oldGpsData, gpsData);
-				}
+            } catch(IOException iox) {
+                connected = false;
+                if(gpsData != null) {
+                    gpsData.setFix(false);
+                    fireGpsDataChangeEvent(oldGpsData, gpsData);
+                }
                 fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTION_FAILED, tr("Connection Failed"));
-				try { Thread.sleep(1000); } catch (InterruptedException ignore) {};
-				// send warning to layer
-
-			}
-		}
-    
+                try { Thread.sleep(1000); } catch (InterruptedException ignore) {};
+                // send warning to layer
+
+            }
+        }
+
     fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.DISCONNECTED, tr("Not connected"));
-		if (gpsdSocket != null) {
-      try { 
-        gpsdSocket.close(); 
+        if (gpsdSocket != null) {
+      try {
+        gpsdSocket.close();
         gpsdSocket = null;
-  			System.out.println("LiveGps: Disconnected from gpsd");
-      } 
+            System.out.println("LiveGps: Disconnected from gpsd");
+      }
       catch (Exception e) {
         System.out.println("LiveGps: Unable to close socket; reconnection may not be possible");
       };
-	  }
+      }
   }
-	
-	public void shutdown()
-	{
-		shutdownFlag = true;
-	}
+
+    public void shutdown()
+    {
+        shutdownFlag = true;
+    }
 }
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsData.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsData.java	(revision 12777)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsData.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package livegps;
@@ -22,5 +22,5 @@
     private String wayString;
     private Way way;
-    
+
     /**
      * @param latitude
@@ -38,5 +38,5 @@
     }
     /**
-     * 
+     *
      */
     public LiveGpsData() {
@@ -91,5 +91,5 @@
         this.speed = speed;
     }
-    
+
     /**
      * @return the latlon
@@ -98,5 +98,5 @@
         return this.latLon;
     }
-    
+
     /**
      * @param latLon
@@ -105,15 +105,15 @@
         this.latLon = latLon;
     }
-    
+
     public String toString() {
-        return getClass().getSimpleName() + "[fix=" + fix + ", lat=" + latLon.lat() 
+        return getClass().getSimpleName() + "[fix=" + fix + ", lat=" + latLon.lat()
         + ", long=" + latLon.lon() + ", speed=" + speed + ", course=" + course + "]";
-        
-    }
-    
+
+    }
+
     /**
      * Returns the name of the way that is closest to the current coordinates or an
      * empty string if no way is around.
-     * 
+     *
      * @return the name of the way that is closest to the current coordinates.
      */
@@ -156,5 +156,5 @@
         return wayString;
     }
-    
+
     /**
      * Returns the closest way to this position.
@@ -163,12 +163,12 @@
     public Way getWay() {
         if(way == null) {
-            EastNorth eastnorth = Main.proj.latlon2eastNorth(getLatLon()); 
-            Point xy = Main.map.mapView.getPoint(eastnorth); 
+            EastNorth eastnorth = Main.proj.latlon2eastNorth(getLatLon());
+            Point xy = Main.map.mapView.getPoint(eastnorth);
             way = Main.map.mapView.getNearestWay(xy);
         }
         return way;
-        
-    }
-    
+
+    }
+
     /* (non-Javadoc)
      * @see java.lang.Object#hashCode()
@@ -207,5 +207,5 @@
     }
 
-    
-    
+
+
 }
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsDialog.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsDialog.java	(revision 12777)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsDialog.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package livegps;
@@ -62,5 +62,5 @@
         add(new JScrollPane(panel), BorderLayout.CENTER);
     }
-    
+
     /* (non-Javadoc)
      * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
@@ -79,5 +79,5 @@
                 speedLabel.setText((Math.round(mySpeed*100)/100) + "km/h"); // m(s to km/h
                 courseLabel.setText(data.getCourse() + "deg");
-                
+
                 String wayString = data.getWayInfo();
                 if(wayString.length() > 0) {
@@ -86,5 +86,5 @@
                     wayLabel.setText("unknown");
                 }
-                
+
             } else {
 //                fixLabel.setText("no fix");
@@ -101,11 +101,8 @@
                 panel.setBackground(Color.RED);
             } else {
-                panel.setBackground(Color.WHITE);                
+                panel.setBackground(Color.WHITE);
             }
         }
-        
+
     }
-
-
-
 }
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsLayer.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsLayer.java	(revision 12778)
@@ -25,113 +25,113 @@
     public static final String LAYER_NAME = tr("LiveGPS layer");
     public static final String KEY_LIVEGPS_COLOR ="color.livegps.position";
-	LatLon lastPos;
-	WayPoint lastPoint;
-	GpxTrack trackBeingWritten;
-	Collection<WayPoint> trackSegment;
-	float speed;
-	float course;
-	String status;
-	//JLabel lbl;
-	boolean autocenter;
-	private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
-	
-	public LiveGpsLayer(GpxData data)
-	{
-		super (data, LAYER_NAME);
-		trackBeingWritten = new GpxTrack();
-		trackBeingWritten.attr.put("desc", "josm live gps");
-		trackSegment = new ArrayList<WayPoint>();
-		trackBeingWritten.trackSegs.add(trackSegment);
-		data.tracks.add(trackBeingWritten);
-	}
-	
-	void setCurrentPosition(double lat, double lon)
-	{
-	    //System.out.println("adding pos " + lat + "," + lon);
-		LatLon thisPos = new LatLon(lat, lon);
-		if ((lastPos != null) && (thisPos.equalsEpsilon(lastPos))) {
-			// no change in position
-			// maybe show a "paused" cursor or some such
-			return;
-		}
-			
-		lastPos = thisPos;
-		lastPoint = new WayPoint(thisPos);
-		lastPoint.attr.put("time", dateFormat.format(new Date()));
-		// synchronize when adding data, as otherwise the autosave action
-		// needs concurrent access and this results in an exception!
-		synchronized (LiveGpsLock.class) {
-		    trackSegment.add(lastPoint);            
+    LatLon lastPos;
+    WayPoint lastPoint;
+    GpxTrack trackBeingWritten;
+    Collection<WayPoint> trackSegment;
+    float speed;
+    float course;
+    String status;
+    //JLabel lbl;
+    boolean autocenter;
+    private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
+
+    public LiveGpsLayer(GpxData data)
+    {
+        super (data, LAYER_NAME);
+        trackBeingWritten = new GpxTrack();
+        trackBeingWritten.attr.put("desc", "josm live gps");
+        trackSegment = new ArrayList<WayPoint>();
+        trackBeingWritten.trackSegs.add(trackSegment);
+        data.tracks.add(trackBeingWritten);
+    }
+
+    void setCurrentPosition(double lat, double lon)
+    {
+        //System.out.println("adding pos " + lat + "," + lon);
+        LatLon thisPos = new LatLon(lat, lon);
+        if ((lastPos != null) && (thisPos.equalsEpsilon(lastPos))) {
+            // no change in position
+            // maybe show a "paused" cursor or some such
+            return;
         }
-		if (autocenter) {
-		    center();
-		}
-		
-		//Main.map.repaint();
-	}
 
-	public void center()
-	{
-		if (lastPoint != null) 
-			Main.map.mapView.zoomTo(lastPoint.eastNorth, Main.map.mapView.getScale());
-	}
-	
-//	void setStatus(String status)
-//	{
-//		this.status = status;
-//		Main.map.repaint();
+        lastPos = thisPos;
+        lastPoint = new WayPoint(thisPos);
+        lastPoint.attr.put("time", dateFormat.format(new Date()));
+        // synchronize when adding data, as otherwise the autosave action
+        // needs concurrent access and this results in an exception!
+        synchronized (LiveGpsLock.class) {
+            trackSegment.add(lastPoint);
+        }
+        if (autocenter) {
+            center();
+        }
+
+        //Main.map.repaint();
+    }
+
+    public void center()
+    {
+        if (lastPoint != null)
+            Main.map.mapView.zoomTo(lastPoint.eastNorth, Main.map.mapView.getScale());
+    }
+
+//  void setStatus(String status)
+//  {
+//      this.status = status;
+//      Main.map.repaint();
 //        System.out.println("LiveGps status: " + status);
-//	}
-	
-	void setSpeed(float metresPerSecond)
-	{
-		speed = metresPerSecond;
-		//Main.map.repaint();
-	}
+//  }
 
-	void setCourse(float degrees)
-	{
-		course = degrees;
-		//Main.map.repaint();
-	}
-	
-	public void setAutoCenter(boolean ac)
-	{
-		autocenter = ac;
-	}
+    void setSpeed(float metresPerSecond)
+    {
+        speed = metresPerSecond;
+        //Main.map.repaint();
+    }
 
-	@Override public void paint(Graphics g, MapView mv)
-	{
-	    //System.out.println("in paint");
-	    synchronized (LiveGpsLock.class) {
-	        //System.out.println("in synced paint");
-	        super.paint(g, mv);
-//	        int statusHeight = 50;
-//	        Rectangle mvs = mv.getBounds();
-//	        mvs.y = mvs.y + mvs.height - statusHeight;
-//	        mvs.height = statusHeight;
-//	        g.setColor(new Color(1.0f, 1.0f, 1.0f, 0.8f)); 
-//	        g.fillRect(mvs.x, mvs.y, mvs.width, mvs.height);
+    void setCourse(float degrees)
+    {
+        course = degrees;
+        //Main.map.repaint();
+    }
 
-	        if (lastPoint != null)
-	        {
-	            Point screen = mv.getPoint(lastPoint.eastNorth);
-	            g.setColor(Main.pref.getColor(KEY_LIVEGPS_COLOR, Color.RED));
-	            g.drawOval(screen.x-10, screen.y-10,20,20);
-	            g.drawOval(screen.x-9, screen.y-9,18,18);
-	        }
+    public void setAutoCenter(boolean ac)
+    {
+        autocenter = ac;
+    }
 
-//	        lbl.setText("gpsd: "+status+" Speed: " + speed + " Course: "+course);
-//	        lbl.setBounds(0, 0, mvs.width-10, mvs.height-10);
-//	        Graphics sub = g.create(mvs.x+5, mvs.y+5, mvs.width-10, mvs.height-10);
-//	        lbl.paint(sub);
+    @Override public void paint(Graphics g, MapView mv)
+    {
+        //System.out.println("in paint");
+        synchronized (LiveGpsLock.class) {
+            //System.out.println("in synced paint");
+            super.paint(g, mv);
+//          int statusHeight = 50;
+//          Rectangle mvs = mv.getBounds();
+//          mvs.y = mvs.y + mvs.height - statusHeight;
+//          mvs.height = statusHeight;
+//          g.setColor(new Color(1.0f, 1.0f, 1.0f, 0.8f));
+//          g.fillRect(mvs.x, mvs.y, mvs.width, mvs.height);
 
-//	        if(status != null) {
-//	        g.setColor(Color.WHITE);
-//	        g.drawString("gpsd: " + status, 5, mv.getBounds().height - 15); // lower left corner
-//	        }
-	    }
-	}
-    
+            if (lastPoint != null)
+            {
+                Point screen = mv.getPoint(lastPoint.eastNorth);
+                g.setColor(Main.pref.getColor(KEY_LIVEGPS_COLOR, Color.RED));
+                g.drawOval(screen.x-10, screen.y-10,20,20);
+                g.drawOval(screen.x-9, screen.y-9,18,18);
+            }
+
+//          lbl.setText("gpsd: "+status+" Speed: " + speed + " Course: "+course);
+//          lbl.setBounds(0, 0, mvs.width-10, mvs.height-10);
+//          Graphics sub = g.create(mvs.x+5, mvs.y+5, mvs.width-10, mvs.height-10);
+//          lbl.paint(sub);
+
+//          if(status != null) {
+//          g.setColor(Color.WHITE);
+//          g.drawString("gpsd: " + status, 5, mv.getBounds().height - 15); // lower left corner
+//          }
+        }
+    }
+
     /* (non-Javadoc)
      * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
@@ -154,5 +154,5 @@
             }
         }
-        
+
     }
 
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsLock.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsLock.java	(revision 12777)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsLock.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package livegps;
@@ -8,5 +8,5 @@
  * read or write live gps data must synchronize to this class. Especially the save action
  * takes quite long, so concurrency problems occur.
- * 
+ *
  * @author cdaller
  *
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsPlugin.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsPlugin.java	(revision 12778)
@@ -24,6 +24,6 @@
 public class LiveGpsPlugin extends Plugin
 {
-	private LiveGpsAcquirer acquirer = null;
-	private Thread acquirerThread = null;
+    private LiveGpsAcquirer acquirer = null;
+    private Thread acquirerThread = null;
     private JMenu lgpsmenu;
     private JCheckBoxMenuItem lgpscapture;
@@ -32,9 +32,9 @@
     private LiveGpsDialog lgpsdialog;
     List<PropertyChangeListener>listenerQueue;
-        
-	private GpxData data = new GpxData();
+
+    private GpxData data = new GpxData();
     private LiveGpsLayer lgpslayer;
-    
-	
+
+
     public class CaptureAction extends JosmAction {
         public CaptureAction() {
@@ -77,5 +77,5 @@
     }
 
-    public LiveGpsPlugin() 
+    public LiveGpsPlugin()
     {
         MainMenu menu = Main.main.menu;
@@ -111,5 +111,5 @@
         }
     }
-    
+
     /**
      * Returns <code>true</code> if autocenter is selected.
@@ -119,5 +119,5 @@
         return lgpsautocenter.isSelected();
     }
-    
+
     /**
      * Enable or disable gps tracking
@@ -155,6 +155,6 @@
         }
     }
-    
-    
+
+
     /**
      * Add a listener for gps events.
Index: /applications/editors/josm/plugins/livegps/livegps/LiveGpsStatus.java
===================================================================
--- /applications/editors/josm/plugins/livegps/livegps/LiveGpsStatus.java	(revision 12777)
+++ /applications/editors/josm/plugins/livegps/livegps/LiveGpsStatus.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package livegps;
Index: /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
===================================================================
--- /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java	(revision 12777)
+++ /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java	(revision 12778)
@@ -34,7 +34,7 @@
 public class MeasurementDialog extends ToggleDialog implements ActionListener
 {
-	private static final long serialVersionUID = 4708541586297950021L;
+    private static final long serialVersionUID = 4708541586297950021L;
 
-	/** 
+    /**
      * The reset button
      */
@@ -64,5 +64,5 @@
      * Constructor
      */
-    public MeasurementDialog() 
+    public MeasurementDialog()
     {
         super(tr("Measured values"), "measure", tr("Open the measurement window."),
@@ -78,41 +78,41 @@
 
         JPanel valuePanel = new JPanel(new GridLayout(0,2));
-        
+
         valuePanel.add(new JLabel(tr("Path Length")));
-        
+
         pathLengthLabel = new JLabel("0 m");
         valuePanel.add(pathLengthLabel);
-        
+
         valuePanel.add(new JLabel(tr("Selection Length")));
-        
+
         selectLengthLabel = new JLabel("0 m");
         valuePanel.add(selectLengthLabel);
 
         valuePanel.add(new JLabel(tr("Selection Area")));
-        
+
         selectAreaLabel = new JLabel("0 m\u00b2");
         valuePanel.add(selectAreaLabel);
-        
+
         JLabel angle = new JLabel(tr("Angle"));
         angle.setToolTipText(tr("Angle between two selected Nodes"));
         valuePanel.add(angle);
-        
+
         segAngleLabel = new JLabel("- \u00b0");
         valuePanel.add(segAngleLabel);
-        
+
         add(valuePanel, BorderLayout.CENTER);
 
         this.setPreferredSize(new Dimension(0, 92));
         final MeasurementDialog dlg = this;
-       //TODO: is this enough? 
+       //TODO: is this enough?
 
         Main.ds.selListeners.add(new SelectionChangedListener(){
 
-			public void selectionChanged(Collection<? extends OsmPrimitive> arg0) {
-				double length = 0.0;
-				double segAngle = 0.0;
+            public void selectionChanged(Collection<? extends OsmPrimitive> arg0) {
+                double length = 0.0;
+                double segAngle = 0.0;
                                 double area = 0.0;
                                 Node lastNode = null;
-				for(OsmPrimitive p:arg0){
+                for(OsmPrimitive p:arg0){
                                     if(p instanceof Node){
                                         Node n =(Node)p;
@@ -132,5 +132,5 @@
                                                 //http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/
                                                 area += (MeasurementLayer.calcX(n.coor) * MeasurementLayer.calcY(lastN.coor))
-						      - (MeasurementLayer.calcY(n.coor) * MeasurementLayer.calcX(lastN.coor));
+                              - (MeasurementLayer.calcY(n.coor) * MeasurementLayer.calcX(lastN.coor));
                                             }
                                             lastN = n;
@@ -142,27 +142,27 @@
                                         }
                                     }
-				}
-				dlg.selectLengthLabel.setText(new DecimalFormat("#0.00").format(length) + " m");
+                }
+                dlg.selectLengthLabel.setText(new DecimalFormat("#0.00").format(length) + " m");
 
-				dlg.segAngleLabel.setText(new DecimalFormat("#0.0").format(segAngle) + " \u00b0");		
- 				dlg.selectAreaLabel.setText(new DecimalFormat("#0.00").format(area) + " m\u00b2");
-			}
-		});
-	}
+                dlg.segAngleLabel.setText(new DecimalFormat("#0.0").format(segAngle) + " \u00b0");
+                dlg.selectAreaLabel.setText(new DecimalFormat("#0.00").format(area) + " m\u00b2");
+            }
+        });
+    }
 
-	public void actionPerformed(ActionEvent e) 
-	{
-		String actionCommand = e.getActionCommand();
-		if( actionCommand.equals("Reset")){
-			resetValues();
-		}
-	}
-    
-	/**
-	 * Cleans the active Meausurement Layer
-	 */
-	public void resetValues(){
-		MeasurementPlugin.getCurrentLayer().reset();
-	}
-	
+    public void actionPerformed(ActionEvent e)
+    {
+        String actionCommand = e.getActionCommand();
+        if( actionCommand.equals("Reset")){
+            resetValues();
+        }
+    }
+
+    /**
+     * Cleans the active Meausurement Layer
+     */
+    public void resetValues(){
+        MeasurementPlugin.getCurrentLayer().reset();
+    }
+
 }
Index: /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java
===================================================================
--- /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java	(revision 12778)
@@ -1,4 +1,4 @@
 package org.openstreetmap.josm.plugins.measurement;
-/// @author Raphael Mack <ramack@raphael-mack.de> 
+/// @author Raphael Mack <ramack@raphael-mack.de>
 import static org.openstreetmap.josm.tools.I18n.tr;
 
@@ -53,16 +53,16 @@
  */
 public class MeasurementLayer extends Layer {
-	
+
     public MeasurementLayer(String arg0) {
         super(arg0);
     }
 
-    private static Icon icon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(MeasurementPlugin.class.getResource("/images/measurement.png")));	
+    private static Icon icon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(MeasurementPlugin.class.getResource("/images/measurement.png")));
     private Collection<WayPoint> points = new ArrayList<WayPoint>(32);
-	
+
     @Override public Icon getIcon() {
         return icon;
     }
-	
+
     @Override public String getToolTipText() {
         return tr("Layer to make measurements");
@@ -76,5 +76,5 @@
     @Override public void mergeFrom(Layer from) {
         // TODO: nyi - doubts about how this should be done are around. Ideas?
-	
+
     }
 
@@ -110,5 +110,5 @@
             new JMenuItem(new LayerListPopup.InfoAction(this))};
     }
-	
+
     public void removeLastPoint(){
         WayPoint l = null;
@@ -116,11 +116,11 @@
         if(l != null) points.remove(l);
         recalculate();
-        Main.map.repaint();	
-    }
-	
-    public void mouseClicked(MouseEvent e){		
+        Main.map.repaint();
+    }
+
+    public void mouseClicked(MouseEvent e){
         if (e.getButton() != MouseEvent.BUTTON1) return;
 
-        LatLon coor = Main.map.mapView.getLatLon(e.getX(), e.getY());		
+        LatLon coor = Main.map.mapView.getLatLon(e.getX(), e.getY());
         points.add(new WayPoint(coor));
 
@@ -132,11 +132,11 @@
         points.clear();
         recalculate();
-        Main.map.repaint();		
-    }
-	
+        Main.map.repaint();
+    }
+
     private void recalculate(){
         double pathLength = 0.0, segLength = 0.0; // in meters
         WayPoint last = null;
-		
+
         pathLength = 0.0;
         for(WayPoint p : points){
@@ -151,9 +151,9 @@
         MeasurementPlugin.measurementDialog.pathLengthLabel.setText(pathLength < 800?nf2.format(pathLength) + " m":nf.format(pathLength/1000) + " km");
     }
-	
+
     public static double calcDistance(LatLon p1, LatLon p2){
         double lat1, lon1, lat2, lon2;
         double dlon, dlat;
-	    
+
         lat1 = p1.lat() * Math.PI / 180.0;
         lon1 = p1.lon() * Math.PI / 180.0;
@@ -172,5 +172,5 @@
         double lat1, lon1, lat2, lon2;
         double dlon, dlat;
-	    
+
         lat1 = p1.lat() * Math.PI / 180.0;
         lon1 = p1.lon() * Math.PI / 180.0;
@@ -185,9 +185,9 @@
         return 6367000 * c;
     }
-	
+
     public static double calcY(LatLon p1){
         double lat1, lon1, lat2, lon2;
         double dlon, dlat;
-	    
+
         lat1 = p1.lat() * Math.PI / 180.0;
         lon1 = p1.lon() * Math.PI / 180.0;
@@ -202,18 +202,18 @@
         return 6367000 * c;
     }
-	
+
     public static double calcDistance(WayPoint p1, WayPoint p2){
         return calcDistance(p1.latlon, p2.latlon);
     }
-	
+
     public static double angleBetween(WayPoint p1, WayPoint p2){
         return angleBetween(p1.latlon, p2.latlon);
     }
-	
+
     public static double angleBetween(LatLon p1, LatLon p2){
         double lat1, lon1, lat2, lon2;
         double dlon;
         double heading;
-	    
+
         lat1 = p1.lat() * Math.PI / 180.0;
         lon1 = p1.lon() * Math.PI / 180.0;
@@ -223,8 +223,8 @@
         dlon = lon2 - lon1;
         double coslat2 = Math.cos(lat2);
-        
+
         return (180 * Math.atan2(coslat2 * Math.sin(dlon),
                           (Math.cos(lat1) * Math.sin(lat2)
-                                    - 
+                                    -
                            Math.sin(lat1) * coslat2 * Math.cos(dlon)))) / Math.PI;
     }
@@ -234,5 +234,5 @@
         double dlon, dlat;
         double heading;
-	    
+
         lat1 = p1.lat() * Math.PI / 180.0;
         lon1 = p1.lon() * Math.PI / 180.0;
@@ -250,5 +250,5 @@
             heading = 2 * Math.PI - heading;
         }
- 
+
         return heading * 180 / Math.PI;
     }
@@ -257,34 +257,34 @@
     private class GPXLayerImportAction extends AbstractAction {
 
-	private MeasurementLayer layer;
-
-	/**
-	 * The data model for the list component.
-	 */
-	private DefaultListModel model = new DefaultListModel();
-
-	/**
-	 * @param layer the targeting measurement layer
-	 */
-	public GPXLayerImportAction(MeasurementLayer layer) {
-	    super(tr("Import path from GPX layer"), ImageProvider.get("dialogs", "edit")); // TODO: find better image
-	    this.layer = layer;
-	}
-
-	public void actionPerformed(ActionEvent e) {
-	    Box panel = Box.createVerticalBox();
-	    final JList layerList = new JList(model);
-	    Collection<Layer> data = Main.map.mapView.getAllLayers();
-	    Layer lastLayer = null;
-	    int layerCnt = 0;
-	    
-	    for (Layer l : data){
-                if(l instanceof GpxLayer){    
+    private MeasurementLayer layer;
+
+    /**
+     * The data model for the list component.
+     */
+    private DefaultListModel model = new DefaultListModel();
+
+    /**
+     * @param layer the targeting measurement layer
+     */
+    public GPXLayerImportAction(MeasurementLayer layer) {
+        super(tr("Import path from GPX layer"), ImageProvider.get("dialogs", "edit")); // TODO: find better image
+        this.layer = layer;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        Box panel = Box.createVerticalBox();
+        final JList layerList = new JList(model);
+        Collection<Layer> data = Main.map.mapView.getAllLayers();
+        Layer lastLayer = null;
+        int layerCnt = 0;
+
+        for (Layer l : data){
+                if(l instanceof GpxLayer){
                     model.addElement(l);
                     lastLayer = l;
                     layerCnt++;
                 }
-	    }
-	    if(layerCnt == 1){
+        }
+        if(layerCnt == 1){
                 layerList.setSelectedValue(lastLayer, true);
             }
@@ -304,8 +304,8 @@
 
                 JCheckBox dropFirst = new JCheckBox(tr("Drop existing path"));
-	    
+
                 panel.add(layerList);
                 panel.add(dropFirst);
-	    
+
                 final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION){
                         @Override public void selectInitialValue() {
@@ -315,5 +315,5 @@
                 final JDialog dlg = optionPane.createDialog(Main.parent, tr("Import path from GPX layer"));
                 dlg.setVisible(true);
-	
+
                 Object answer = optionPane.getValue();
                 if (answer == null || answer == JOptionPane.UNINITIALIZED_VALUE ||
@@ -326,5 +326,5 @@
                     points = new ArrayList<WayPoint>(32);
                 }
-	    
+
                 for (GpxTrack trk : gpx.data.tracks) {
                     for (Collection<WayPoint> trkseg : trk.trackSegs) {
@@ -333,5 +333,5 @@
                         }
                     }
-	    	}
+            }
                 recalculate();
                 Main.parent.repaint();
Index: /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementMode.java
===================================================================
--- /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementMode.java	(revision 12777)
+++ /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementMode.java	(revision 12778)
@@ -15,40 +15,40 @@
 public class MeasurementMode extends MapMode {
 
-	private static final long serialVersionUID = 3853830673475744263L;
-	
-	public MeasurementMode(MapFrame mapFrame, String name, String desc) {
-		super(name, "measurement.png", desc, mapFrame, Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));		
-	}
+    private static final long serialVersionUID = 3853830673475744263L;
 
-	@Override public void enterMode() {
-		super.enterMode();
-		Main.map.mapView.addMouseListener(this);
-	}
+    public MeasurementMode(MapFrame mapFrame, String name, String desc) {
+        super(name, "measurement.png", desc, mapFrame, Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
+    }
 
-	@Override public void exitMode() {
-		super.exitMode();
-		Main.map.mapView.removeMouseListener(this);
-	}
+    @Override public void enterMode() {
+        super.enterMode();
+        Main.map.mapView.addMouseListener(this);
+    }
 
-	/**
-	 * If user clicked with the left button, add a node at the current mouse
-	 * position.
-	 *
-	 * If in nodesegment mode, add the node to the line segment by splitting the
-	 * segment. The new created segment will be inserted in every way the segment
-	 * was part of.
-	 */
-	@Override public void mouseClicked(MouseEvent e) {
-		if (e.getButton() == MouseEvent.BUTTON3){
-			MeasurementPlugin.getCurrentLayer().removeLastPoint();
-		}else if (e.getButton() == MouseEvent.BUTTON1){
-			LatLon coor = Main.map.mapView.getLatLon(e.getX(), e.getY());
-			if (coor.isOutSideWorld()) {
-				JOptionPane.showMessageDialog(Main.parent,tr("Can not draw outside of the world."));
-				return;
-			}
-			MeasurementPlugin.getCurrentLayer().mouseClicked(e);
-		}
-	}
+    @Override public void exitMode() {
+        super.exitMode();
+        Main.map.mapView.removeMouseListener(this);
+    }
+
+    /**
+     * If user clicked with the left button, add a node at the current mouse
+     * position.
+     *
+     * If in nodesegment mode, add the node to the line segment by splitting the
+     * segment. The new created segment will be inserted in every way the segment
+     * was part of.
+     */
+    @Override public void mouseClicked(MouseEvent e) {
+        if (e.getButton() == MouseEvent.BUTTON3){
+            MeasurementPlugin.getCurrentLayer().removeLastPoint();
+        }else if (e.getButton() == MouseEvent.BUTTON1){
+            LatLon coor = Main.map.mapView.getLatLon(e.getX(), e.getY());
+            if (coor.isOutSideWorld()) {
+                JOptionPane.showMessageDialog(Main.parent,tr("Can not draw outside of the world."));
+                return;
+            }
+            MeasurementPlugin.getCurrentLayer().mouseClicked(e);
+        }
+    }
 
 }
Index: /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.java
===================================================================
--- /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.java	(revision 12778)
@@ -12,40 +12,40 @@
 public class MeasurementPlugin extends Plugin {
 
-	private IconToggleButton btn;
-	private MeasurementMode mode;
-	protected static MeasurementDialog measurementDialog;
-	protected static MeasurementLayer currentLayer;
-	
-	public MeasurementPlugin() {
-		mode = new MeasurementMode(Main.map, "measurement", tr("measurement mode"));
-		btn = new IconToggleButton(mode);
-		btn.setVisible(true);
-		measurementDialog = new MeasurementDialog();
-	}
-	
-	@Override
-	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-		if(newFrame != null)
-			newFrame.addToggleDialog(measurementDialog);
-		if(Main.map != null)
-			Main.map.addMapMode(btn);
-	}
+    private IconToggleButton btn;
+    private MeasurementMode mode;
+    protected static MeasurementDialog measurementDialog;
+    protected static MeasurementLayer currentLayer;
 
-	public static MeasurementLayer getCurrentLayer(){
-		if(currentLayer == null){
-			currentLayer = new MeasurementLayer(tr("Measurements"));
-			Main.main.addLayer(currentLayer);
-			currentLayer.listeners.add(new LayerChangeListener(){
-				public void activeLayerChange(final Layer oldLayer, final Layer newLayer) {
-					if(newLayer instanceof MeasurementLayer)
-						MeasurementPlugin.currentLayer = (MeasurementLayer)newLayer;
-				}
-				public void layerAdded(final Layer newLayer) {
-				}
-				public void layerRemoved(final Layer oldLayer) {
-				}
-			});
-		}
-		return currentLayer;
-	}
+    public MeasurementPlugin() {
+        mode = new MeasurementMode(Main.map, "measurement", tr("measurement mode"));
+        btn = new IconToggleButton(mode);
+        btn.setVisible(true);
+        measurementDialog = new MeasurementDialog();
+    }
+
+    @Override
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+        if(newFrame != null)
+            newFrame.addToggleDialog(measurementDialog);
+        if(Main.map != null)
+            Main.map.addMapMode(btn);
+    }
+
+    public static MeasurementLayer getCurrentLayer(){
+        if(currentLayer == null){
+            currentLayer = new MeasurementLayer(tr("Measurements"));
+            Main.main.addLayer(currentLayer);
+            currentLayer.listeners.add(new LayerChangeListener(){
+                public void activeLayerChange(final Layer oldLayer, final Layer newLayer) {
+                    if(newLayer instanceof MeasurementLayer)
+                        MeasurementPlugin.currentLayer = (MeasurementLayer)newLayer;
+                }
+                public void layerAdded(final Layer newLayer) {
+                }
+                public void layerRemoved(final Layer oldLayer) {
+                }
+            });
+        }
+        return currentLayer;
+    }
 }
Index: /applications/editors/josm/plugins/namefinder/namefinder/NameFinderPlugin.java
===================================================================
--- /applications/editors/josm/plugins/namefinder/namefinder/NameFinderPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/namefinder/namefinder/NameFinderPlugin.java	(revision 12778)
@@ -10,19 +10,19 @@
 /**
  * Main class for the name finder plugin.
- * 
- * 
+ *
+ *
  * @author Frederik Ramm <frederik@remote.org>
  *
  */
-public class NameFinderPlugin extends Plugin 
-{    
-    public NameFinderPlugin() 
+public class NameFinderPlugin extends Plugin
+{
+    public NameFinderPlugin()
     {
     }
-    
-    @Override public void addDownloadSelection(List<DownloadSelection> list) 
+
+    @Override public void addDownloadSelection(List<DownloadSelection> list)
     {
-    	list.add(new PlaceSelection());
+        list.add(new PlaceSelection());
     }
-	
+
 }
Index: /applications/editors/josm/plugins/namefinder/namefinder/PlaceSelection.java
===================================================================
--- /applications/editors/josm/plugins/namefinder/namefinder/PlaceSelection.java	(revision 12777)
+++ /applications/editors/josm/plugins/namefinder/namefinder/PlaceSelection.java	(revision 12778)
@@ -42,281 +42,281 @@
 public class PlaceSelection implements DownloadSelection {
 
-	private JTextField searchTerm = new JTextField();
-	private JButton submitSearch = new JButton(tr("Search..."));
-	private DefaultTableModel searchResults = new DefaultTableModel() {
-		@Override public boolean isCellEditable(int row, int col) { return false; }
-	};
-	private JTable searchResultDisplay = new JTable(searchResults);
-	private boolean updatingSelf;
-	
-	/**
-	 * Data storage for search results.
-	 */
-	class SearchResult 
-	{
-		public String name;
-		public String type;
-		public String nearestPlace;
-		public String description;
-		public double lat;
-		public double lon;
-		public int zoom;
-	}
-	
-	/**
-	 * A very primitive parser for the name finder's output. 
-	 * Structure of xml described here:  http://wiki.openstreetmap.org/index.php/Name_finder
-	 *
-	 */
-	private class Parser extends DefaultHandler
-	{
-		private SearchResult currentResult = null;
-		private StringBuffer description = null;
-		private int depth = 0;
-		/**
-		 * Detect starting elements.
-		 * 
-		 */
-		@Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException 
-		{
-			depth++;
-			try 
-			{
-				if (qName.equals("searchresults")) 
-				{
-					searchResults.setRowCount(0);
-				}
-				else if (qName.equals("named") && (depth == 2))
-				{	
-					currentResult = new PlaceSelection.SearchResult();
-					currentResult.name = atts.getValue("name");
-					currentResult.type = atts.getValue("info");
-					currentResult.lat = Double.parseDouble(atts.getValue("lat"));
-					currentResult.lon = Double.parseDouble(atts.getValue("lon"));
-					currentResult.zoom = Integer.parseInt(atts.getValue("zoom"));
-					searchResults.addRow(new Object[] { currentResult, currentResult, currentResult, currentResult });
-				}
-				else if (qName.equals("description") && (depth == 3))
-				{
-					description = new StringBuffer();
-				}
-				else if (qName.equals("named") && (depth == 4))
-				{
-					// this is a "named" place in the nearest places list.
-					String info = atts.getValue("info");
-					if ("city".equals(info) || "town".equals(info) || "village".equals(info)) {
-						currentResult.nearestPlace = atts.getValue("name");
-					}
-				}
-			}
-			catch (NumberFormatException x) 
-			{
-				x.printStackTrace(); // SAXException does not chain correctly
-				throw new SAXException(x.getMessage(), x);
-			} 
-			catch (NullPointerException x) 
-			{
-				x.printStackTrace(); // SAXException does not chain correctly
-				throw new SAXException(tr("NullPointerException, Possibly some missing tags."), x);
-			}
-		}
-		/** 
-		 * Detect ending elements.
-		 */
-		@Override public void endElement(String namespaceURI, String localName, String qName) throws SAXException
-		{
-
-			if (qName.equals("searchresults")) 
-			{
-			}
-			else if (qName.equals("description") && description != null)
-			{
-				currentResult.description = description.toString();
-				description = null;
-			}
-			depth--;
-
-		}
-		/** 
-		 * Read characters for description.
-		 */
-		@Override public void characters(char[] data, int start, int length) throws org.xml.sax.SAXException
-		{
-			if (description != null) 
-			{
-				description.append(data, start, length);
-			}
-		}
-	}
-	
-	/**
-	 * This queries David Earl's server. Needless to say, stuff should be configurable, and 
-	 * error handling improved.
-	 */
-	public void queryServer(final JComponent component)
-	{
-		final Cursor oldCursor = component.getCursor();
-		
-		// had to put this in a thread as it wouldn't update the cursor properly before.
-		Runnable r = new Runnable() {
-			public void run() {
-				try
-				{
-					String searchtext = searchTerm.getText();
-					if(searchtext.length()==0)
-					{
-						JOptionPane.showMessageDialog(Main.parent,tr("Please enter a search string"));
-					}
-					else
-					{
-						component.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-						component.repaint();
-						URL url = new URL("http://gazetteer.openstreetmap.org/namefinder/search.xml?find="
-						+java.net.URLEncoder.encode(searchTerm.getText(), "UTF-8"));
-						HttpURLConnection activeConnection = (HttpURLConnection)url.openConnection();
-						//System.out.println("got return: "+activeConnection.getResponseCode());
-						activeConnection.setConnectTimeout(15000);
-						InputStream inputStream = activeConnection.getInputStream();
-						InputSource inputSource = new InputSource(new InputStreamReader(inputStream, "UTF-8"));
-						SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new Parser());
-					}
-				}
-				catch (Exception x) 
-				{
-					JOptionPane.showMessageDialog(Main.parent,tr("Cannot read place search results from server"));
-					x.printStackTrace();
-				}
-				component.setCursor(oldCursor);
-			}
-		};
-		new Thread(r).start();
-	}
-	
-	/**
-	 * Adds a new tab to the download dialog in JOSM.
-	 * 
-	 * This method is, for all intents and purposes, the constructor for this class.
-	 */
-	public void addGui(final DownloadDialog gui) {
-		JPanel panel = new JPanel();
-		panel.setLayout(new GridBagLayout());
-		
-		// this is manually tuned so that it looks nice on a GNOME
-		// desktop - maybe needs some cross platform proofing.
-		panel.add(new JLabel(tr("Enter a place name to search for:")), GBC.eol().insets(5, 5, 5, 5));
-		panel.add(searchTerm, GBC.std().fill(GBC.BOTH).insets(5, 0, 5, 4));
-		panel.add(submitSearch, GBC.eol().insets(5, 0, 5, 5));
-		Dimension btnSize = submitSearch.getPreferredSize();
-		btnSize.setSize(btnSize.width, btnSize.height * 0.8);
-		submitSearch.setPreferredSize(btnSize);
-		
-		GBC c = GBC.std().fill().insets(5, 0, 5, 5);
-		c.gridwidth = 2;
-		JScrollPane scrollPane = new JScrollPane(searchResultDisplay);
-		scrollPane.setPreferredSize(new Dimension(200,200));
-		panel.add(scrollPane, c);
-		gui.tabpane.add(panel, tr("Places"));
-		
-		scrollPane.setPreferredSize(scrollPane.getPreferredSize());
-		
-		// when the button is clicked
-		submitSearch.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent e) {
-				queryServer(gui);
-			}
-		});
-		
-		searchTerm.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent e) {
-				queryServer(gui);
-			}
-		});
-	
-		searchResults.addColumn(tr("name"));
-		searchResults.addColumn(tr("type"));
-		searchResults.addColumn(tr("near"));
-		searchResults.addColumn(tr("zoom"));
-		
-		// TODO - this is probably not the coolest way to set relative sizes?
-		searchResultDisplay.getColumn(tr("name")).setPreferredWidth(200);
-		searchResultDisplay.getColumn(tr("type")).setPreferredWidth(100);
-		searchResultDisplay.getColumn(tr("near")).setPreferredWidth(100);
-		searchResultDisplay.getColumn(tr("zoom")).setPreferredWidth(50);
-		searchResultDisplay.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-		
-		// display search results in a table. for simplicity, the table contains
-		// the same SearchResult object in each of the four columns, but it is rendered
-		// differently depending on the column.
-		searchResultDisplay.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
-			@Override public Component getTableCellRendererComponent(JTable table, Object value,
+    private JTextField searchTerm = new JTextField();
+    private JButton submitSearch = new JButton(tr("Search..."));
+    private DefaultTableModel searchResults = new DefaultTableModel() {
+        @Override public boolean isCellEditable(int row, int col) { return false; }
+    };
+    private JTable searchResultDisplay = new JTable(searchResults);
+    private boolean updatingSelf;
+
+    /**
+     * Data storage for search results.
+     */
+    class SearchResult
+    {
+        public String name;
+        public String type;
+        public String nearestPlace;
+        public String description;
+        public double lat;
+        public double lon;
+        public int zoom;
+    }
+
+    /**
+     * A very primitive parser for the name finder's output.
+     * Structure of xml described here:  http://wiki.openstreetmap.org/index.php/Name_finder
+     *
+     */
+    private class Parser extends DefaultHandler
+    {
+        private SearchResult currentResult = null;
+        private StringBuffer description = null;
+        private int depth = 0;
+        /**
+         * Detect starting elements.
+         *
+         */
+        @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
+        {
+            depth++;
+            try
+            {
+                if (qName.equals("searchresults"))
+                {
+                    searchResults.setRowCount(0);
+                }
+                else if (qName.equals("named") && (depth == 2))
+                {
+                    currentResult = new PlaceSelection.SearchResult();
+                    currentResult.name = atts.getValue("name");
+                    currentResult.type = atts.getValue("info");
+                    currentResult.lat = Double.parseDouble(atts.getValue("lat"));
+                    currentResult.lon = Double.parseDouble(atts.getValue("lon"));
+                    currentResult.zoom = Integer.parseInt(atts.getValue("zoom"));
+                    searchResults.addRow(new Object[] { currentResult, currentResult, currentResult, currentResult });
+                }
+                else if (qName.equals("description") && (depth == 3))
+                {
+                    description = new StringBuffer();
+                }
+                else if (qName.equals("named") && (depth == 4))
+                {
+                    // this is a "named" place in the nearest places list.
+                    String info = atts.getValue("info");
+                    if ("city".equals(info) || "town".equals(info) || "village".equals(info)) {
+                        currentResult.nearestPlace = atts.getValue("name");
+                    }
+                }
+            }
+            catch (NumberFormatException x)
+            {
+                x.printStackTrace(); // SAXException does not chain correctly
+                throw new SAXException(x.getMessage(), x);
+            }
+            catch (NullPointerException x)
+            {
+                x.printStackTrace(); // SAXException does not chain correctly
+                throw new SAXException(tr("NullPointerException, Possibly some missing tags."), x);
+            }
+        }
+        /**
+         * Detect ending elements.
+         */
+        @Override public void endElement(String namespaceURI, String localName, String qName) throws SAXException
+        {
+
+            if (qName.equals("searchresults"))
+            {
+            }
+            else if (qName.equals("description") && description != null)
+            {
+                currentResult.description = description.toString();
+                description = null;
+            }
+            depth--;
+
+        }
+        /**
+         * Read characters for description.
+         */
+        @Override public void characters(char[] data, int start, int length) throws org.xml.sax.SAXException
+        {
+            if (description != null)
+            {
+                description.append(data, start, length);
+            }
+        }
+    }
+
+    /**
+     * This queries David Earl's server. Needless to say, stuff should be configurable, and
+     * error handling improved.
+     */
+    public void queryServer(final JComponent component)
+    {
+        final Cursor oldCursor = component.getCursor();
+
+        // had to put this in a thread as it wouldn't update the cursor properly before.
+        Runnable r = new Runnable() {
+            public void run() {
+                try
+                {
+                    String searchtext = searchTerm.getText();
+                    if(searchtext.length()==0)
+                    {
+                        JOptionPane.showMessageDialog(Main.parent,tr("Please enter a search string"));
+                    }
+                    else
+                    {
+                        component.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+                        component.repaint();
+                        URL url = new URL("http://gazetteer.openstreetmap.org/namefinder/search.xml?find="
+                        +java.net.URLEncoder.encode(searchTerm.getText(), "UTF-8"));
+                        HttpURLConnection activeConnection = (HttpURLConnection)url.openConnection();
+                        //System.out.println("got return: "+activeConnection.getResponseCode());
+                        activeConnection.setConnectTimeout(15000);
+                        InputStream inputStream = activeConnection.getInputStream();
+                        InputSource inputSource = new InputSource(new InputStreamReader(inputStream, "UTF-8"));
+                        SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new Parser());
+                    }
+                }
+                catch (Exception x)
+                {
+                    JOptionPane.showMessageDialog(Main.parent,tr("Cannot read place search results from server"));
+                    x.printStackTrace();
+                }
+                component.setCursor(oldCursor);
+            }
+        };
+        new Thread(r).start();
+    }
+
+    /**
+     * Adds a new tab to the download dialog in JOSM.
+     *
+     * This method is, for all intents and purposes, the constructor for this class.
+     */
+    public void addGui(final DownloadDialog gui) {
+        JPanel panel = new JPanel();
+        panel.setLayout(new GridBagLayout());
+
+        // this is manually tuned so that it looks nice on a GNOME
+        // desktop - maybe needs some cross platform proofing.
+        panel.add(new JLabel(tr("Enter a place name to search for:")), GBC.eol().insets(5, 5, 5, 5));
+        panel.add(searchTerm, GBC.std().fill(GBC.BOTH).insets(5, 0, 5, 4));
+        panel.add(submitSearch, GBC.eol().insets(5, 0, 5, 5));
+        Dimension btnSize = submitSearch.getPreferredSize();
+        btnSize.setSize(btnSize.width, btnSize.height * 0.8);
+        submitSearch.setPreferredSize(btnSize);
+
+        GBC c = GBC.std().fill().insets(5, 0, 5, 5);
+        c.gridwidth = 2;
+        JScrollPane scrollPane = new JScrollPane(searchResultDisplay);
+        scrollPane.setPreferredSize(new Dimension(200,200));
+        panel.add(scrollPane, c);
+        gui.tabpane.add(panel, tr("Places"));
+
+        scrollPane.setPreferredSize(scrollPane.getPreferredSize());
+
+        // when the button is clicked
+        submitSearch.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                queryServer(gui);
+            }
+        });
+
+        searchTerm.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                queryServer(gui);
+            }
+        });
+
+        searchResults.addColumn(tr("name"));
+        searchResults.addColumn(tr("type"));
+        searchResults.addColumn(tr("near"));
+        searchResults.addColumn(tr("zoom"));
+
+        // TODO - this is probably not the coolest way to set relative sizes?
+        searchResultDisplay.getColumn(tr("name")).setPreferredWidth(200);
+        searchResultDisplay.getColumn(tr("type")).setPreferredWidth(100);
+        searchResultDisplay.getColumn(tr("near")).setPreferredWidth(100);
+        searchResultDisplay.getColumn(tr("zoom")).setPreferredWidth(50);
+        searchResultDisplay.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+
+        // display search results in a table. for simplicity, the table contains
+        // the same SearchResult object in each of the four columns, but it is rendered
+        // differently depending on the column.
+        searchResultDisplay.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
+            @Override public Component getTableCellRendererComponent(JTable table, Object value,
                     boolean isSelected, boolean hasFocus, int row, int column) {
-				super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-				if (value != null) {
-					SearchResult sr = (SearchResult) value;
-					switch(column) {
-					case 0: 
-						setText(sr.name);
-						break;
-					case 1:
-						setText(sr.type);
-						break;
-					case 2:
-						setText(sr.nearestPlace);
-						break;
-					case 3:
-						setText(Integer.toString(sr.zoom));
-						break;
-					}
-					setToolTipText("<html>"+((SearchResult)value).description+"</html>");
-				}
-				return this;
-			}
-		});
-		
-		// if item is selected in list, notify dialog
-		searchResultDisplay.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
-			public void valueChanged(ListSelectionEvent lse) {
-				if (lse.getValueIsAdjusting()) return;
-				SearchResult r = null;
-				try 
-				{
-					r = (SearchResult) searchResults.getValueAt(lse.getFirstIndex(), 0);
-				}
-				catch (Exception x)
-				{
-					// Ignore
-				}
-				if (r != null)
-				{
-					double size = 180.0 / Math.pow(2, r.zoom);
-					gui.minlat = r.lat - size / 2;
-					gui.maxlat = r.lat + size / 2;
-					gui.minlon = r.lon - size;
-					gui.maxlon = r.lon + size;
-					updatingSelf = true;
-					gui.boundingBoxChanged(null);
-					updatingSelf = false;
-				}
-			}
-		});
-		
-		// TODO - we'd like to finish the download dialog upon double-click but
-		// don't know how to bypass the JOptionPane in which the whole thing is
-		// displayed.
-		searchResultDisplay.addMouseListener(new MouseAdapter() {
-			@Override public void mouseClicked(MouseEvent e) {
-				if (e.getClickCount() > 1) {
-					if (searchResultDisplay.getSelectionModel().getMinSelectionIndex() > -1) {
-						// add sensible action here.
-					}
-				}
-			}
-		});
-
-	}
-
-	// if bounding box selected on other tab, de-select item
-	public void boundingBoxChanged(DownloadDialog gui) {
-		if (!updatingSelf) searchResultDisplay.clearSelection();
-	}
+                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+                if (value != null) {
+                    SearchResult sr = (SearchResult) value;
+                    switch(column) {
+                    case 0:
+                        setText(sr.name);
+                        break;
+                    case 1:
+                        setText(sr.type);
+                        break;
+                    case 2:
+                        setText(sr.nearestPlace);
+                        break;
+                    case 3:
+                        setText(Integer.toString(sr.zoom));
+                        break;
+                    }
+                    setToolTipText("<html>"+((SearchResult)value).description+"</html>");
+                }
+                return this;
+            }
+        });
+
+        // if item is selected in list, notify dialog
+        searchResultDisplay.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+            public void valueChanged(ListSelectionEvent lse) {
+                if (lse.getValueIsAdjusting()) return;
+                SearchResult r = null;
+                try
+                {
+                    r = (SearchResult) searchResults.getValueAt(lse.getFirstIndex(), 0);
+                }
+                catch (Exception x)
+                {
+                    // Ignore
+                }
+                if (r != null)
+                {
+                    double size = 180.0 / Math.pow(2, r.zoom);
+                    gui.minlat = r.lat - size / 2;
+                    gui.maxlat = r.lat + size / 2;
+                    gui.minlon = r.lon - size;
+                    gui.maxlon = r.lon + size;
+                    updatingSelf = true;
+                    gui.boundingBoxChanged(null);
+                    updatingSelf = false;
+                }
+            }
+        });
+
+        // TODO - we'd like to finish the download dialog upon double-click but
+        // don't know how to bypass the JOptionPane in which the whole thing is
+        // displayed.
+        searchResultDisplay.addMouseListener(new MouseAdapter() {
+            @Override public void mouseClicked(MouseEvent e) {
+                if (e.getClickCount() > 1) {
+                    if (searchResultDisplay.getSelectionModel().getMinSelectionIndex() > -1) {
+                        // add sensible action here.
+                    }
+                }
+            }
+        });
+
+    }
+
+    // if bounding box selected on other tab, de-select item
+    public void boundingBoxChanged(DownloadDialog gui) {
+        if (!updatingSelf) searchResultDisplay.clearSelection();
+    }
 }
Index: /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/JosmEdgeFactory.java
===================================================================
--- /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/JosmEdgeFactory.java	(revision 12777)
+++ /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/JosmEdgeFactory.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.navigator;
@@ -13,5 +13,5 @@
 public class JosmEdgeFactory implements EdgeFactory<Node, WayEdge> {
 
-  
+
 
   /* (non-Javadoc)
Index: /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorAction.java
===================================================================
--- /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorAction.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.navigator;
@@ -28,5 +28,5 @@
     super(tr("Navigate"));
     this.navigatorPlugin = navigatorPlugin;
-    
+
   }
 
Index: /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorLayer.java
===================================================================
--- /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorLayer.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.navigator;
@@ -29,5 +29,5 @@
 /**
  * @author cdaller
- * 
+ *
  */
 public class NavigatorLayer extends Layer {
@@ -43,5 +43,5 @@
     /**
      * Constructor
-     * 
+     *
      * @param name
      *            the name of the layer.
@@ -53,5 +53,5 @@
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.gui.layer.Layer#getIcon()
      */
@@ -64,5 +64,5 @@
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.gui.layer.Layer#getInfoComponent()
      */
@@ -74,5 +74,5 @@
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.gui.layer.Layer#getMenuEntries()
      */
@@ -85,5 +85,5 @@
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.gui.layer.Layer#getToolTipText()
      */
@@ -95,5 +95,5 @@
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.gui.layer.Layer#isMergable(org.openstreetmap.josm.gui.layer.Layer)
      */
@@ -105,5 +105,5 @@
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.gui.layer.Layer#mergeFrom(org.openstreetmap.josm.gui.layer.Layer)
      */
@@ -115,5 +115,5 @@
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.gui.layer.Layer#paint(java.awt.Graphics,
      *      org.openstreetmap.josm.gui.MapView)
@@ -125,5 +125,5 @@
             return;
         }
-        
+
         if(startIcon == null) {
             startIcon = ImageProvider.get("navigation", "startflag");
@@ -135,5 +135,5 @@
         Point screen = mv.getPoint(node.eastNorth);
         startIcon.paintIcon(mv, g, screen.x, screen.y - startIcon.getIconHeight());
-        
+
         // middle icons:
         for(int index = 1; index < nodes.size() - 1; ++index) {
@@ -148,5 +148,5 @@
             endIcon.paintIcon(mv, g, screen.x, screen.y - endIcon.getIconHeight());
         }
-        
+
         String colorString = Main.pref.get(KEY_ROUTE_COLOR);
         if(colorString.length() == 0) {
@@ -170,5 +170,5 @@
         }
     }
-    
+
     /**
      * Draw a line with the given color.
@@ -183,7 +183,7 @@
         } else {
             from = mv.getPoint(edge.getSegment().to.eastNorth);
-            to = mv.getPoint(edge.getSegment().from.eastNorth);            
-        }
-        
+            to = mv.getPoint(edge.getSegment().from.eastNorth);
+        }
+
         Rectangle screen = g.getClipBounds();
         Line2D line = new Line2D.Double(from.x, from.y, to.x, to.y);
@@ -206,5 +206,5 @@
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.gui.layer.Layer#visitBoundingBox(org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor)
      */
@@ -225,5 +225,5 @@
 
     /**
-     * 
+     *
      */
     public void navigate() {
@@ -235,5 +235,5 @@
             Main.pref.put(KEY_ROUTE_SELECT, selectString);
         }
-        
+
         if(Boolean.parseBoolean(selectString)) {
             List<Segment> path = navigatorNodeModel.getSegmentPath();
@@ -244,5 +244,5 @@
             }
         }
-        Main.map.repaint();        
+        Main.map.repaint();
     }
 
Index: /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorModeAction.java
===================================================================
--- /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorModeAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorModeAction.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.navigator;
@@ -24,5 +24,5 @@
     private NavigatorLayer navigatorLayer;
     private boolean layerAdded;
-    
+
     public NavigatorModeAction(MapFrame mapFrame, NavigatorModel navigatorModel, NavigatorLayer navigationLayer) {
         super(tr("Navigator"), "navigation", tr("Set start/end for routing. Middle mouse button to reset."), KeyEvent.VK_F, mapFrame, ImageProvider.getCursor("crosshair", "selection"));
@@ -30,5 +30,5 @@
         this.navigatorLayer = navigationLayer;
     }
-    
+
     @Override public void enterMode() {
         super.enterMode();
@@ -50,5 +50,5 @@
         if (e.getButton() == MouseEvent.BUTTON2) {
             navigatorModel.reset();
-        } else if (e.getButton() == MouseEvent.BUTTON1) {        
+        } else if (e.getButton() == MouseEvent.BUTTON1) {
             Node node = Main.map.mapView.getNearestNode(e.getPoint());
             System.out.println("selected node " + node);
Index: /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorModel.java
===================================================================
--- /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorModel.java	(revision 12777)
+++ /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorModel.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.navigator;
@@ -36,5 +36,5 @@
         highwayWeight = new HashMap<String, Double>();
     }
-    
+
     /**
      * Set the weight for the given highway type. The higher the weight is,
@@ -46,5 +46,5 @@
         highwayWeight.put(type, weigth);
     }
-    
+
     /**
      * @return the selectedNodes
@@ -67,7 +67,7 @@
     }
 
-    
-    /**
-     * 
+
+    /**
+     *
      */
     public void calculateShortesPath() {
@@ -92,8 +92,8 @@
             fullWeight += routing.getPathLength();
         }
-        
+
         edgePath = new ArrayList<SegmentEdge>();
         edgePath.addAll(fullPath);
-        
+
         System.out.println("shortest path found: " + fullPath + "\nweight: " + fullWeight);
         System.out.println(getPathDescription());
@@ -104,8 +104,8 @@
 //        System.out.println("all added: " + weight2);
     }
-    
+
     public String getPathDescription() {
         List<PathDescription> pathDescriptions = getPathDescriptions();
-        
+
         // create text representation from description:
         StringBuilder builder = new StringBuilder();
@@ -137,5 +137,5 @@
         Way oldWay = null;
         Way way = null;
-        
+
         SegmentEdge edge;
         for(int segIndex = 0; segIndex < edgePath.size(); ++segIndex) {
@@ -150,14 +150,14 @@
                 description = new PathDescription(oldWay, length); // add finished way
                 pathDescriptions.add(description);
-                length = 0;                
+                length = 0;
             }
             if(segIndex == edgePath.size() - 1) {
                 description = new PathDescription(way, length);
-                pathDescriptions.add(description);                
+                pathDescriptions.add(description);
             }
             oldWay = way;
         }
-        
-        
+
+
 //        for(SegmentEdge edge : edgePath) {
 //            way = edge.getWay();
@@ -216,5 +216,5 @@
         return this.edgePath;
     }
-    
+
     /**
      * Resets all data (nodes, edges, segments).
Index: /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorPlugin.java
===================================================================
--- /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/NavigatorPlugin.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.navigator;
@@ -21,7 +21,7 @@
 /**
  * Plugin that allows navigation in josm
- * 
+ *
  * @author cdaller
- * 
+ *
  */
 public class NavigatorPlugin extends Plugin {
@@ -31,5 +31,5 @@
 
     /**
-     * 
+     *
      */
     public NavigatorPlugin() {
@@ -40,5 +40,5 @@
         navigatorLayer = new NavigatorLayer(tr("Navigation"));
         navigatorLayer.setNavigatorNodeModel(navigatorModel);
-        
+
         JMenuBar menu = Main.main.menu;
         JMenu navigatorMenu = new JMenu(tr("Navigation"));
@@ -55,5 +55,5 @@
         menu.add(navigatorMenu);
     }
-    
+
     /**
      * Reads the weight values for the different highway types from the preferences.
@@ -70,7 +70,7 @@
         }
     }
-    
+
     /**
-     * Checks if there are any highway weights set in the preferences. If not, default 
+     * Checks if there are any highway weights set in the preferences. If not, default
      * values are used.
      */
@@ -86,5 +86,5 @@
         setDefaultWeight("footway", 0.0);
     }
-    
+
     private void setDefaultWeight(String type, double value) {
         if(!Main.pref.hasKey(KEY_HIGHWAY_WEIGHT_PREFIX + type)) {
@@ -92,5 +92,5 @@
         }
     }
-    
+
     /* (non-Javadoc)
      * @see org.openstreetmap.josm.plugins.Plugin#mapFrameInitialized(org.openstreetmap.josm.gui.MapFrame, org.openstreetmap.josm.gui.MapFrame)
@@ -99,5 +99,5 @@
     public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
         if(newFrame != null) {
-            IconToggleButton button = new IconToggleButton(new NavigatorModeAction(newFrame, navigatorModel, navigatorLayer)); 
+            IconToggleButton button = new IconToggleButton(new NavigatorModeAction(newFrame, navigatorModel, navigatorLayer));
             newFrame.toolBarActions.add(button);
             newFrame.toolGroup.add(button);
Index: /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/OsmGraphCreator.java
===================================================================
--- /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/OsmGraphCreator.java	(revision 12777)
+++ /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/OsmGraphCreator.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.navigator;
@@ -23,5 +23,5 @@
 /**
  * @author cdaller
- * 
+ *
  */
 public class OsmGraphCreator {
@@ -38,5 +38,5 @@
         highwayWeight = new HashMap<String, Double>();
     }
-    
+
     /**
      * Set the weight for the given highway type. The higher the weight is,
@@ -58,5 +58,5 @@
         // iterate all ways and segments for all nodes:
         for(Way way : Main.ds.ways) {
-            if(way != null && !way.deleted) {                
+            if(way != null && !way.deleted) {
                 for(Segment segment : way.segments) {
                     if(segment != null && !segment.deleted && segment.from != null && segment.to != null) {
@@ -67,5 +67,5 @@
                         graph.addEdge(segment.from, segment.to, edge);
                         weight = getWeight(way, segment);
-                        System.out.println("edge for segment " + segment.id + "(from node "+ segment.from.id + " to node " 
+                        System.out.println("edge for segment " + segment.id + "(from node "+ segment.from.id + " to node "
                             + segment.to.id + ") has weight: " + weight);
                         graph.setEdgeWeight(edge, weight);
@@ -74,6 +74,6 @@
                             edge.setWay(way);
                             graph.addEdge(segment.to, segment.from, edge);
-                            graph.setEdgeWeight(edge, weight);          
-                            System.out.println("inverse segment " + segment.id + "(from node "+ segment.to.id + " to node " 
+                            graph.setEdgeWeight(edge, weight);
+                            System.out.println("inverse segment " + segment.id + "(from node "+ segment.to.id + " to node "
                                 + segment.from.id + ") has weight: " + weight);
                         }
@@ -105,5 +105,5 @@
         }
         // deg to m (at equator :-):
-        double distance = Math.sqrt(segment.from.coor.distance(segment.to.coor)) * 111000; 
+        double distance = Math.sqrt(segment.from.coor.distance(segment.to.coor)) * 111000;
         if(weight == 0.0) {
             weight = 1E-20;
@@ -191,5 +191,5 @@
     /**
      * Returns the other segment for the given node (works only for non crossing nodes).
-     * 
+     *
      * @param node
      * @param segment
Index: /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/PathDescription.java
===================================================================
--- /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/PathDescription.java	(revision 12777)
+++ /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/PathDescription.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.navigator;
Index: /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/SegmentEdge.java
===================================================================
--- /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/SegmentEdge.java	(revision 12777)
+++ /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/SegmentEdge.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.navigator;
@@ -10,5 +10,5 @@
 /**
  * @author cdaller
- * 
+ *
  */
 public class SegmentEdge extends DefaultWeightedEdge {
Index: /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/WayEdge.java
===================================================================
--- /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/WayEdge.java	(revision 12777)
+++ /applications/editors/josm/plugins/navigator/src/at/dallermassl/josm/plugin/navigator/WayEdge.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.navigator;
@@ -18,9 +18,9 @@
   private Node endNode;
   private List<Segment> segments;
-  
+
   public WayEdge() {
-    
+
   }
-  
+
   public WayEdge(int length) {
     this.length = length;
@@ -82,6 +82,6 @@
     this.endNode = endNode;
   }
-  
-  
+
+
 
 }
Index: /applications/editors/josm/plugins/nearclick/src/nearclick/NearClickPlugin.java
===================================================================
--- /applications/editors/josm/plugins/nearclick/src/nearclick/NearClickPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/nearclick/src/nearclick/NearClickPlugin.java	(revision 12778)
@@ -20,12 +20,12 @@
     public NearClickPlugin() {
         Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
-	try {
-	    int radius = Integer.parseInt(Main.pref.get("nearclick.radius", "7"));
-	    radiussquared = radius * radius;
-	    delay = Integer.parseInt(Main.pref.get("nearclick.delay", "250"));
-	} catch (NumberFormatException ex) {
-	    delay = 250;
-	    radiussquared = 7 * 7;
-	}
+    try {
+        int radius = Integer.parseInt(Main.pref.get("nearclick.radius", "7"));
+        radiussquared = radius * radius;
+        delay = Integer.parseInt(Main.pref.get("nearclick.delay", "250"));
+    } catch (NumberFormatException ex) {
+        delay = 250;
+        radiussquared = 7 * 7;
+    }
     }
 
@@ -35,13 +35,13 @@
             if ( e.getButton() != MouseEvent.BUTTON1 )
                 return;
-	    int xdiff = e.getPoint().x - mouseDownX;
-	    int ydiff = e.getPoint().y - mouseDownY;
-	    
+        int xdiff = e.getPoint().x - mouseDownX;
+        int ydiff = e.getPoint().y - mouseDownY;
+        
             if (e.getID() == MouseEvent.MOUSE_RELEASED) {
                 if ( e.getWhen() - mouseDownTime < delay &&
-		     ( e.getPoint().x != mouseDownX ||
-		       e.getPoint().y != mouseDownY) &&
-		     xdiff * xdiff + ydiff * ydiff < radiussquared
-		   ) {
+             ( e.getPoint().x != mouseDownX ||
+               e.getPoint().y != mouseDownY) &&
+             xdiff * xdiff + ydiff * ydiff < radiussquared
+           ) {
                     try {
                         Robot r = new Robot(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
Index: /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/Browser.java
===================================================================
--- /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/Browser.java	(revision 12777)
+++ /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/Browser.java	(revision 12778)
@@ -21,5 +21,5 @@
     static
     {
-	Logger.getLogger("org.lobobrowser").setLevel(Level.WARNING);
+    Logger.getLogger("org.lobobrowser").setLevel(Level.WARNING);
     }
 
@@ -29,75 +29,75 @@
 
     public Browser(String uri) {
-	super();
+    super();
 
-	UserAgentContext ucontext = new CacheableUserAgentContext();
-	rcontext = new SimpleHtmlRendererContext(this, ucontext);
-	addNotify();
+    UserAgentContext ucontext = new CacheableUserAgentContext();
+    rcontext = new SimpleHtmlRendererContext(this, ucontext);
+    addNotify();
 
-	process( uri );
+    process( uri );
     }
 
     private void process(String uri) {
-	try {
-	    URL url;
-	    try {
-		url = new URL(uri);
-	    } catch (java.net.MalformedURLException mfu) {
-		int idx = uri.indexOf(':');
-		if (idx == -1 || idx == 1) {
-		    // try file
-		    url = new URL("file:" + uri);
-		} else {
-		    throw mfu;
-		}
-	    }
-	    // Call SimpleHtmlRendererContext.navigate()
-	    // which implements incremental rendering.
-	    this.rcontext.navigate(url, null);
-	} catch (Exception err) {
-	    err.printStackTrace();
-	}
+    try {
+        URL url;
+        try {
+        url = new URL(uri);
+        } catch (java.net.MalformedURLException mfu) {
+        int idx = uri.indexOf(':');
+        if (idx == -1 || idx == 1) {
+            // try file
+            url = new URL("file:" + uri);
+        } else {
+            throw mfu;
+        }
+        }
+        // Call SimpleHtmlRendererContext.navigate()
+        // which implements incremental rendering.
+        this.rcontext.navigate(url, null);
+    } catch (Exception err) {
+        err.printStackTrace();
     }
-    
+    }
+
     @Override
     public void setSize(final Dimension newSize)
     {
-	if (!newSize.equals(oldSize)) {
-	    oldSize = newSize;
-	    super.setSize(newSize);
-	    validate();
+    if (!newSize.equals(oldSize)) {
+        oldSize = newSize;
+        super.setSize(newSize);
+        validate();
 
-	    executeAsyncScript("resizeMap(" + newSize.width + "," + newSize.height + ");");
-	}
+        executeAsyncScript("resizeMap(" + newSize.width + "," + newSize.height + ");");
+    }
     }
 
     public void executeAsyncScript(final String script)
     {
-	EventQueue.invokeLater(new Runnable() {
-	    public void run() {
-		executeScript(script);
-	    }
-	});
+    EventQueue.invokeLater(new Runnable() {
+        public void run() {
+        executeScript(script);
+        }
+    });
     }
-    
+
     public Object executeScript(String script)
     {
-	System.out.println("Executing script " + script);
-	try {
-	    Window window = Window.getWindow(rcontext);
-	    if( window.getDocumentNode() == null )
-		return null; // Document not loaded yet
+    System.out.println("Executing script " + script);
+    try {
+        Window window = Window.getWindow(rcontext);
+        if( window.getDocumentNode() == null )
+        return null; // Document not loaded yet
 
-	    return window.eval(script);
-	} catch (EcmaError ecmaError) {
-	    logger.log(Level.WARNING, "Javascript error at " + ecmaError.sourceName() + ":" + ecmaError.lineNumber() + ": " + ecmaError.getMessage());
-	} catch (Throwable err) {
-	    logger.log(Level.WARNING, "Unable to evaluate Javascript code", err);
-	}
-	
-	return null;
+        return window.eval(script);
+    } catch (EcmaError ecmaError) {
+        logger.log(Level.WARNING, "Javascript error at " + ecmaError.sourceName() + ":" + ecmaError.lineNumber() + ": " + ecmaError.getMessage());
+    } catch (Throwable err) {
+        logger.log(Level.WARNING, "Unable to evaluate Javascript code", err);
     }
-    
-    
+
+    return null;
+    }
+
+
     /**
      * Overrided to hide hardcoded scrollbars and insets
@@ -105,5 +105,5 @@
     @Override
     protected HtmlBlockPanel createHtmlBlockPanel(UserAgentContext ucontext, HtmlRendererContext rcontext) {
-	return new MyHtmlBlockPanel(java.awt.Color.WHITE, true, ucontext, rcontext, this);
+    return new MyHtmlBlockPanel(java.awt.Color.WHITE, true, ucontext, rcontext, this);
     }
 }
Index: /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/CacheableHttpRequest.java
===================================================================
--- /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/CacheableHttpRequest.java	(revision 12777)
+++ /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/CacheableHttpRequest.java	(revision 12778)
@@ -44,122 +44,122 @@
 
     public CacheableHttpRequest(UserAgentContext context, Proxy proxy) {
-	this.context = context;
-	this.proxy = proxy;
+    this.context = context;
+    this.proxy = proxy;
     }
 
     public synchronized int getReadyState() {
-	return this.readyState;
+    return this.readyState;
     }
 
     public synchronized String getResponseText() {
-	if( response == null ) return null;
-	
-	byte[] bytes = this.response.responseBytes;
-	String encoding = this.response.encoding;
-	
-	try {
-	    return bytes == null ? null : new String(bytes, encoding);
-	} catch (UnsupportedEncodingException uee) {
-	    logger.log(Level.WARNING, "getResponseText(): Charset '" + encoding + "' did not work. Retrying with ISO-8859-1.", uee);
-	    try {
-		return new String(bytes, "ISO-8859-1");
-	    } catch (UnsupportedEncodingException uee2) {
-		// Ignore this time
-		return null;
-	    }
-	}
+    if( response == null ) return null;
+
+    byte[] bytes = this.response.responseBytes;
+    String encoding = this.response.encoding;
+
+    try {
+        return bytes == null ? null : new String(bytes, encoding);
+    } catch (UnsupportedEncodingException uee) {
+        logger.log(Level.WARNING, "getResponseText(): Charset '" + encoding + "' did not work. Retrying with ISO-8859-1.", uee);
+        try {
+        return new String(bytes, "ISO-8859-1");
+        } catch (UnsupportedEncodingException uee2) {
+        // Ignore this time
+        return null;
+        }
+    }
     }
 
     public synchronized Document getResponseXML() {
-	if( response == null ) return null;
-
-	byte[] bytes = this.response.responseBytes;
-	if (bytes == null) return null;
-
-	InputStream in = new ByteArrayInputStream(bytes);
-	try {
-	    return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
-	} catch (Exception err) {
-	    logger.log(Level.WARNING, "Unable to parse response as XML.", err);
-	    return null;
-	}
+    if( response == null ) return null;
+
+    byte[] bytes = this.response.responseBytes;
+    if (bytes == null) return null;
+
+    InputStream in = new ByteArrayInputStream(bytes);
+    try {
+        return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
+    } catch (Exception err) {
+        logger.log(Level.WARNING, "Unable to parse response as XML.", err);
+        return null;
+    }
     }
 
     public synchronized byte[] getResponseBytes() {
-	if( response == null ) return null;
-	return this.response.responseBytes;
+    if( response == null ) return null;
+    return this.response.responseBytes;
     }
 
     public synchronized Image getResponseImage() {
-	if( response == null ) return null;
-
-	byte[] bytes = this.response.responseBytes;
-	if (bytes == null) return null;
-
-	return Toolkit.getDefaultToolkit().createImage(bytes);
+    if( response == null ) return null;
+
+    byte[] bytes = this.response.responseBytes;
+    if (bytes == null) return null;
+
+    return Toolkit.getDefaultToolkit().createImage(bytes);
     }
 
     public synchronized int getStatus() {
-	if( response == null ) return 0;
-	return this.response.status;
+    if( response == null ) return 0;
+    return this.response.status;
     }
 
     public synchronized String getStatusText() {
-	if( response == null ) return null;
-	return this.response.statusText;
+    if( response == null ) return null;
+    return this.response.statusText;
     }
 
     public synchronized String getAllResponseHeaders() {
-	if( response == null ) return null;
-	return this.response.responseHeaders;
+    if( response == null ) return null;
+    return this.response.responseHeaders;
     }
 
     public synchronized String getResponseHeader(String headerName) {
-	if( response == null ) return null;
-	Map headers = this.response.responseHeadersMap;
-	return headers == null ? null : (String) headers.get(headerName);
+    if( response == null ) return null;
+    Map headers = this.response.responseHeadersMap;
+    return headers == null ? null : (String) headers.get(headerName);
     }
 
     public void open(String method, String url) throws IOException {
-	this.open(method, url, true);
+    this.open(method, url, true);
     }
 
     public void open(String method, URL url) throws IOException {
-	this.open(method, url, true, null, null);
+    this.open(method, url, true, null, null);
     }
 
     public void open(String method, URL url, boolean asyncFlag) throws IOException {
-	this.open(method, url, asyncFlag, null, null);
+    this.open(method, url, asyncFlag, null, null);
     }
 
     public void open(String method, String url, boolean asyncFlag) throws IOException {
-	URL urlObj = Urls.createURL(null, url);
-	this.open(method, urlObj, asyncFlag, null);
+    URL urlObj = Urls.createURL(null, url);
+    this.open(method, urlObj, asyncFlag, null);
     }
 
     public void open(String method, URL url, boolean asyncFlag, String userName) throws IOException {
-	this.open(method, url, asyncFlag, userName, null);
+    this.open(method, url, asyncFlag, userName, null);
     }
 
     public void abort() {
-	URLConnection c;
-	synchronized (this) {
-	    c = this.connection;
-	    response = null;
-	}
-	if (c instanceof HttpURLConnection) {
-	    ((HttpURLConnection) c).disconnect();
-	} else if (c != null) {
-	    try {
-		c.getInputStream().close();
-	    } catch (IOException ioe) {
-		ioe.printStackTrace();
-	    }
-	}
+    URLConnection c;
+    synchronized (this) {
+        c = this.connection;
+        response = null;
+    }
+    if (c instanceof HttpURLConnection) {
+        ((HttpURLConnection) c).disconnect();
+    } else if (c != null) {
+        try {
+        c.getInputStream().close();
+        } catch (IOException ioe) {
+        ioe.printStackTrace();
+        }
+    }
     }
 
     /**
      * Opens the request. Call {@link #send(String)} to complete it.
-     * 
+     *
      * @param method The request method.
      * @param url The request URL.
@@ -170,29 +170,29 @@
      */
     public void open(final String method, final URL url, boolean asyncFlag, final String userName, final String password) throws IOException {
-	this.abort();
-
-	HttpResponse response = HttpResponse.lookup(url);
-	URLConnection c = null;
-	
-	if( response == null )
-	{
-	    c = proxy == null || proxy == Proxy.NO_PROXY ? url.openConnection() : url.openConnection(proxy);
-	    response = new HttpResponse();
-	}
-	    
-	synchronized (this) {
-	    this.connection = c;
-	    this.isAsync = asyncFlag;
-	    this.requestMethod = method;
-	    this.requestUserName = userName;
-	    this.requestPassword = password;
-	    this.requestURL = url;
-	    this.response = response;
-	    
-	    if( response.loaded )
-		changeState(HttpRequest.STATE_LOADING);
-	    else
-		changeState(HttpRequest.STATE_LOADING, 0, null, null);
-	}
+    this.abort();
+
+    HttpResponse response = HttpResponse.lookup(url);
+    URLConnection c = null;
+
+    if( response == null )
+    {
+        c = proxy == null || proxy == Proxy.NO_PROXY ? url.openConnection() : url.openConnection(proxy);
+        response = new HttpResponse();
+    }
+
+    synchronized (this) {
+        this.connection = c;
+        this.isAsync = asyncFlag;
+        this.requestMethod = method;
+        this.requestUserName = userName;
+        this.requestPassword = password;
+        this.requestURL = url;
+        this.response = response;
+
+        if( response.loaded )
+        changeState(HttpRequest.STATE_LOADING);
+        else
+        changeState(HttpRequest.STATE_LOADING, 0, null, null);
+    }
     }
 
@@ -201,28 +201,28 @@
      * <p>
      * In the case of asynchronous requests, a new thread is created.
-     * 
+     *
      * @param content POST content or <code>null</code> if there's no such
      *        content.
      */
     public void send(final String content) throws IOException {
-	final URL url = this.requestURL;
-	if (url == null) {
-	    throw new IOException("No URL has been provided.");
-	}
-	if (this.isAsync) {
-	    // Should use a thread pool instead
-	    new Thread("SimpleHttpRequest-" + url.getHost()) {
-		@Override
+    final URL url = this.requestURL;
+    if (url == null) {
+        throw new IOException("No URL has been provided.");
+    }
+    if (this.isAsync) {
+        // Should use a thread pool instead
+        new Thread("SimpleHttpRequest-" + url.getHost()) {
+        @Override
         public void run() {
-		    try {
-			sendSync(content);
-		    } catch (Throwable thrown) {
-			logger.log(Level.WARNING,"send(): Error in asynchronous request on " + url, thrown);
-		    }
-		}
-	    }.start();
-	} else {
-	    sendSync(content);
-	}
+            try {
+            sendSync(content);
+            } catch (Throwable thrown) {
+            logger.log(Level.WARNING,"send(): Error in asynchronous request on " + url, thrown);
+            }
+        }
+        }.start();
+    } else {
+        sendSync(content);
+    }
     }
 
@@ -232,5 +232,5 @@
      */
     protected String getPostCharset() {
-	return "UTF-8";
+    return "UTF-8";
     }
 
@@ -238,61 +238,61 @@
      * This is a synchronous implementation of {@link #send(String)} method
      * functionality. It may be overridden to change the behavior of the class.
-     * 
+     *
      * @param content POST content if any. It may be <code>null</code>.
      * @throws IOException
      */
     protected void sendSync(String content) throws IOException {
-	if( response.loaded )
-	{
-	    // Response from cache
-	    changeState(HttpRequest.STATE_LOADED);
-	    changeState(HttpRequest.STATE_INTERACTIVE);
-	    changeState(HttpRequest.STATE_COMPLETE);
-	    return;
-	}
-	
-	try {
-	    URLConnection c;
-	    synchronized (this) {
-		c = this.connection;
-	    }
-	    c.setRequestProperty("User-Agent", this.context.getUserAgent());
-	    int istatus = 0;
-	    String istatusText = "";
-	    InputStream err = null;
-	    
-	    if (c instanceof HttpURLConnection) {
-		HttpURLConnection hc = (HttpURLConnection) c;
-		String method = requestMethod.toUpperCase();
-		hc.setRequestMethod(method);
-		if ("POST".equals(method) && content != null) {
-		    hc.setDoOutput(true);
-		    byte[] contentBytes = content.getBytes(this.getPostCharset());
-		    hc.setFixedLengthStreamingMode(contentBytes.length);
-		    OutputStream out = hc.getOutputStream();
-		    try {
-			out.write(contentBytes);
-		    } finally {
-			out.flush();
-		    }
-		}
-		istatus = hc.getResponseCode();
-		istatusText = hc.getResponseMessage();
-		err = hc.getErrorStream();
-	    }
-
-	    response.setConnectionInfo(c);
-	    changeState(HttpRequest.STATE_LOADED, istatus, istatusText, null);
-	    InputStream in = err == null ? c.getInputStream() : err;
-	    int contentLength = c.getContentLength();
-	    changeState(HttpRequest.STATE_INTERACTIVE, istatus, istatusText, null);
-	    byte[] bytes = IORoutines.load(in, contentLength == -1 ? 4096 : contentLength);
-	    changeState(HttpRequest.STATE_COMPLETE, istatus, istatusText, bytes);
-	    response.store(requestURL);
-	} finally {
-	    synchronized (this) {
-		this.connection = null;
-	    }
-	}
+    if( response.loaded )
+    {
+        // Response from cache
+        changeState(HttpRequest.STATE_LOADED);
+        changeState(HttpRequest.STATE_INTERACTIVE);
+        changeState(HttpRequest.STATE_COMPLETE);
+        return;
+    }
+
+    try {
+        URLConnection c;
+        synchronized (this) {
+        c = this.connection;
+        }
+        c.setRequestProperty("User-Agent", this.context.getUserAgent());
+        int istatus = 0;
+        String istatusText = "";
+        InputStream err = null;
+
+        if (c instanceof HttpURLConnection) {
+        HttpURLConnection hc = (HttpURLConnection) c;
+        String method = requestMethod.toUpperCase();
+        hc.setRequestMethod(method);
+        if ("POST".equals(method) && content != null) {
+            hc.setDoOutput(true);
+            byte[] contentBytes = content.getBytes(this.getPostCharset());
+            hc.setFixedLengthStreamingMode(contentBytes.length);
+            OutputStream out = hc.getOutputStream();
+            try {
+            out.write(contentBytes);
+            } finally {
+            out.flush();
+            }
+        }
+        istatus = hc.getResponseCode();
+        istatusText = hc.getResponseMessage();
+        err = hc.getErrorStream();
+        }
+
+        response.setConnectionInfo(c);
+        changeState(HttpRequest.STATE_LOADED, istatus, istatusText, null);
+        InputStream in = err == null ? c.getInputStream() : err;
+        int contentLength = c.getContentLength();
+        changeState(HttpRequest.STATE_INTERACTIVE, istatus, istatusText, null);
+        byte[] bytes = IORoutines.load(in, contentLength == -1 ? 4096 : contentLength);
+        changeState(HttpRequest.STATE_COMPLETE, istatus, istatusText, bytes);
+        response.store(requestURL);
+    } finally {
+        synchronized (this) {
+        this.connection = null;
+        }
+    }
     }
 
@@ -300,11 +300,11 @@
 
     public void addReadyStateChangeListener( final ReadyStateChangeListener listener) {
-	readyEvent.addListener(new GenericEventListener() {
-	    public void processEvent(EventObject event) {
-		listener.readyStateChanged();
-	    }
-	});
-    }
-    
+    readyEvent.addListener(new GenericEventListener() {
+        public void processEvent(EventObject event) {
+        listener.readyStateChanged();
+        }
+    });
+    }
+
     protected void changeState(int readyState, int status, String statusMessage, byte[] bytes) {
         synchronized (this) {
Index: /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/CacheableUserAgentContext.java
===================================================================
--- /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/CacheableUserAgentContext.java	(revision 12777)
+++ /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/CacheableUserAgentContext.java	(revision 12778)
@@ -9,10 +9,10 @@
 public class CacheableUserAgentContext extends SimpleUserAgentContext {
 
-    /** 
+    /**
      * Returns a cache aware HttpRequest
      */
     @Override
     public HttpRequest createHttpRequest() {
-	return new CacheableHttpRequest(this, this.getProxy());
+    return new CacheableHttpRequest(this, this.getProxy());
     }
 }
Index: /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/HttpResponse.java
===================================================================
--- /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/HttpResponse.java	(revision 12777)
+++ /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/HttpResponse.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package org.openstreetmap.josm.plugins.openLayers;
@@ -16,5 +16,5 @@
 public class HttpResponse implements Serializable {
     private static final long serialVersionUID = -8605486951415515445L;
-    
+
     /** The status of the response */
     protected int status;
@@ -27,5 +27,5 @@
     /** Whether this response has been already loaded */
     protected boolean loaded = false;
-    
+
     /** Response headers are set in this map after a response is received. */
     protected Map<String, List<String>> responseHeadersMap;
@@ -33,5 +33,5 @@
     /** Response headers are set in this string after a response is received. */
     protected String responseHeaders;
-    
+
     /**
      * Sets the information about this response: headers and encoding
@@ -43,5 +43,5 @@
         if (encoding == null)
             encoding = "ISO-8859-1";
-        
+
         responseHeaders = getAllResponseHeaders(c);
         responseHeadersMap = c.getHeaderFields();
@@ -50,5 +50,5 @@
     /**
      * Sets the state of this response
-     * 
+     *
      * @param status The response status
      * @param statusMessage The status message
@@ -56,9 +56,9 @@
      */
     public synchronized void changeState(int status, String statusMessage, byte[] bytes) {
-	this.status = status;
+    this.status = status;
         this.statusText = statusMessage;
         this.responseBytes = bytes;
     }
-        
+
     /**
      * Returns the headers of the connection as a String
@@ -68,18 +68,18 @@
     private String getAllResponseHeaders(URLConnection c) {
         int idx = 0;
-	String value;
-	StringBuffer buf = new StringBuffer();
-	while((value = c.getHeaderField(idx)) != null) {
-	    String key = c.getHeaderFieldKey(idx);
-	    if( key != null )
-	    {
-		buf.append(key);
-		buf.append("=");
-	    }
-	    buf.append(value);
-	    buf.append("\n");
-	    idx++;
-	}
-	return buf.toString();
+    String value;
+    StringBuffer buf = new StringBuffer();
+    while((value = c.getHeaderField(idx)) != null) {
+        String key = c.getHeaderFieldKey(idx);
+        if( key != null )
+        {
+        buf.append(key);
+        buf.append("=");
+        }
+        buf.append(value);
+        buf.append("\n");
+        idx++;
+    }
+    return buf.toString();
     }
 
@@ -89,15 +89,15 @@
      */
     public void store(URL requestURL) {
-	loaded = true;
-	StorageManager.getInstance().put(requestURL, this);
+    loaded = true;
+    StorageManager.getInstance().put(requestURL, this);
     }
-    
+
     /**
      * Looks up the requested URL in the cache
-     * @param requestURL The requested URL 
+     * @param requestURL The requested URL
      * @return The response, if available
      */
     public static HttpResponse lookup(URL requestURL) {
-	return StorageManager.getInstance().get(requestURL);
+    return StorageManager.getInstance().get(requestURL);
     }
 }
Index: /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/MyHtmlBlockPanel.java
===================================================================
--- /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/MyHtmlBlockPanel.java	(revision 12777)
+++ /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/MyHtmlBlockPanel.java	(revision 12778)
@@ -43,5 +43,5 @@
             this.rblock = null;
         }
-        
+
         this.invalidate();
         this.validateAll();
Index: /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/OpenLayersLayer.java
===================================================================
--- /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/OpenLayersLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/OpenLayersLayer.java	(revision 12778)
@@ -21,7 +21,7 @@
 /**
  * Class that displays a OpenLayers layer.
- * 
+ *
  * @author Francisco R. Santos <frsantos@gmail.com>
- * 
+ *
  */
 public class OpenLayersLayer extends Layer implements PreferenceChangedListener, PropertyChangeListener {
@@ -33,14 +33,14 @@
      */
     public OpenLayersLayer() {
-	super("OpenLayers");
-	
-	this.browser = new Browser(OpenLayersPlugin.pluginDir + "yahoo.html");
-        
-	if( Main.map != null )
-	{
-	    LatLon bottomLeft = Main.map.mapView.getLatLon(0,Main.map.mapView.getHeight());
-	    LatLon topRight = Main.map.mapView.getLatLon(Main.map.mapView.getWidth(), 0);
-	    browser.executeAsyncScript("zoomMapToExtent(" + bottomLeft.lon() + "," + bottomLeft.lat() + "," + topRight.lon() + "," + topRight.lat() + ")");
-	}
+    super("OpenLayers");
+
+    this.browser = new Browser(OpenLayersPlugin.pluginDir + "yahoo.html");
+
+    if( Main.map != null )
+    {
+        LatLon bottomLeft = Main.map.mapView.getLatLon(0,Main.map.mapView.getHeight());
+        LatLon topRight = Main.map.mapView.getLatLon(Main.map.mapView.getWidth(), 0);
+        browser.executeAsyncScript("zoomMapToExtent(" + bottomLeft.lon() + "," + bottomLeft.lat() + "," + topRight.lon() + "," + topRight.lat() + ")");
+    }
     }
 
@@ -50,6 +50,6 @@
     @Override
     public void paint(Graphics g, MapView mv) {
-	setSize(Main.map.mapView.getSize());
-	browser.paint(g);
+    setSize(Main.map.mapView.getSize());
+    browser.paint(g);
     }
 
@@ -58,37 +58,37 @@
      */
     public void setSize(Dimension dim) {
-	browser.setSize(dim);
+    browser.setSize(dim);
     }
-    
+
     @Override
     public Icon getIcon() {
-	return ImageProvider.get("OpenLayers.png");
+    return ImageProvider.get("OpenLayers.png");
     }
 
     @Override
     public Object getInfoComponent() {
-	return null;
+    return null;
     }
 
     @Override
     public Component[] getMenuEntries() {
-	return new Component[] {
-		new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
-		new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
-		new JSeparator(),
-		// color,
-		new JMenuItem(new RenameLayerAction(associatedFile, this)),
-		new JSeparator(),
-		new JMenuItem(new LayerListPopup.InfoAction(this)) };
+    return new Component[] {
+        new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
+        new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
+        new JSeparator(),
+        // color,
+        new JMenuItem(new RenameLayerAction(associatedFile, this)),
+        new JSeparator(),
+        new JMenuItem(new LayerListPopup.InfoAction(this)) };
     }
 
     @Override
     public String getToolTipText() {
-	return null;
+    return null;
     }
 
     @Override
     public boolean isMergable(Layer other) {
-	return false;
+    return false;
     }
 
@@ -103,11 +103,11 @@
     @Override
     public void destroy() {
-	Main.pref.listener.remove(this);
+    Main.pref.listener.remove(this);
 
-	if( Main.map != null )
-	    Main.map.mapView.removePropertyChangeListener(this);
-	
-	OpenLayersPlugin.layer = null;
-	StorageManager.flush();
+    if( Main.map != null )
+        Main.map.mapView.removePropertyChangeListener(this);
+
+    OpenLayersPlugin.layer = null;
+    StorageManager.flush();
     }
 
@@ -116,13 +116,13 @@
 
     public void propertyChange(PropertyChangeEvent evt) {
-	if( !visible )
-	    return;
-	
+    if( !visible )
+        return;
+
         String prop = evt.getPropertyName();
-	if ("center".equals(prop) || "scale".equals(prop)) {
-	    zoomToMapView();
-	}
+    if ("center".equals(prop) || "scale".equals(prop)) {
+        zoomToMapView();
     }
-    
+    }
+
     public void zoomToMapView()
     {
@@ -133,5 +133,5 @@
         {
             // TODO wrong calculations
-            
+
             // Get actual extent from browser
             NativeArray array = (NativeArray)value;
@@ -140,12 +140,12 @@
             double right  = ((Double)array.get(2, null)).doubleValue();
             double top    = ((Double)array.get(3, null)).doubleValue();
-	    bottomLeft = new LatLon( bottom, left );
-	    topRight   = new LatLon( top, right);
-	    
-	    BoundingXYVisitor v = new BoundingXYVisitor();
-	    v.visit(Main.proj.latlon2eastNorth(bottomLeft));
-	    v.visit(Main.proj.latlon2eastNorth(topRight));
-	    System.out.println("Recalculating position (" + left + "," + bottom + "," + right + "," + top + ")");
-	    Main.map.mapView.recalculateCenterScale(v);
+        bottomLeft = new LatLon( bottom, left );
+        topRight   = new LatLon( top, right);
+
+        BoundingXYVisitor v = new BoundingXYVisitor();
+        v.visit(Main.proj.latlon2eastNorth(bottomLeft));
+        v.visit(Main.proj.latlon2eastNorth(topRight));
+        System.out.println("Recalculating position (" + left + "," + bottom + "," + right + "," + top + ")");
+        Main.map.mapView.recalculateCenterScale(v);
         }
     }
Index: /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/OpenLayersPlugin.java
===================================================================
--- /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/OpenLayersPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/OpenLayersPlugin.java	(revision 12778)
@@ -14,7 +14,7 @@
 /**
  * Main class for the OpenLayers plugin.
- * 
+ *
  * @author Francisco R. Santos <frsantos@gmail.com>
- * 
+ *
  */
 public class OpenLayersPlugin extends Plugin {
@@ -25,38 +25,38 @@
 
     public OpenLayersPlugin() {
-	pluginDir = getPluginDir();
-	try {
-	    copy("/resources/yahoo.html", "yahoo.html");
-	} catch (FileNotFoundException e) {
-	    // TODO Auto-generated catch block
-	    e.printStackTrace();
-	} catch (IOException e) {
-	    // TODO Auto-generated catch block
-	    e.printStackTrace();
-	}
-	StorageManager.initStorage( pluginDir );
-	refreshMenu();
+    pluginDir = getPluginDir();
+    try {
+        copy("/resources/yahoo.html", "yahoo.html");
+    } catch (FileNotFoundException e) {
+        // TODO Auto-generated catch block
+        e.printStackTrace();
+    } catch (IOException e) {
+        // TODO Auto-generated catch block
+        e.printStackTrace();
     }
-    
+    StorageManager.initStorage( pluginDir );
+    refreshMenu();
+    }
+
     public static void refreshMenu() {
-	JMenuBar menuBar = Main.main.menu;
-	if (menu == null) {
-		menu = new JMenu(tr("OpenLayers"));
-		menuBar.add(menu, 5);
-	} else {
-		menu.removeAll();
-	}
-	
-	menu.add(new JMenuItem(new ShowOpenLayersAction("Yahoo")));
+    JMenuBar menuBar = Main.main.menu;
+    if (menu == null) {
+        menu = new JMenu(tr("OpenLayers"));
+        menuBar.add(menu, 5);
+    } else {
+        menu.removeAll();
+    }
+
+    menu.add(new JMenuItem(new ShowOpenLayersAction("Yahoo")));
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.plugins.Plugin#getPreferenceSetting()
      */
     @Override
     public PreferenceSetting getPreferenceSetting() {
-	return null;
+    return null;
     }
 
Index: /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/ShowOpenLayersAction.java
===================================================================
--- /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/ShowOpenLayersAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/ShowOpenLayersAction.java	(revision 12778)
@@ -10,22 +10,22 @@
 
     public ShowOpenLayersAction(String name) {
-	super(name, "OpenLayers", "Show layer" + name, 0, 0, false);
+    super(name, "OpenLayers", "Show layer" + name, 0, 0, false);
     }
 
     public void actionPerformed(ActionEvent e) {
-	final OpenLayersLayer layer = OpenLayersPlugin.layer != null ? OpenLayersPlugin.layer : new OpenLayersLayer();
-	OpenLayersPlugin.layer = layer;
-	Main.main.addLayer(layer);
-	
-	EventQueue.invokeLater(new Runnable() {
-	    public void run() {
-		layer.setSize(Main.map.mapView.getSize());
-	    }
-	});
-	    
-	// Get notifications of scale and position
-	Main.map.mapView.addPropertyChangeListener("scale", layer);
-	Main.map.mapView.addPropertyChangeListener("center", layer);
-	
+    final OpenLayersLayer layer = OpenLayersPlugin.layer != null ? OpenLayersPlugin.layer : new OpenLayersLayer();
+    OpenLayersPlugin.layer = layer;
+    Main.main.addLayer(layer);
+
+    EventQueue.invokeLater(new Runnable() {
+        public void run() {
+        layer.setSize(Main.map.mapView.getSize());
+        }
+    });
+
+    // Get notifications of scale and position
+    Main.map.mapView.addPropertyChangeListener("scale", layer);
+    Main.map.mapView.addPropertyChangeListener("center", layer);
+
     }
 };
Index: /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/StorageManager.java
===================================================================
--- /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/StorageManager.java	(revision 12777)
+++ /applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/StorageManager.java	(revision 12778)
@@ -10,52 +10,52 @@
  * too big, with many jars, it should be replaced for a hand-made storage to
  * disk.
- * 
+ *
  * @author frsantos
- * 
+ *
  */
 public class StorageManager {
 
     private Cache cache;
-    
+
     private static StorageManager storage;
-    
+
     public static void initStorage(String basedir)
     {
-	if( storage != null ) storage.dispose();
-	
-	storage = new StorageManager(basedir);
+    if( storage != null ) storage.dispose();
+
+    storage = new StorageManager(basedir);
     }
-    
+
     protected StorageManager(String basedir)
     {
-	System.setProperty("net.sf.ehcache.enableShutdownHook", "true"); 
-	cache = new Cache("OpenLayers", 500, MemoryStoreEvictionPolicy.LRU, true, basedir + "cache", false, 300*24*7, 300, true, 3600*24*7, null);
-	CacheManager.getInstance().addCache(cache);
+    System.setProperty("net.sf.ehcache.enableShutdownHook", "true");
+    cache = new Cache("OpenLayers", 500, MemoryStoreEvictionPolicy.LRU, true, basedir + "cache", false, 300*24*7, 300, true, 3600*24*7, null);
+    CacheManager.getInstance().addCache(cache);
     }
-    
+
     protected void dispose()
     {
-	if( cache != null )
-	    cache.dispose();
+    if( cache != null )
+        cache.dispose();
     }
-    
+
     public static StorageManager getInstance()
     {
-	return storage;
+    return storage;
     }
-    
+
     public HttpResponse get(URL key)
     {
-	Element element = cache.get(key);
-	if( element != null )
-	    return (HttpResponse)element.getObjectValue();
-	
-	return null;
+    Element element = cache.get(key);
+    if( element != null )
+        return (HttpResponse)element.getObjectValue();
+
+    return null;
     }
-    
+
     public void put(URL key, HttpResponse value)
     {
-	Element element = new Element(key, value);
-	cache.put(element);
+    Element element = new Element(key, value);
+    cache.put(element);
     }
 
@@ -64,6 +64,6 @@
      */
     public static void flush() {
-	if( storage != null )
-	    storage.cache.flush();
+    if( storage != null )
+        storage.cache.flush();
     }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/ConfigKeys.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/ConfigKeys.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/ConfigKeys.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -29,10 +29,10 @@
 
 public class ConfigKeys {
-	public static final String OSB_API_DISABLED = "osb.api.disabled";
-	public static final String OSB_API_URI_CLOSE = "osb.uri.close";
-	public static final String OSB_API_URI_EDIT = "osb.uri.edit";
-	public static final String OSB_API_URI_DOWNLOAD = "osb.uri.download";
-	public static final String OSB_API_URI_NEW = "osb.uri.new";
-	public static final String OSB_NICKNAME = "osb.nickname";
-	public static final String OSB_AUTO_DOWNLOAD = "osb.auto_download";
+    public static final String OSB_API_DISABLED = "osb.api.disabled";
+    public static final String OSB_API_URI_CLOSE = "osb.uri.close";
+    public static final String OSB_API_URI_EDIT = "osb.uri.edit";
+    public static final String OSB_API_URI_DOWNLOAD = "osb.uri.download";
+    public static final String OSB_API_URI_NEW = "osb.uri.new";
+    public static final String OSB_NICKNAME = "osb.nickname";
+    public static final String OSB_AUTO_DOWNLOAD = "osb.auto_download";
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbDownloadLoop.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbDownloadLoop.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbDownloadLoop.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -36,73 +36,73 @@
 
 public class OsbDownloadLoop extends Thread {
-	
-	private static OsbDownloadLoop instance;
-	
-	private long countdown = TimeUnit.SECONDS.toMillis(1);
-	
-	private boolean downloadDone = false;
-	
-	private final int INTERVAL = 100;
-	
-	private OsbPlugin plugin;
-	
-	private Point2D lastCenter;
-	
-	public OsbDownloadLoop() {
-	    setName(tr("OpenStreetBugs download loop"));
-		start();
-	}
-	
-	public static synchronized OsbDownloadLoop getInstance() {
-		if(instance == null) {
-			instance = new OsbDownloadLoop();
-		}
-		return instance;
-	}
-	
-	@Override
-	public void run() {
-		try {
-			while(true) {
-				countdown -= INTERVAL;
-				
-				// if the center of the map has changed, the user has dragged or
-				// zoomed the map
-				if(Main.map != null && Main.map.mapView != null) {
-					Point2D currentCenter = Main.map.mapView.getCenter();
-					if(currentCenter != null && !currentCenter.equals(lastCenter)) {
-						resetCountdown();
-						lastCenter = currentCenter;
-					}
-				}
-				
-				// auto download if configured
-				if( Main.pref.getBoolean(ConfigKeys.OSB_AUTO_DOWNLOAD) && OsbPlugin.active ) {
-					if(countdown < 0) {
-						if(!downloadDone) {
-							if(plugin != null) {
-								plugin.updateData();
-								downloadDone = true;
-							}
-						} else {
-							countdown = -1;
-						}
-					}
-				}
-				
-				Thread.sleep(INTERVAL);
-			}
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-	}
-	
-	public void resetCountdown() {
-		downloadDone = false;
-		countdown = TimeUnit.SECONDS.toMillis(1);
-	}
 
-	public void setPlugin(OsbPlugin plugin) {
-		this.plugin = plugin;
-	}
+    private static OsbDownloadLoop instance;
+
+    private long countdown = TimeUnit.SECONDS.toMillis(1);
+
+    private boolean downloadDone = false;
+
+    private final int INTERVAL = 100;
+
+    private OsbPlugin plugin;
+
+    private Point2D lastCenter;
+
+    public OsbDownloadLoop() {
+        setName(tr("OpenStreetBugs download loop"));
+        start();
+    }
+
+    public static synchronized OsbDownloadLoop getInstance() {
+        if(instance == null) {
+            instance = new OsbDownloadLoop();
+        }
+        return instance;
+    }
+
+    @Override
+    public void run() {
+        try {
+            while(true) {
+                countdown -= INTERVAL;
+
+                // if the center of the map has changed, the user has dragged or
+                // zoomed the map
+                if(Main.map != null && Main.map.mapView != null) {
+                    Point2D currentCenter = Main.map.mapView.getCenter();
+                    if(currentCenter != null && !currentCenter.equals(lastCenter)) {
+                        resetCountdown();
+                        lastCenter = currentCenter;
+                    }
+                }
+
+                // auto download if configured
+                if( Main.pref.getBoolean(ConfigKeys.OSB_AUTO_DOWNLOAD) && OsbPlugin.active ) {
+                    if(countdown < 0) {
+                        if(!downloadDone) {
+                            if(plugin != null) {
+                                plugin.updateData();
+                                downloadDone = true;
+                            }
+                        } else {
+                            countdown = -1;
+                        }
+                    }
+                }
+
+                Thread.sleep(INTERVAL);
+            }
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void resetCountdown() {
+        downloadDone = false;
+        countdown = TimeUnit.SECONDS.toMillis(1);
+    }
+
+    public void setPlugin(OsbPlugin plugin) {
+        this.plugin = plugin;
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbLayer.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbLayer.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -62,31 +62,31 @@
 
 public class OsbLayer extends Layer implements MouseListener {
-	
-	private DataSet data;
-	
-	private Collection<? extends OsmPrimitive> selection;
-	
-	private JToolTip tooltip = new JToolTip();
-	
-	public OsbLayer(DataSet dataSet, String name) {
-		super(name);
-		this.data = dataSet;
-		DataSet.selListeners.add(new SelectionChangedListener() {
-			public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
-				selection = newSelection;
-			}
-		});
-		
-		Main.map.mapView.addMouseListener(this);
-	}
-	
-	@Override
-	public Object getInfoComponent() {
-		return getToolTipText();
-	}
-
-	@Override
-	public Component[] getMenuEntries() {
-		return new Component[]{
+
+    private DataSet data;
+
+    private Collection<? extends OsmPrimitive> selection;
+
+    private JToolTip tooltip = new JToolTip();
+
+    public OsbLayer(DataSet dataSet, String name) {
+        super(name);
+        this.data = dataSet;
+        DataSet.selListeners.add(new SelectionChangedListener() {
+            public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
+                selection = newSelection;
+            }
+        });
+
+        Main.map.mapView.addMouseListener(this);
+    }
+
+    @Override
+    public Object getInfoComponent() {
+        return getToolTipText();
+    }
+
+    @Override
+    public Component[] getMenuEntries() {
+        return new Component[]{
                 new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
                 new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
@@ -95,132 +95,132 @@
                 new JSeparator(),
                 new JMenuItem(new LayerListPopup.InfoAction(this))};
-	}
-
-	@Override
-	public String getToolTipText() {
-		return tr("Displays OpenStreetBugs issues");
-	}
-
-	@Override
-	public boolean isMergable(Layer other) {
-		return false;
-	}
-
-	@Override
-	public void mergeFrom(Layer from) {}
-
-	@Override
-	public void paint(Graphics g, MapView mv) {
-	    Object[] nodes = data.nodes.toArray();
-		for (int i = 0; i < nodes.length; i++) {
-		    Node node = (Node) nodes[i];
-		    
-			// don't paint deleted nodes
-			if(node.deleted) {
-				continue;
-			}
-			
-			Point p = mv.getPoint(node.eastNorth);
-			
-			ImageIcon icon = OsbPlugin.loadIcon("icon_error16.png");
-			if("1".equals(node.get("state"))) {
-	        	icon = OsbPlugin.loadIcon("icon_valid16.png");
-	        }
-			int width = icon.getIconWidth();
-			int height = icon.getIconHeight();
-			
-			g.drawImage(icon.getImage(), p.x - (width / 2), p.y - (height / 2), new ImageObserver() {
-				public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
-					return false;
-				}
-			});
-			
-
-			if(selection != null && selection.contains(node)) {
-				// draw description
-				String desc = node.get("note");
-				if(desc != null) {
-					// format with html
-					StringBuilder sb = new StringBuilder("<html>");
-					//sb.append(desc.replaceAll("\\|", "<br>"));
-					sb.append(desc.replaceAll("<hr />", "<hr>"));
-					sb.append("</html>");
-					desc = sb.toString();
-					
-					// determine tooltip dimensions
-					int tooltipWidth = 0;
-					Rectangle2D fontBounds = null;
-					String[] lines = desc.split("<hr>");
-					for (int j = 0; j < lines.length; j++) {
-						String line = lines[j];
-						fontBounds = g.getFontMetrics().getStringBounds(line, g);
-						tooltipWidth = Math.max(tooltipWidth, (int)fontBounds.getWidth());
-					}
-
-					// FIXME hiehgt calculations doesn't work with all LAFs
-					int lineCount = lines.length;
-					int HR_SIZE = 10;
-					int tooltipHeight = lineCount * (int)fontBounds.getHeight() + HR_SIZE * (lineCount - 1); 
-					
-					// draw description as a tooltip
-					tooltip.setTipText(desc);
-					tooltip.setSize(tooltipWidth+10, tooltipHeight + 6);
-					
-					int tx = p.x + (width / 2) + 5;
-					int ty = (int)(p.y - height / 2);
-					g.translate(tx, ty);
-					tooltip.paint(g);
-					g.translate(-tx, -ty);
-				}
-
-				// draw selection border
-				g.setColor(ColorHelper.html2color(Main.pref.get("color.selected")));
-				g.drawRect(p.x - (width / 2), p.y - (height / 2), 16, 16);
-			}
-		}
-	}
-	
-	@Override
-	public void visitBoundingBox(BoundingXYVisitor v) {}
-
-	@Override
-	public Icon getIcon() {
-		return OsbPlugin.loadIcon("icon_error16.png");
-	}
-	
-	private Node getNearestNode(Point p) {
-		double snapDistance = 10;
-		double minDistanceSq = Double.MAX_VALUE;
-		Node minPrimitive = null;
-		for (Node n : data.nodes) {
-			if (n.deleted || n.incomplete)
-				continue;
-			Point sp = Main.map.mapView.getPoint(n.eastNorth);
-			double dist = p.distanceSq(sp);
-			if (minDistanceSq > dist && p.distance(sp) < snapDistance) {
-				minDistanceSq = p.distanceSq(sp);
-				minPrimitive = n;
-			}
-			// prefer already selected node when multiple nodes on one point
-			else if(minDistanceSq == dist && n.selected && !minPrimitive.selected)
-			{
-				minPrimitive = n;
-			}
-		}
-		return minPrimitive;
-	}
-
-	public void mouseClicked(MouseEvent e) {
-		if(e.getButton() == MouseEvent.BUTTON1) {
-			if(Main.map.mapView.getActiveLayer() == this) {
-				Node n = (Node) getNearestNode(e.getPoint());
-				if(data.nodes.contains(n)) {
-					data.setSelected(n);
-				}
-			}
-		}
-	}
-	
-	public void mousePressed(MouseEvent e) {
+    }
+
+    @Override
+    public String getToolTipText() {
+        return tr("Displays OpenStreetBugs issues");
+    }
+
+    @Override
+    public boolean isMergable(Layer other) {
+        return false;
+    }
+
+    @Override
+    public void mergeFrom(Layer from) {}
+
+    @Override
+    public void paint(Graphics g, MapView mv) {
+        Object[] nodes = data.nodes.toArray();
+        for (int i = 0; i < nodes.length; i++) {
+            Node node = (Node) nodes[i];
+
+            // don't paint deleted nodes
+            if(node.deleted) {
+                continue;
+            }
+
+            Point p = mv.getPoint(node.eastNorth);
+
+            ImageIcon icon = OsbPlugin.loadIcon("icon_error16.png");
+            if("1".equals(node.get("state"))) {
+                icon = OsbPlugin.loadIcon("icon_valid16.png");
+            }
+            int width = icon.getIconWidth();
+            int height = icon.getIconHeight();
+
+            g.drawImage(icon.getImage(), p.x - (width / 2), p.y - (height / 2), new ImageObserver() {
+                public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+                    return false;
+                }
+            });
+
+
+            if(selection != null && selection.contains(node)) {
+                // draw description
+                String desc = node.get("note");
+                if(desc != null) {
+                    // format with html
+                    StringBuilder sb = new StringBuilder("<html>");
+                    //sb.append(desc.replaceAll("\\|", "<br>"));
+                    sb.append(desc.replaceAll("<hr />", "<hr>"));
+                    sb.append("</html>");
+                    desc = sb.toString();
+
+                    // determine tooltip dimensions
+                    int tooltipWidth = 0;
+                    Rectangle2D fontBounds = null;
+                    String[] lines = desc.split("<hr>");
+                    for (int j = 0; j < lines.length; j++) {
+                        String line = lines[j];
+                        fontBounds = g.getFontMetrics().getStringBounds(line, g);
+                        tooltipWidth = Math.max(tooltipWidth, (int)fontBounds.getWidth());
+                    }
+
+                    // FIXME hiehgt calculations doesn't work with all LAFs
+                    int lineCount = lines.length;
+                    int HR_SIZE = 10;
+                    int tooltipHeight = lineCount * (int)fontBounds.getHeight() + HR_SIZE * (lineCount - 1);
+
+                    // draw description as a tooltip
+                    tooltip.setTipText(desc);
+                    tooltip.setSize(tooltipWidth+10, tooltipHeight + 6);
+
+                    int tx = p.x + (width / 2) + 5;
+                    int ty = (int)(p.y - height / 2);
+                    g.translate(tx, ty);
+                    tooltip.paint(g);
+                    g.translate(-tx, -ty);
+                }
+
+                // draw selection border
+                g.setColor(ColorHelper.html2color(Main.pref.get("color.selected")));
+                g.drawRect(p.x - (width / 2), p.y - (height / 2), 16, 16);
+            }
+        }
+    }
+
+    @Override
+    public void visitBoundingBox(BoundingXYVisitor v) {}
+
+    @Override
+    public Icon getIcon() {
+        return OsbPlugin.loadIcon("icon_error16.png");
+    }
+
+    private Node getNearestNode(Point p) {
+        double snapDistance = 10;
+        double minDistanceSq = Double.MAX_VALUE;
+        Node minPrimitive = null;
+        for (Node n : data.nodes) {
+            if (n.deleted || n.incomplete)
+                continue;
+            Point sp = Main.map.mapView.getPoint(n.eastNorth);
+            double dist = p.distanceSq(sp);
+            if (minDistanceSq > dist && p.distance(sp) < snapDistance) {
+                minDistanceSq = p.distanceSq(sp);
+                minPrimitive = n;
+            }
+            // prefer already selected node when multiple nodes on one point
+            else if(minDistanceSq == dist && n.selected && !minPrimitive.selected)
+            {
+                minPrimitive = n;
+            }
+        }
+        return minPrimitive;
+    }
+
+    public void mouseClicked(MouseEvent e) {
+        if(e.getButton() == MouseEvent.BUTTON1) {
+            if(Main.map.mapView.getActiveLayer() == this) {
+                Node n = (Node) getNearestNode(e.getPoint());
+                if(data.nodes.contains(n)) {
+                    data.setSelected(n);
+                }
+            }
+        }
+    }
+
+    public void mousePressed(MouseEvent e) {
         mayTriggerPopup(e);
     }
@@ -229,19 +229,19 @@
         mayTriggerPopup(e);
     }
-    
+
     private void mayTriggerPopup(MouseEvent e) {
         if(e.isPopupTrigger()) {
-        	if(Main.map.mapView.getActiveLayer() == this) {
-				Node n = (Node) getNearestNode(e.getPoint());
-				OsbAction.setSelectedNode(n);
-				if(data.nodes.contains(n)) {
-					PopupFactory.createPopup(n).show(e.getComponent(), e.getX(), e.getY());
-				}
-			}
-        }
-    }
-	
-	public void mouseEntered(MouseEvent e) {}
-
-	public void mouseExited(MouseEvent e) {}
+            if(Main.map.mapView.getActiveLayer() == this) {
+                Node n = (Node) getNearestNode(e.getPoint());
+                OsbAction.setSelectedNode(n);
+                if(data.nodes.contains(n)) {
+                    PopupFactory.createPopup(n).show(e.getComponent(), e.getX(), e.getY());
+                }
+            }
+        }
+    }
+
+    public void mouseEntered(MouseEvent e) {}
+
+    public void mouseExited(MouseEvent e) {}
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbObserver.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbObserver.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbObserver.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -31,4 +31,4 @@
 
 public interface OsbObserver {
-	public void update(DataSet dataset);
+    public void update(DataSet dataset);
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbPlugin.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbPlugin.java	(revision 12778)
@@ -60,187 +60,187 @@
 public class OsbPlugin extends Plugin implements LayerChangeListener {
 
-	private DataSet dataSet;
-	
-	private UploadHook uploadHook;
-	
-	private OsbDialog dialog;
-	
-	private OsbLayer layer;
-	
-	public static boolean active = false;
-	
-	private DownloadAction download = new DownloadAction();
-	
-	public OsbPlugin() {
-	    super();
-		initConfig();
-		dataSet = new DataSet();
-		uploadHook = new OsbUploadHook();
-		dialog = new OsbDialog(this);
+    private DataSet dataSet;
+    
+    private UploadHook uploadHook;
+    
+    private OsbDialog dialog;
+    
+    private OsbLayer layer;
+    
+    public static boolean active = false;
+    
+    private DownloadAction download = new DownloadAction();
+    
+    public OsbPlugin() {
+        super();
+        initConfig();
+        dataSet = new DataSet();
+        uploadHook = new OsbUploadHook();
+        dialog = new OsbDialog(this);
         OsbLayer.listeners.add(dialog);
         OsbLayer.listeners.add(this);
-	}
-	
-	private void initConfig() {
-		String debug = Main.pref.get(ConfigKeys.OSB_API_DISABLED);
-		if(debug == null || debug.length() == 0) {
-			debug = "false";
-			Main.pref.put(ConfigKeys.OSB_API_DISABLED, debug);
-		}
-		
-		String uri = Main.pref.get(ConfigKeys.OSB_API_URI_EDIT);
-		if(uri == null || uri.length() == 0) {
-			uri = "http://openstreetbugs.appspot.com/editPOIexec";
-			Main.pref.put(ConfigKeys.OSB_API_URI_EDIT, uri);
-		}
-		
-		uri = Main.pref.get(ConfigKeys.OSB_API_URI_CLOSE);
-		if(uri == null || uri.length() == 0) {
-			uri = "http://openstreetbugs.appspot.com/closePOIexec";
-			Main.pref.put(ConfigKeys.OSB_API_URI_CLOSE, uri);
-		}
-		
-		uri = Main.pref.get(ConfigKeys.OSB_API_URI_DOWNLOAD);
-		if(uri == null || uri.length() == 0) {
-			uri = "http://openstreetbugs.appspot.com/getBugs";
-			Main.pref.put(ConfigKeys.OSB_API_URI_DOWNLOAD, uri);
-		}
-		
-		uri = Main.pref.get(ConfigKeys.OSB_API_URI_NEW);
-		if(uri == null || uri.length() == 0) {
-			uri = "http://openstreetbugs.appspot.com/addPOIexec";
-			Main.pref.put(ConfigKeys.OSB_API_URI_NEW, uri);
-		}
-		
-		String auto_download = Main.pref.get(ConfigKeys.OSB_AUTO_DOWNLOAD);
-		if(auto_download == null || auto_download.length() == 0) {
-			auto_download = "true";
-			Main.pref.put(ConfigKeys.OSB_AUTO_DOWNLOAD, auto_download);
-		}
-	}
-
-	/**
-	 * Determines the bounds of the current selected layer
-	 * @return
-	 */
-	protected Bounds bounds(){
-		MapView mv = Main.map.mapView;
-		return new Bounds(
-			mv.getLatLon(0, mv.getHeight()),
-			mv.getLatLon(mv.getWidth(), 0));
-	}
-	
-	public void updateData() {
-		// determine the bounds of the currently visible area
-		Bounds bounds = null;
-		try {
-			bounds = bounds();
-		} catch (Exception e) {
-			// something went wrong, probably the mapview isn't fully initialized
-			System.err.println("OpenStreetBugs: Couldn't determine bounds of currently visible rect. Cancel auto update");
-			return;
-		}
-		
-		try {
-			// download the data
-			download.execute(dataSet, bounds);
-
-			// display the parsed data
-			if(!dataSet.nodes.isEmpty()) {
-				updateGui();
-			}
-		} catch (Exception e) {
-			JOptionPane.showMessageDialog(Main.parent, e.getMessage());
-			e.printStackTrace();
-		}
-	}
-	
-	public void updateGui() {
-		// update dialog
-		dialog.update(dataSet);
-		
-		// create a new layer if necessary
-		updateLayer(dataSet);
-		
-		// repaint view, so that changes get visible
-		Main.map.mapView.repaint();
-	}
-	
-	private void updateLayer(DataSet osbData) {
-		if(layer == null) {
-			layer = new OsbLayer(osbData, "OpenStreetBugs");
-			Main.main.addLayer(layer);
-		}
-	}
-
-	@Override
-	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-		if (oldFrame==null && newFrame!=null) { // map frame added
-			// add the dialog
-			newFrame.addToggleDialog(dialog);
-			
-			// add the upload hook
-			LinkedList<UploadHook> hooks = ((UploadAction) Main.main.menu.upload).uploadHooks;
-			hooks.add(0, uploadHook);
-			
-			// add a listener to the plugin toggle button
-			final JToggleButton toggle = (JToggleButton) dialog.action.button;
-			active = toggle.isSelected();
-			toggle.addActionListener(new ActionListener() {
-				private boolean download = true;
-				
-				public void actionPerformed(ActionEvent e) {
-					active = toggle.isSelected();
-					if (toggle.isSelected() && download) {
-						Main.worker.execute(new Runnable() {
-							public void run() {
-								updateData();
-							}
-						});
-						download = false;
-					}
-				}
-			});
-		} else if (oldFrame!=null && newFrame==null ) { // map frame removed
-			
-		}
-	}
-	
-	public static ImageIcon loadIcon(String name) {
-		URL url = OsbPlugin.class.getResource("/images/".concat(name));
-		return new ImageIcon(url);
-	}
-
-	public void activeLayerChange(Layer oldLayer, Layer newLayer) {}
-
-	public void layerAdded(Layer newLayer) {
-		if(newLayer instanceof OsmDataLayer) {
-			active = ((JToggleButton)dialog.action.button).isSelected();
-			
-			// start the auto download loop
-			OsbDownloadLoop.getInstance().setPlugin(this);
-		}
-	}
-
-	public void layerRemoved(Layer oldLayer) {
-		if(oldLayer == layer) {
-			layer = null;
-		}
-	}
-
-	public OsbLayer getLayer() {
-		return layer;
-	}
-
-	public void setLayer(OsbLayer layer) {
-		this.layer = layer;
-	}
-
-	public DataSet getDataSet() {
-		return dataSet;
-	}
-
-	public void setDataSet(DataSet dataSet) {
-		this.dataSet = dataSet;
-	}
+    }
+    
+    private void initConfig() {
+        String debug = Main.pref.get(ConfigKeys.OSB_API_DISABLED);
+        if(debug == null || debug.length() == 0) {
+            debug = "false";
+            Main.pref.put(ConfigKeys.OSB_API_DISABLED, debug);
+        }
+        
+        String uri = Main.pref.get(ConfigKeys.OSB_API_URI_EDIT);
+        if(uri == null || uri.length() == 0) {
+            uri = "http://openstreetbugs.appspot.com/editPOIexec";
+            Main.pref.put(ConfigKeys.OSB_API_URI_EDIT, uri);
+        }
+        
+        uri = Main.pref.get(ConfigKeys.OSB_API_URI_CLOSE);
+        if(uri == null || uri.length() == 0) {
+            uri = "http://openstreetbugs.appspot.com/closePOIexec";
+            Main.pref.put(ConfigKeys.OSB_API_URI_CLOSE, uri);
+        }
+        
+        uri = Main.pref.get(ConfigKeys.OSB_API_URI_DOWNLOAD);
+        if(uri == null || uri.length() == 0) {
+            uri = "http://openstreetbugs.appspot.com/getBugs";
+            Main.pref.put(ConfigKeys.OSB_API_URI_DOWNLOAD, uri);
+        }
+        
+        uri = Main.pref.get(ConfigKeys.OSB_API_URI_NEW);
+        if(uri == null || uri.length() == 0) {
+            uri = "http://openstreetbugs.appspot.com/addPOIexec";
+            Main.pref.put(ConfigKeys.OSB_API_URI_NEW, uri);
+        }
+        
+        String auto_download = Main.pref.get(ConfigKeys.OSB_AUTO_DOWNLOAD);
+        if(auto_download == null || auto_download.length() == 0) {
+            auto_download = "true";
+            Main.pref.put(ConfigKeys.OSB_AUTO_DOWNLOAD, auto_download);
+        }
+    }
+
+    /**
+     * Determines the bounds of the current selected layer
+     * @return
+     */
+    protected Bounds bounds(){
+        MapView mv = Main.map.mapView;
+        return new Bounds(
+            mv.getLatLon(0, mv.getHeight()),
+            mv.getLatLon(mv.getWidth(), 0));
+    }
+    
+    public void updateData() {
+        // determine the bounds of the currently visible area
+        Bounds bounds = null;
+        try {
+            bounds = bounds();
+        } catch (Exception e) {
+            // something went wrong, probably the mapview isn't fully initialized
+            System.err.println("OpenStreetBugs: Couldn't determine bounds of currently visible rect. Cancel auto update");
+            return;
+        }
+        
+        try {
+            // download the data
+            download.execute(dataSet, bounds);
+
+            // display the parsed data
+            if(!dataSet.nodes.isEmpty()) {
+                updateGui();
+            }
+        } catch (Exception e) {
+            JOptionPane.showMessageDialog(Main.parent, e.getMessage());
+            e.printStackTrace();
+        }
+    }
+    
+    public void updateGui() {
+        // update dialog
+        dialog.update(dataSet);
+        
+        // create a new layer if necessary
+        updateLayer(dataSet);
+        
+        // repaint view, so that changes get visible
+        Main.map.mapView.repaint();
+    }
+    
+    private void updateLayer(DataSet osbData) {
+        if(layer == null) {
+            layer = new OsbLayer(osbData, "OpenStreetBugs");
+            Main.main.addLayer(layer);
+        }
+    }
+
+    @Override
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+        if (oldFrame==null && newFrame!=null) { // map frame added
+            // add the dialog
+            newFrame.addToggleDialog(dialog);
+            
+            // add the upload hook
+            LinkedList<UploadHook> hooks = ((UploadAction) Main.main.menu.upload).uploadHooks;
+            hooks.add(0, uploadHook);
+            
+            // add a listener to the plugin toggle button
+            final JToggleButton toggle = (JToggleButton) dialog.action.button;
+            active = toggle.isSelected();
+            toggle.addActionListener(new ActionListener() {
+                private boolean download = true;
+                
+                public void actionPerformed(ActionEvent e) {
+                    active = toggle.isSelected();
+                    if (toggle.isSelected() && download) {
+                        Main.worker.execute(new Runnable() {
+                            public void run() {
+                                updateData();
+                            }
+                        });
+                        download = false;
+                    }
+                }
+            });
+        } else if (oldFrame!=null && newFrame==null ) { // map frame removed
+            
+        }
+    }
+    
+    public static ImageIcon loadIcon(String name) {
+        URL url = OsbPlugin.class.getResource("/images/".concat(name));
+        return new ImageIcon(url);
+    }
+
+    public void activeLayerChange(Layer oldLayer, Layer newLayer) {}
+
+    public void layerAdded(Layer newLayer) {
+        if(newLayer instanceof OsmDataLayer) {
+            active = ((JToggleButton)dialog.action.button).isSelected();
+            
+            // start the auto download loop
+            OsbDownloadLoop.getInstance().setPlugin(this);
+        }
+    }
+
+    public void layerRemoved(Layer oldLayer) {
+        if(oldLayer == layer) {
+            layer = null;
+        }
+    }
+
+    public OsbLayer getLayer() {
+        return layer;
+    }
+
+    public void setLayer(OsbLayer layer) {
+        this.layer = layer;
+    }
+
+    public DataSet getDataSet() {
+        return dataSet;
+    }
+
+    public void setDataSet(DataSet dataSet) {
+        this.dataSet = dataSet;
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbUploadHook.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbUploadHook.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/OsbUploadHook.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -41,29 +41,29 @@
 public class OsbUploadHook implements UploadHook {
 
-	public boolean checkUpload(Collection<OsmPrimitive> add, Collection<OsmPrimitive> update,
-			Collection<OsmPrimitive> delete) 
-	{
-		boolean containsOsbData = checkOpenStreetBugs(add);
-		containsOsbData |= checkOpenStreetBugs(update);
-		containsOsbData |= checkOpenStreetBugs(delete);
-		if(containsOsbData) {
-			JOptionPane.showMessageDialog(Main.parent, 
-				tr("<html>The selected data contains data from OpenStreetBugs.<br>" +
-				"You cannot upload these data. Maybe you have selected the wrong layer?"), 
-				tr("Warning"), JOptionPane.WARNING_MESSAGE);
-			return false;
-		} else {
-			return true;
-		}
-	}
+    public boolean checkUpload(Collection<OsmPrimitive> add, Collection<OsmPrimitive> update,
+            Collection<OsmPrimitive> delete)
+    {
+        boolean containsOsbData = checkOpenStreetBugs(add);
+        containsOsbData |= checkOpenStreetBugs(update);
+        containsOsbData |= checkOpenStreetBugs(delete);
+        if(containsOsbData) {
+            JOptionPane.showMessageDialog(Main.parent,
+                tr("<html>The selected data contains data from OpenStreetBugs.<br>" +
+                "You cannot upload these data. Maybe you have selected the wrong layer?"),
+                tr("Warning"), JOptionPane.WARNING_MESSAGE);
+            return false;
+        } else {
+            return true;
+        }
+    }
 
-	private boolean checkOpenStreetBugs(Collection<OsmPrimitive> osmPrimitives) {
-		for (Iterator<OsmPrimitive> iterator = osmPrimitives.iterator(); iterator.hasNext();) {
-			OsmPrimitive osmPrimitive = iterator.next();
-			if(osmPrimitive.get("openstreetbug") != null) {
-				return true;
-			}
-		}
-		return false;
-	}
+    private boolean checkOpenStreetBugs(Collection<OsmPrimitive> osmPrimitives) {
+        for (Iterator<OsmPrimitive> iterator = osmPrimitives.iterator(); iterator.hasNext();) {
+            OsmPrimitive osmPrimitive = iterator.next();
+            if(osmPrimitive.get("openstreetbug") != null) {
+                return true;
+            }
+        }
+        return false;
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/CloseAction.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/CloseAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/CloseAction.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -40,30 +40,30 @@
 
 public class CloseAction {
-	
-	private final String CHARSET = "UTF-8";
-	
-	public void execute(Node n) throws IOException {
-		// create the URI for the data download
-		String uri = Main.pref.get(ConfigKeys.OSB_API_URI_CLOSE);
-		String post = new StringBuilder("id=")
-			.append(n.get("id"))
-			.toString();
-		
-		String result = null;
-		if(Main.pref.getBoolean(ConfigKeys.OSB_API_DISABLED)) {
-			result = "ok";
-		} else {
-			result = HttpUtils.post(uri, null, post, CHARSET);
-		}
-		
-		if("ok".equalsIgnoreCase(result)) {
-			n.put("state", "1");
-			Main.map.mapView.repaint();
-		} else {
-			JOptionPane.showMessageDialog(Main.parent,
-					tr("An error occurred: {0}", new Object[] {result}),
-					tr("Error"),
-					JOptionPane.ERROR_MESSAGE);
-		}
-	}
+
+    private final String CHARSET = "UTF-8";
+
+    public void execute(Node n) throws IOException {
+        // create the URI for the data download
+        String uri = Main.pref.get(ConfigKeys.OSB_API_URI_CLOSE);
+        String post = new StringBuilder("id=")
+            .append(n.get("id"))
+            .toString();
+
+        String result = null;
+        if(Main.pref.getBoolean(ConfigKeys.OSB_API_DISABLED)) {
+            result = "ok";
+        } else {
+            result = HttpUtils.post(uri, null, post, CHARSET);
+        }
+
+        if("ok".equalsIgnoreCase(result)) {
+            n.put("state", "1");
+            Main.map.mapView.repaint();
+        } else {
+            JOptionPane.showMessageDialog(Main.parent,
+                    tr("An error occurred: {0}", new Object[] {result}),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE);
+        }
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/DownloadAction.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/DownloadAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/DownloadAction.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -41,54 +41,54 @@
 
 public class DownloadAction {
-	
-	private final String CHARSET = "UTF-8";
-	
-	public void execute(DataSet dataset, Bounds bounds) throws IOException {
-		// create the URI for the data download
-		String uri = Main.pref.get(ConfigKeys.OSB_API_URI_DOWNLOAD);
 
-		// check zoom level
-		if(Main.map.mapView.zoom() > 15 || Main.map.mapView.zoom() < 9) {
-			return;
-		} 
-		
-		// add query params to the uri
-		StringBuilder sb = new StringBuilder(uri)
-			.append("?b=").append(bounds.min.lat())
-			.append("&t=").append(bounds.max.lat())
-			.append("&l=").append(bounds.min.lon())
-			.append("&r=").append(bounds.max.lon());
-		uri = sb.toString();
+    private final String CHARSET = "UTF-8";
 
-		// download the data
-		String content = HttpUtils.get(uri, null, CHARSET);
-		
-		// clear dataset
-		dataset.nodes.clear();
-		dataset.relations.clear();
-		dataset.ways.clear();
-		
-		// parse the data
-		parseData(dataset, content);
-	}
+    public void execute(DataSet dataset, Bounds bounds) throws IOException {
+        // create the URI for the data download
+        String uri = Main.pref.get(ConfigKeys.OSB_API_URI_DOWNLOAD);
 
-	private void parseData(DataSet dataSet, String content) {
-		String idPattern = "\\d+";
-		String floatPattern = "-?\\d+\\.\\d+";
-		String pattern = "putAJAXMarker\\(("+idPattern+"),("+floatPattern+"),("+floatPattern+"),\"(.*)\",([01])\\)";
-		Pattern p = Pattern.compile(pattern);
-		Matcher m = p.matcher(content);
-		while(m.find()) {
-			double lat = Double.parseDouble(m.group(3));
-			double lon = Double.parseDouble(m.group(2));
-			LatLon latlon = new LatLon(lat, lon); 
-			Node osmNode = new Node(latlon);
-			osmNode.id = Long.parseLong(m.group(1));
-			osmNode.put("id", m.group(1));
-			osmNode.put("note", m.group(4));
-			osmNode.put("openstreetbug", "FIXME");
-			osmNode.put("state", m.group(5));
-			dataSet.addPrimitive(osmNode);
-		} 
-	}
+        // check zoom level
+        if(Main.map.mapView.zoom() > 15 || Main.map.mapView.zoom() < 9) {
+            return;
+        }
+
+        // add query params to the uri
+        StringBuilder sb = new StringBuilder(uri)
+            .append("?b=").append(bounds.min.lat())
+            .append("&t=").append(bounds.max.lat())
+            .append("&l=").append(bounds.min.lon())
+            .append("&r=").append(bounds.max.lon());
+        uri = sb.toString();
+
+        // download the data
+        String content = HttpUtils.get(uri, null, CHARSET);
+
+        // clear dataset
+        dataset.nodes.clear();
+        dataset.relations.clear();
+        dataset.ways.clear();
+
+        // parse the data
+        parseData(dataset, content);
+    }
+
+    private void parseData(DataSet dataSet, String content) {
+        String idPattern = "\\d+";
+        String floatPattern = "-?\\d+\\.\\d+";
+        String pattern = "putAJAXMarker\\(("+idPattern+"),("+floatPattern+"),("+floatPattern+"),\"(.*)\",([01])\\)";
+        Pattern p = Pattern.compile(pattern);
+        Matcher m = p.matcher(content);
+        while(m.find()) {
+            double lat = Double.parseDouble(m.group(3));
+            double lon = Double.parseDouble(m.group(2));
+            LatLon latlon = new LatLon(lat, lon);
+            Node osmNode = new Node(latlon);
+            osmNode.id = Long.parseLong(m.group(1));
+            osmNode.put("id", m.group(1));
+            osmNode.put("note", m.group(4));
+            osmNode.put("openstreetbug", "FIXME");
+            osmNode.put("state", m.group(5));
+            dataSet.addPrimitive(osmNode);
+        }
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/EditAction.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/EditAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/EditAction.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -41,34 +41,34 @@
 
 public class EditAction {
-	
-	private final String CHARSET = "UTF-8";
-	
-	public void execute(Node n, String comment) throws IOException {
-		// create the URI for the data download
-		String uri = Main.pref.get(ConfigKeys.OSB_API_URI_EDIT);
-		String post = new StringBuilder("id=")
-			.append(n.get("id"))
-			.append("&text=")
-			.append(URLEncoder.encode(comment, CHARSET))
-			.toString();
-		
-		String result = null;
-		if(Main.pref.getBoolean(ConfigKeys.OSB_API_DISABLED)) {
-			result = "ok";
-		} else {
-			result = HttpUtils.post(uri, null, post, CHARSET);
-		}
 
-		if("ok".equalsIgnoreCase(result)) {
-			String desc = n.get("note");
-			desc = desc.concat("<hr />").concat(comment);
-			n.put("note", desc);
-			Main.map.mapView.repaint();
-		} else {
-			JOptionPane.showMessageDialog(Main.parent,
-					tr("An error occurred: {0}", new Object[] {result}),
-					tr("Error"),
-					JOptionPane.ERROR_MESSAGE);
-		}
-	}
+    private final String CHARSET = "UTF-8";
+
+    public void execute(Node n, String comment) throws IOException {
+        // create the URI for the data download
+        String uri = Main.pref.get(ConfigKeys.OSB_API_URI_EDIT);
+        String post = new StringBuilder("id=")
+            .append(n.get("id"))
+            .append("&text=")
+            .append(URLEncoder.encode(comment, CHARSET))
+            .toString();
+
+        String result = null;
+        if(Main.pref.getBoolean(ConfigKeys.OSB_API_DISABLED)) {
+            result = "ok";
+        } else {
+            result = HttpUtils.post(uri, null, post, CHARSET);
+        }
+
+        if("ok".equalsIgnoreCase(result)) {
+            String desc = n.get("note");
+            desc = desc.concat("<hr />").concat(comment);
+            n.put("note", desc);
+            Main.map.mapView.repaint();
+        } else {
+            JOptionPane.showMessageDialog(Main.parent,
+                    tr("An error occurred: {0}", new Object[] {result}),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE);
+        }
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/NewAction.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/NewAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/NewAction.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -43,44 +43,44 @@
 
 public class NewAction {
-	
-	private final String CHARSET = "UTF-8";
-	
-	public Node execute(Point p, String text) throws IOException {
-		// where has the issue been added
-		LatLon latlon = Main.map.mapView.getLatLon(p.x, p.y);
-		
-		// create the URI for the data download
-		String uri = Main.pref.get(ConfigKeys.OSB_API_URI_NEW);
-		
-		String post = new StringBuilder("lon=")
-			.append(latlon.lon())
-			.append("&lat=")
-			.append(latlon.lat())
-			.append("&text=")
-			.append(URLEncoder.encode(text, CHARSET))
-			.toString();
-		
-		String result = null;
-		if(Main.pref.getBoolean(ConfigKeys.OSB_API_DISABLED)) {
-			result = "ok 12345";
-		} else {
-			result = HttpUtils.post(uri, null, post, CHARSET);
-		}
-		
-		Pattern resultPattern = Pattern.compile("ok\\s+(\\d+)");
-		Matcher m = resultPattern.matcher(result);
-		String id = "-1";
-		if(m.matches()) {
-			id = m.group(1);
-		} else {
-			throw new RuntimeException(tr("Couldn't create new bug. Result: {0}" + result));
-		}
-		
-		Node osmNode = new Node(latlon);
-		osmNode.put("id", id);
-		osmNode.put("note", text);
-		osmNode.put("openstreetbug", "FIXME");
-		osmNode.put("state", "0");
-		return osmNode;
-	}
+
+    private final String CHARSET = "UTF-8";
+
+    public Node execute(Point p, String text) throws IOException {
+        // where has the issue been added
+        LatLon latlon = Main.map.mapView.getLatLon(p.x, p.y);
+
+        // create the URI for the data download
+        String uri = Main.pref.get(ConfigKeys.OSB_API_URI_NEW);
+
+        String post = new StringBuilder("lon=")
+            .append(latlon.lon())
+            .append("&lat=")
+            .append(latlon.lat())
+            .append("&text=")
+            .append(URLEncoder.encode(text, CHARSET))
+            .toString();
+
+        String result = null;
+        if(Main.pref.getBoolean(ConfigKeys.OSB_API_DISABLED)) {
+            result = "ok 12345";
+        } else {
+            result = HttpUtils.post(uri, null, post, CHARSET);
+        }
+
+        Pattern resultPattern = Pattern.compile("ok\\s+(\\d+)");
+        Matcher m = resultPattern.matcher(result);
+        String id = "-1";
+        if(m.matches()) {
+            id = m.group(1);
+        } else {
+            throw new RuntimeException(tr("Couldn't create new bug. Result: {0}" + result));
+        }
+
+        Node osmNode = new Node(latlon);
+        osmNode.put("id", id);
+        osmNode.put("note", text);
+        osmNode.put("openstreetbug", "FIXME");
+        osmNode.put("state", "0");
+        return osmNode;
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/util/HttpResponse.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/util/HttpResponse.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/util/HttpResponse.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/util/HttpUtils.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/util/HttpUtils.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/util/HttpUtils.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -51,5 +51,5 @@
             }
         }
-        
+
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         int length = -1;
@@ -59,8 +59,8 @@
             bos.write(b, 0, length);
         }
-        
+
         return new String(bos.toByteArray(), charset);
     }
-    
+
     public static HttpResponse getResponse(String url, Map<String, String> headers, String charset) throws IOException {
         URL page = new URL(url);
@@ -72,5 +72,5 @@
             }
         }
-        
+
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         int length = -1;
@@ -80,11 +80,11 @@
             bos.write(b, 0, length);
         }
-        
+
         HttpResponse response = new HttpResponse(new String(bos.toByteArray(), charset), con.getHeaderFields());
         return response;
     }
-    
+
     /**
-     * 
+     *
      * @param url
      * @param headers
@@ -105,10 +105,10 @@
             }
         }
-        
+
         //send the post
         OutputStream os = con.getOutputStream();
         os.write(content.getBytes("UTF-8"));
         os.flush();
-        
+
         // read the response
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -119,8 +119,8 @@
             bos.write(b, 0, length);
         }
-        
+
         return new String(bos.toByteArray(), responseCharset);
     }
-    
+
     /**
      * Adds a parameter to a given URI
@@ -137,9 +137,9 @@
             sb.append('?');
         }
-        
+
         sb.append(param);
         sb.append('=');
         sb.append(value);
-        
+
         return sb.toString();
     }
@@ -154,13 +154,13 @@
             }
         }
-        
+
         return con.getHeaderFields();
     }
-    
+
     public static String getHeaderField(Map<String, List<String>> headers, String headerField) {
         if(!headers.containsKey(headerField)) {
             return null;
         }
-        
+
         List<String> value = headers.get(headerField);
         if(value.size() == 1) {
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbDialog.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbDialog.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbDialog.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -77,187 +77,187 @@
 
 public class OsbDialog extends ToggleDialog implements OsbObserver, ListSelectionListener, LayerChangeListener,
-		DataChangeListener, MouseListener, OsbActionObserver {
-
-	private static final long serialVersionUID = 1L;
-	private DefaultListModel model;
-	private JList list;
-	private OsbPlugin osbPlugin;
-	private boolean fireSelectionChanged = true;
-	private JButton refresh;
-	private JButton addComment = new JButton(new AddCommentAction());
-	private JButton closeIssue = new JButton(new CloseIssueAction());
-	private JToggleButton newIssue = new JToggleButton();
-	
-	public OsbDialog(final OsbPlugin plugin) {
-		super(tr("Open OpenStreetBugs"), "icon_error22",
-				tr("Opens the OpenStreetBugs window and activates the automatic download"),
-				Shortcut.registerShortcut(
-						"view:openstreetbugs",
-						tr("Toggle: {0}", tr("Open OpenStreetBugs")),
-						KeyEvent.VK_O, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT), 
-				150);
-		
-		osbPlugin = plugin;
-		
-		model = new DefaultListModel();
-		list = new JList(model);
-		list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-		list.addListSelectionListener(this);
-		list.addMouseListener(this);
-		list.setCellRenderer(new OsbListCellRenderer());
-		add(new JScrollPane(list), BorderLayout.CENTER);
-
-		// create dialog buttons
-		JPanel buttonPanel = new JPanel(new GridLayout(2, 2));
-		add(buttonPanel, BorderLayout.SOUTH);
-		refresh = new JButton(tr("Refresh"));
-		refresh.setToolTipText(tr("Refresh"));
-		refresh.setIcon(OsbPlugin.loadIcon("view-refresh22.png"));
-		refresh.setHorizontalAlignment(SwingConstants.LEFT);
-		refresh.addActionListener(new ActionListener() {
-
-			public void actionPerformed(ActionEvent e) {
-				// check zoom level
-				if(Main.map.mapView.zoom() > 15 || Main.map.mapView.zoom() < 9) {
-					JOptionPane.showMessageDialog(Main.parent, 
-							tr("The visible area is either too small or too big to download data from OpenStreetBugs"),
-							tr("Warning"),
-							JOptionPane.INFORMATION_MESSAGE);
-					return;
-				}
-				
-				plugin.updateData();
-			}
-		});
-		
-		addComment.setEnabled(false);
-		addComment.setToolTipText((String) addComment.getAction().getValue(Action.NAME));
-		addComment.setIcon(OsbPlugin.loadIcon("add_comment22.png"));
-		addComment.setHorizontalAlignment(SwingConstants.LEFT);
-		closeIssue.setEnabled(false);
-		closeIssue.setToolTipText((String) closeIssue.getAction().getValue(Action.NAME));
-		closeIssue.setIcon(OsbPlugin.loadIcon("icon_valid22.png"));
-		closeIssue.setHorizontalAlignment(SwingConstants.LEFT);
-		NewIssueAction nia = new NewIssueAction(newIssue, osbPlugin);
-		newIssue.setAction(nia);
-		newIssue.setToolTipText((String) newIssue.getAction().getValue(Action.NAME));
-		newIssue.setIcon(OsbPlugin.loadIcon("icon_error_add22.png"));
-		newIssue.setHorizontalAlignment(SwingConstants.LEFT);
-
-		buttonPanel.add(refresh);
-		buttonPanel.add(newIssue);
-		buttonPanel.add(addComment);
-		buttonPanel.add(closeIssue);
-		
-		// add a selection listener to the data
-		DataSet.selListeners.add(new SelectionChangedListener() {
-			public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
-				fireSelectionChanged = false;
-				list.clearSelection();
-				for (OsmPrimitive osmPrimitive : newSelection) {
-					for (int i = 0; i < model.getSize(); i++) {
-						OsbListItem item = (OsbListItem) model.get(i);
-						if(item.getNode() == osmPrimitive) {
-							list.addSelectionInterval(i, i);
-						}
-					}
-				}
-				fireSelectionChanged = true;
-			}
-		});
-		
-		AddCommentAction.addActionObserver(this);
-		CloseIssueAction.addActionObserver(this);
-	}
-
-	public synchronized void update(final DataSet dataset) {
-		Node lastNode = OsbAction.getSelectedNode();
-		model = new DefaultListModel();
-		List<Node> sortedList = new ArrayList<Node>(dataset.nodes);
-		Collections.sort(sortedList, new BugComparator());
-		
-		for (Node node : sortedList) {
-			if (!node.deleted) {
-				model.addElement(new OsbListItem(node));
-			}
-		}
-		list.setModel(model);
-		list.setSelectedValue(new OsbListItem(lastNode), true);
-	}
-
-	public void valueChanged(ListSelectionEvent e) {
-		if(list.getSelectedValues().length == 0) {
-			addComment.setEnabled(false);
-			closeIssue.setEnabled(false);
-			OsbAction.setSelectedNode(null);
-			return;
-		}
-		
-		List<OsmPrimitive> selected = new ArrayList<OsmPrimitive>();
-		for (Object listItem : list.getSelectedValues()) {
-			Node node = ((OsbListItem) listItem).getNode();
-			selected.add(node);
-
-			if ("1".equals(node.get("state"))) {
-				addComment.setEnabled(false);
-				closeIssue.setEnabled(false);
-			} else {
-				addComment.setEnabled(true);
-				closeIssue.setEnabled(true);
-			}
-			
-			OsbAction.setSelectedNode(node);
-
-			scrollToSelected(node);
-			
-			if (fireSelectionChanged) {
-				Main.ds.setSelected(selected);
-			}
-		}
-	}
-
-	private void scrollToSelected(Node node) {
-		for (int i = 0; i < model.getSize();i++) {
-			Node current = ((OsbListItem)model.get(i)).getNode();
-			if(current.id == node.id) {
-				list.scrollRectToVisible(list.getCellBounds(i, i));
-				list.setSelectedIndex(i);
-				return;
-			}
-		}
-	}
-
-	public void activeLayerChange(Layer oldLayer, Layer newLayer) {}
-
-	public void layerAdded(Layer newLayer) {
-		if(newLayer == osbPlugin.getLayer()) {
-			update(osbPlugin.getDataSet());
-			Main.map.mapView.moveLayer(newLayer, 0);
-		}
-	}
-
-	public void layerRemoved(Layer oldLayer) {
-		if(oldLayer == osbPlugin.getLayer()) {
-			model.removeAllElements();
-		}
-	}
-
-	public void dataChanged(OsmDataLayer l) {
-		update(l.data);
-	}
-	
-	public void zoomToNode(Node node) {
-		double scale = Main.map.mapView.getScale();
-		Main.map.mapView.zoomTo(node.eastNorth, scale);
-    }
-
-	public void mouseClicked(MouseEvent e) {
-		if(e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
-			OsbListItem item = (OsbListItem)list.getSelectedValue();
-			zoomToNode(item.getNode());
-		}
-	}
-	
-	public void mousePressed(MouseEvent e) {
+        DataChangeListener, MouseListener, OsbActionObserver {
+
+    private static final long serialVersionUID = 1L;
+    private DefaultListModel model;
+    private JList list;
+    private OsbPlugin osbPlugin;
+    private boolean fireSelectionChanged = true;
+    private JButton refresh;
+    private JButton addComment = new JButton(new AddCommentAction());
+    private JButton closeIssue = new JButton(new CloseIssueAction());
+    private JToggleButton newIssue = new JToggleButton();
+
+    public OsbDialog(final OsbPlugin plugin) {
+        super(tr("Open OpenStreetBugs"), "icon_error22",
+                tr("Opens the OpenStreetBugs window and activates the automatic download"),
+                Shortcut.registerShortcut(
+                        "view:openstreetbugs",
+                        tr("Toggle: {0}", tr("Open OpenStreetBugs")),
+                        KeyEvent.VK_O, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT),
+                150);
+
+        osbPlugin = plugin;
+
+        model = new DefaultListModel();
+        list = new JList(model);
+        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        list.addListSelectionListener(this);
+        list.addMouseListener(this);
+        list.setCellRenderer(new OsbListCellRenderer());
+        add(new JScrollPane(list), BorderLayout.CENTER);
+
+        // create dialog buttons
+        JPanel buttonPanel = new JPanel(new GridLayout(2, 2));
+        add(buttonPanel, BorderLayout.SOUTH);
+        refresh = new JButton(tr("Refresh"));
+        refresh.setToolTipText(tr("Refresh"));
+        refresh.setIcon(OsbPlugin.loadIcon("view-refresh22.png"));
+        refresh.setHorizontalAlignment(SwingConstants.LEFT);
+        refresh.addActionListener(new ActionListener() {
+
+            public void actionPerformed(ActionEvent e) {
+                // check zoom level
+                if(Main.map.mapView.zoom() > 15 || Main.map.mapView.zoom() < 9) {
+                    JOptionPane.showMessageDialog(Main.parent,
+                            tr("The visible area is either too small or too big to download data from OpenStreetBugs"),
+                            tr("Warning"),
+                            JOptionPane.INFORMATION_MESSAGE);
+                    return;
+                }
+
+                plugin.updateData();
+            }
+        });
+
+        addComment.setEnabled(false);
+        addComment.setToolTipText((String) addComment.getAction().getValue(Action.NAME));
+        addComment.setIcon(OsbPlugin.loadIcon("add_comment22.png"));
+        addComment.setHorizontalAlignment(SwingConstants.LEFT);
+        closeIssue.setEnabled(false);
+        closeIssue.setToolTipText((String) closeIssue.getAction().getValue(Action.NAME));
+        closeIssue.setIcon(OsbPlugin.loadIcon("icon_valid22.png"));
+        closeIssue.setHorizontalAlignment(SwingConstants.LEFT);
+        NewIssueAction nia = new NewIssueAction(newIssue, osbPlugin);
+        newIssue.setAction(nia);
+        newIssue.setToolTipText((String) newIssue.getAction().getValue(Action.NAME));
+        newIssue.setIcon(OsbPlugin.loadIcon("icon_error_add22.png"));
+        newIssue.setHorizontalAlignment(SwingConstants.LEFT);
+
+        buttonPanel.add(refresh);
+        buttonPanel.add(newIssue);
+        buttonPanel.add(addComment);
+        buttonPanel.add(closeIssue);
+
+        // add a selection listener to the data
+        DataSet.selListeners.add(new SelectionChangedListener() {
+            public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
+                fireSelectionChanged = false;
+                list.clearSelection();
+                for (OsmPrimitive osmPrimitive : newSelection) {
+                    for (int i = 0; i < model.getSize(); i++) {
+                        OsbListItem item = (OsbListItem) model.get(i);
+                        if(item.getNode() == osmPrimitive) {
+                            list.addSelectionInterval(i, i);
+                        }
+                    }
+                }
+                fireSelectionChanged = true;
+            }
+        });
+
+        AddCommentAction.addActionObserver(this);
+        CloseIssueAction.addActionObserver(this);
+    }
+
+    public synchronized void update(final DataSet dataset) {
+        Node lastNode = OsbAction.getSelectedNode();
+        model = new DefaultListModel();
+        List<Node> sortedList = new ArrayList<Node>(dataset.nodes);
+        Collections.sort(sortedList, new BugComparator());
+
+        for (Node node : sortedList) {
+            if (!node.deleted) {
+                model.addElement(new OsbListItem(node));
+            }
+        }
+        list.setModel(model);
+        list.setSelectedValue(new OsbListItem(lastNode), true);
+    }
+
+    public void valueChanged(ListSelectionEvent e) {
+        if(list.getSelectedValues().length == 0) {
+            addComment.setEnabled(false);
+            closeIssue.setEnabled(false);
+            OsbAction.setSelectedNode(null);
+            return;
+        }
+
+        List<OsmPrimitive> selected = new ArrayList<OsmPrimitive>();
+        for (Object listItem : list.getSelectedValues()) {
+            Node node = ((OsbListItem) listItem).getNode();
+            selected.add(node);
+
+            if ("1".equals(node.get("state"))) {
+                addComment.setEnabled(false);
+                closeIssue.setEnabled(false);
+            } else {
+                addComment.setEnabled(true);
+                closeIssue.setEnabled(true);
+            }
+
+            OsbAction.setSelectedNode(node);
+
+            scrollToSelected(node);
+
+            if (fireSelectionChanged) {
+                Main.ds.setSelected(selected);
+            }
+        }
+    }
+
+    private void scrollToSelected(Node node) {
+        for (int i = 0; i < model.getSize();i++) {
+            Node current = ((OsbListItem)model.get(i)).getNode();
+            if(current.id == node.id) {
+                list.scrollRectToVisible(list.getCellBounds(i, i));
+                list.setSelectedIndex(i);
+                return;
+            }
+        }
+    }
+
+    public void activeLayerChange(Layer oldLayer, Layer newLayer) {}
+
+    public void layerAdded(Layer newLayer) {
+        if(newLayer == osbPlugin.getLayer()) {
+            update(osbPlugin.getDataSet());
+            Main.map.mapView.moveLayer(newLayer, 0);
+        }
+    }
+
+    public void layerRemoved(Layer oldLayer) {
+        if(oldLayer == osbPlugin.getLayer()) {
+            model.removeAllElements();
+        }
+    }
+
+    public void dataChanged(OsmDataLayer l) {
+        update(l.data);
+    }
+
+    public void zoomToNode(Node node) {
+        double scale = Main.map.mapView.getScale();
+        Main.map.mapView.zoomTo(node.eastNorth, scale);
+    }
+
+    public void mouseClicked(MouseEvent e) {
+        if(e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
+            OsbListItem item = (OsbListItem)list.getSelectedValue();
+            zoomToNode(item.getNode());
+        }
+    }
+
+    public void mousePressed(MouseEvent e) {
         mayTriggerPopup(e);
     }
@@ -266,36 +266,36 @@
         mayTriggerPopup(e);
     }
-    
+
     private void mayTriggerPopup(MouseEvent e) {
         if(e.isPopupTrigger()) {
-        	int selectedRow = list.locationToIndex(e.getPoint());
-        	list.setSelectedIndex(selectedRow);
-			Node n = ((OsbListItem)list.getSelectedValue()).getNode();
-			OsbAction.setSelectedNode(n);
-			PopupFactory.createPopup(n).show(e.getComponent(), e.getX(), e.getY());
-        }
-    }
-	
-	public void mouseEntered(MouseEvent e) {}
-
-	public void mouseExited(MouseEvent e) {}
-
-	public void actionPerformed(OsbAction action) {
-		if(action instanceof AddCommentAction || action instanceof CloseIssueAction) {
-			update(osbPlugin.getDataSet());
-		}
-	}
-	
-	private class BugComparator implements Comparator<Node> {
-
-		public int compare(Node o1, Node o2) {
-			String state1 = o1.get("state");
-			String state2 = o2.get("state");
-			if(state1.equals(state2)) {
-				return o1.get("note").compareTo(o2.get("note"));
-			}
-			return state1.compareTo(state2);
-		}
-		
-	}
+            int selectedRow = list.locationToIndex(e.getPoint());
+            list.setSelectedIndex(selectedRow);
+            Node n = ((OsbListItem)list.getSelectedValue()).getNode();
+            OsbAction.setSelectedNode(n);
+            PopupFactory.createPopup(n).show(e.getComponent(), e.getX(), e.getY());
+        }
+    }
+
+    public void mouseEntered(MouseEvent e) {}
+
+    public void mouseExited(MouseEvent e) {}
+
+    public void actionPerformed(OsbAction action) {
+        if(action instanceof AddCommentAction || action instanceof CloseIssueAction) {
+            update(osbPlugin.getDataSet());
+        }
+    }
+
+    private class BugComparator implements Comparator<Node> {
+
+        public int compare(Node o1, Node o2) {
+            String state1 = o1.get("state");
+            String state2 = o2.get("state");
+            if(state1.equals(state2)) {
+                return o1.get("note").compareTo(o2.get("note"));
+            }
+            return state1.compareTo(state2);
+        }
+
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbListCellRenderer.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbListCellRenderer.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbListCellRenderer.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -45,38 +45,38 @@
     private Color background = Color.WHITE;
     private Color altBackground = new Color(250, 250, 220);
-    
-	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
-			boolean cellHasFocus) {
-		
-		JLabel label = new JLabel();
-		label.setOpaque(true);
-		
+
+    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
+            boolean cellHasFocus) {
+
+        JLabel label = new JLabel();
+        label.setOpaque(true);
+
         if(isSelected) {
-        	label.setBackground(UIManager.getColor("List.selectionBackground"));
+            label.setBackground(UIManager.getColor("List.selectionBackground"));
         } else {
-        	label.setBackground(index % 2 == 0 ? background : altBackground);
+            label.setBackground(index % 2 == 0 ? background : altBackground);
         }
-        
+
         OsbListItem item = (OsbListItem) value;
         Node n = item.getNode();
         Icon icon = null;
         if("0".equals(n.get("state"))) {
-        	icon = OsbPlugin.loadIcon("icon_error16.png");
+            icon = OsbPlugin.loadIcon("icon_error16.png");
         } else if("1".equals(n.get("state"))) {
-        	icon = OsbPlugin.loadIcon("icon_valid16.png");
+            icon = OsbPlugin.loadIcon("icon_valid16.png");
         }
         label.setIcon(icon);
         String text = n.get("note");
         if(text.indexOf("<hr />") > 0) {
-        	text = text.substring(0, text.indexOf("<hr />"));
+            text = text.substring(0, text.indexOf("<hr />"));
         }
         label.setText(text);
-		
-		Dimension d = label.getPreferredSize();
-		d.height += 10;
-		label.setPreferredSize(d);
-		
-		return label;
-	}
+
+        Dimension d = label.getPreferredSize();
+        d.height += 10;
+        label.setPreferredSize(d);
+
+        return label;
+    }
 
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbListItem.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbListItem.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbListItem.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -31,41 +31,41 @@
 
 public class OsbListItem {
-	private Node node;
-	
-	public OsbListItem(Node node) {
-		super();
-		this.node = node;
-	}
+    private Node node;
 
-	public Node getNode() {
-		return node;
-	}
+    public OsbListItem(Node node) {
+        super();
+        this.node = node;
+    }
 
-	public void setNode(Node node) {
-		this.node = node;
-	}
-	
-	@Override
-	public String toString() {
-		if(node.get("note") != null) {
-			StringBuilder sb = new StringBuilder("<html>");
-			sb.append(node.get("note").replaceAll("\\|", "<br>"));
-			sb.append("</html>");
-			return sb.toString();
-		} else {
-			return "N/A";
-		}
-	}
-	
-	@Override
-	public boolean equals(Object obj) {
-		if(obj instanceof OsbListItem) {
-			OsbListItem other = (OsbListItem)obj; 
-			if(getNode() != null && other.getNode() != null) {
-				return getNode().id == other.getNode().id;
-			}
-		}
-		
-		return false;
-	}
+    public Node getNode() {
+        return node;
+    }
+
+    public void setNode(Node node) {
+        this.node = node;
+    }
+
+    @Override
+    public String toString() {
+        if(node.get("note") != null) {
+            StringBuilder sb = new StringBuilder("<html>");
+            sb.append(node.get("note").replaceAll("\\|", "<br>"));
+            sb.append("</html>");
+            return sb.toString();
+        } else {
+            return "N/A";
+        }
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if(obj instanceof OsbListItem) {
+            OsbListItem other = (OsbListItem)obj;
+            if(getNode() != null && other.getNode() != null) {
+                return getNode().id == other.getNode().id;
+            }
+        }
+
+        return false;
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/AddCommentAction.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/AddCommentAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/AddCommentAction.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -40,30 +40,30 @@
 public class AddCommentAction extends OsbAction {
 
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-	private EditAction editAction = new EditAction();
-	
-	public AddCommentAction() {
-		super(tr("Add a comment"));
-	}
-	
-	@Override
-	protected void doActionPerformed(ActionEvent e) throws Exception {
-		// get the user nickname
-		String nickname = Main.pref.get(ConfigKeys.OSB_NICKNAME);
-		if(nickname == null || nickname.length() == 0) {
-			nickname = JOptionPane.showInputDialog(Main.parent, tr("Please enter a user name"));
-			if(nickname == null) {
-				nickname = tr("NoName");
-			} else {
-				Main.pref.put(ConfigKeys.OSB_NICKNAME, nickname);
-			}
-		}
-		
-		String comment = JOptionPane.showInputDialog(Main.parent, tr("Enter your comment"));
-		if(comment != null) {
-			comment = comment.concat(" [").concat(nickname).concat("]");
-			editAction.execute(getSelectedNode(), comment);
-		}
-	}
+    private EditAction editAction = new EditAction();
+
+    public AddCommentAction() {
+        super(tr("Add a comment"));
+    }
+
+    @Override
+    protected void doActionPerformed(ActionEvent e) throws Exception {
+        // get the user nickname
+        String nickname = Main.pref.get(ConfigKeys.OSB_NICKNAME);
+        if(nickname == null || nickname.length() == 0) {
+            nickname = JOptionPane.showInputDialog(Main.parent, tr("Please enter a user name"));
+            if(nickname == null) {
+                nickname = tr("NoName");
+            } else {
+                Main.pref.put(ConfigKeys.OSB_NICKNAME, nickname);
+            }
+        }
+
+        String comment = JOptionPane.showInputDialog(Main.parent, tr("Enter your comment"));
+        if(comment != null) {
+            comment = comment.concat(" [").concat(nickname).concat("]");
+            editAction.execute(getSelectedNode(), comment);
+        }
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/CloseIssueAction.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/CloseIssueAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/CloseIssueAction.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -40,22 +40,22 @@
 public class CloseIssueAction extends OsbAction {
 
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-	private CloseAction closeAction = new CloseAction();
-	
-	public CloseIssueAction() {
-		super(tr("Mark as done"));
-	}
-	
-	@Override
-	protected void doActionPerformed(ActionEvent e) throws IOException {
-		int result = JOptionPane.showConfirmDialog(Main.parent,
-				tr("Really mark this issue as ''done''?"),
-				tr("Really close?"),
-				JOptionPane.YES_NO_OPTION);
-		
-		if(result == JOptionPane.YES_OPTION) {
-			closeAction.execute(getSelectedNode());
-		} 
-	}
+    private CloseAction closeAction = new CloseAction();
+
+    public CloseIssueAction() {
+        super(tr("Mark as done"));
+    }
+
+    @Override
+    protected void doActionPerformed(ActionEvent e) throws IOException {
+        int result = JOptionPane.showConfirmDialog(Main.parent,
+                tr("Really mark this issue as ''done''?"),
+                tr("Really close?"),
+                JOptionPane.YES_NO_OPTION);
+
+        if(result == JOptionPane.YES_OPTION) {
+            closeAction.execute(getSelectedNode());
+        }
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/NewIssueAction.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/NewIssueAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/NewIssueAction.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -47,86 +47,86 @@
 public class NewIssueAction extends OsbAction implements MouseListener {
 
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-	private NewAction newAction = new NewAction();
-	
-	private JToggleButton button;
-	
-	private OsbPlugin plugin;
-	
-	public NewIssueAction(JToggleButton button, OsbPlugin plugin) {
-		super(tr("New issue"));
-		this.button = button;
-		this.plugin = plugin;
-	}
-	
-	@Override
-	protected void doActionPerformed(ActionEvent e) throws IOException {
-		if(button.isSelected()) {
-			Main.map.mapView.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
-			Main.map.mapView.addMouseListener(this);
-		} else {
-			reset();
-		}
-	}
+    private NewAction newAction = new NewAction();
 
-	private void reset() {
-		Main.map.mapView.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
-		Main.map.mapView.removeMouseListener(this);
-		button.setSelected(false);
-	}
+    private JToggleButton button;
 
-	public void mouseClicked(MouseEvent e) {
-		addNewIssue(e);
-	}
+    private OsbPlugin plugin;
 
-	public void mouseEntered(MouseEvent e) {}
+    public NewIssueAction(JToggleButton button, OsbPlugin plugin) {
+        super(tr("New issue"));
+        this.button = button;
+        this.plugin = plugin;
+    }
 
-	public void mouseExited(MouseEvent e) {}
+    @Override
+    protected void doActionPerformed(ActionEvent e) throws IOException {
+        if(button.isSelected()) {
+            Main.map.mapView.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+            Main.map.mapView.addMouseListener(this);
+        } else {
+            reset();
+        }
+    }
 
-	public void mousePressed(MouseEvent e) {
-		addNewIssue(e);
-	}
+    private void reset() {
+        Main.map.mapView.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+        Main.map.mapView.removeMouseListener(this);
+        button.setSelected(false);
+    }
 
-	private void addNewIssue(MouseEvent e) {
-		// get the user nickname
-		String nickname = Main.pref.get(ConfigKeys.OSB_NICKNAME);
-		if(nickname == null || nickname.length() == 0) {
-			nickname = JOptionPane.showInputDialog(Main.parent, tr("Please enter a user name"));
-			if(nickname == null) {
-				nickname = "NoName";
-			} else {
-				Main.pref.put(ConfigKeys.OSB_NICKNAME, nickname);
-			}
-		}
-		
-		// get the comment
-		String result = JOptionPane.showInputDialog(Main.parent,
-				tr("Describe the problem precisely"),
-				tr("Create issue"),
-				JOptionPane.QUESTION_MESSAGE);
-		
-		if(result != null && result.length() > 0) {
-			try {
-				result = result.concat(" [").concat(nickname).concat("]");
-				Node n = newAction.execute(e.getPoint(), result);
-				plugin.getDataSet().addPrimitive(n);
-				if(Main.pref.getBoolean(ConfigKeys.OSB_API_DISABLED)) {
-					plugin.updateGui();
-				} else {
-					plugin.updateData();
-				}
-			} catch (Exception e1) {
-				e1.printStackTrace();
-				JOptionPane.showMessageDialog(Main.parent,
-						tr("An error occurred: {0}", new Object[] {result}),
-						tr("Error"),
-						JOptionPane.ERROR_MESSAGE);
-			}
-		}
-		
-		reset();
-	}
+    public void mouseClicked(MouseEvent e) {
+        addNewIssue(e);
+    }
 
-	public void mouseReleased(MouseEvent e) {}
+    public void mouseEntered(MouseEvent e) {}
+
+    public void mouseExited(MouseEvent e) {}
+
+    public void mousePressed(MouseEvent e) {
+        addNewIssue(e);
+    }
+
+    private void addNewIssue(MouseEvent e) {
+        // get the user nickname
+        String nickname = Main.pref.get(ConfigKeys.OSB_NICKNAME);
+        if(nickname == null || nickname.length() == 0) {
+            nickname = JOptionPane.showInputDialog(Main.parent, tr("Please enter a user name"));
+            if(nickname == null) {
+                nickname = "NoName";
+            } else {
+                Main.pref.put(ConfigKeys.OSB_NICKNAME, nickname);
+            }
+        }
+
+        // get the comment
+        String result = JOptionPane.showInputDialog(Main.parent,
+                tr("Describe the problem precisely"),
+                tr("Create issue"),
+                JOptionPane.QUESTION_MESSAGE);
+
+        if(result != null && result.length() > 0) {
+            try {
+                result = result.concat(" [").concat(nickname).concat("]");
+                Node n = newAction.execute(e.getPoint(), result);
+                plugin.getDataSet().addPrimitive(n);
+                if(Main.pref.getBoolean(ConfigKeys.OSB_API_DISABLED)) {
+                    plugin.updateGui();
+                } else {
+                    plugin.updateData();
+                }
+            } catch (Exception e1) {
+                e1.printStackTrace();
+                JOptionPane.showMessageDialog(Main.parent,
+                        tr("An error occurred: {0}", new Object[] {result}),
+                        tr("Error"),
+                        JOptionPane.ERROR_MESSAGE);
+            }
+        }
+
+        reset();
+    }
+
+    public void mouseReleased(MouseEvent e) {}
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/OsbAction.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/OsbAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/OsbAction.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -38,42 +38,42 @@
 public abstract class OsbAction extends AbstractAction {
 
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-	private static List<OsbActionObserver> observers = new ArrayList<OsbActionObserver>(); 
-	
-	private static Node selectedNode;
-	
-	public OsbAction(String name) {
-		super(name);
-	}
+    private static List<OsbActionObserver> observers = new ArrayList<OsbActionObserver>();
 
-	public static Node getSelectedNode() {
-		return selectedNode;
-	}
+    private static Node selectedNode;
 
-	public static void setSelectedNode(Node selectedNode) {
-		OsbAction.selectedNode = selectedNode;
-	}
-	
-	public void actionPerformed(ActionEvent e) {
-		try {
-			doActionPerformed(e);
-			for (OsbActionObserver obs : observers) {
-				obs.actionPerformed(this);
-			}
-		} catch (Exception e1) {
-			System.err.println("Couldn't execute action " + getClass().getSimpleName());
-			e1.printStackTrace();
-		}
-	}
-	
-	protected abstract void doActionPerformed(ActionEvent e) throws Exception;
-	
-	public static void addActionObserver(OsbActionObserver obs) {
-		observers.add(obs);
-	}
-	
-	public static void removeActionObserver(OsbActionObserver obs) {
-		observers.remove(obs);
-	}
+    public OsbAction(String name) {
+        super(name);
+    }
+
+    public static Node getSelectedNode() {
+        return selectedNode;
+    }
+
+    public static void setSelectedNode(Node selectedNode) {
+        OsbAction.selectedNode = selectedNode;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        try {
+            doActionPerformed(e);
+            for (OsbActionObserver obs : observers) {
+                obs.actionPerformed(this);
+            }
+        } catch (Exception e1) {
+            System.err.println("Couldn't execute action " + getClass().getSimpleName());
+            e1.printStackTrace();
+        }
+    }
+
+    protected abstract void doActionPerformed(ActionEvent e) throws Exception;
+
+    public static void addActionObserver(OsbActionObserver obs) {
+        observers.add(obs);
+    }
+
+    public static void removeActionObserver(OsbActionObserver obs) {
+        observers.remove(obs);
+    }
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/OsbActionObserver.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/OsbActionObserver.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/OsbActionObserver.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -29,4 +29,4 @@
 
 public interface OsbActionObserver {
-	public void actionPerformed(OsbAction action);
+    public void actionPerformed(OsbAction action);
 }
Index: /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/PopupFactory.java
===================================================================
--- /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/PopupFactory.java	(revision 12777)
+++ /applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/PopupFactory.java	(revision 12778)
@@ -1,17 +1,17 @@
 /* Copyright (c) 2008, Henrik Niehaus
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice, 
- *    this list of conditions and the following disclaimer in the documentation 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its 
- *    contributors may be used to endorse or promote products derived from this 
+ * 3. Neither the name of the project nor the names of its
+ *    contributors may be used to endorse or promote products derived from this
  *    software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -37,50 +37,50 @@
 
 public class PopupFactory {
-	
-	private static JPopupMenu issuePopup;
-	private static JPopupMenu fixedPopup;
-	
-	public static synchronized JPopupMenu createPopup(Node node) {
-		if("0".equals(node.get("state"))) {
-			return getIssuePopup();
-		} else if("1".equals(node.get("state"))) {
-			return getFixedPopup();
-		} else {
-			throw new RuntimeException(tr("Unknown issue state"));
-		}
-	}
 
-	private static JPopupMenu getIssuePopup() {
-		if(issuePopup == null) {
-			issuePopup = new JPopupMenu();
-			JMenuItem add = new JMenuItem();
-			add.setAction(new AddCommentAction());
-			add.setIcon(OsbPlugin.loadIcon("add_comment16.png"));
-			issuePopup.add(add);
-			JMenuItem close = new JMenuItem();
-			close.setAction(new CloseIssueAction());
-			close.setIcon(OsbPlugin.loadIcon("icon_valid16.png"));
-			issuePopup.add(close);
-		}
-		return issuePopup;
-	}
-	
-	private static JPopupMenu getFixedPopup() {
-		if(fixedPopup == null) {
-			fixedPopup = new JPopupMenu();
-			JMenuItem add = new JMenuItem();
-			AddCommentAction aca = new AddCommentAction();
-			aca.setEnabled(false);
-			add.setAction(aca);
-			add.setIcon(OsbPlugin.loadIcon("add_comment16.png"));
-			JMenuItem close = new JMenuItem();
-			CloseIssueAction cia = new CloseIssueAction();
-			cia.setEnabled(false);
-			close.setAction(cia);
-			close.setIcon(OsbPlugin.loadIcon("icon_valid16.png"));
-			fixedPopup.add(add);
-			fixedPopup.add(close);
-		}
-		return fixedPopup;
-	}
+    private static JPopupMenu issuePopup;
+    private static JPopupMenu fixedPopup;
+
+    public static synchronized JPopupMenu createPopup(Node node) {
+        if("0".equals(node.get("state"))) {
+            return getIssuePopup();
+        } else if("1".equals(node.get("state"))) {
+            return getFixedPopup();
+        } else {
+            throw new RuntimeException(tr("Unknown issue state"));
+        }
+    }
+
+    private static JPopupMenu getIssuePopup() {
+        if(issuePopup == null) {
+            issuePopup = new JPopupMenu();
+            JMenuItem add = new JMenuItem();
+            add.setAction(new AddCommentAction());
+            add.setIcon(OsbPlugin.loadIcon("add_comment16.png"));
+            issuePopup.add(add);
+            JMenuItem close = new JMenuItem();
+            close.setAction(new CloseIssueAction());
+            close.setIcon(OsbPlugin.loadIcon("icon_valid16.png"));
+            issuePopup.add(close);
+        }
+        return issuePopup;
+    }
+
+    private static JPopupMenu getFixedPopup() {
+        if(fixedPopup == null) {
+            fixedPopup = new JPopupMenu();
+            JMenuItem add = new JMenuItem();
+            AddCommentAction aca = new AddCommentAction();
+            aca.setEnabled(false);
+            add.setAction(aca);
+            add.setIcon(OsbPlugin.loadIcon("add_comment16.png"));
+            JMenuItem close = new JMenuItem();
+            CloseIssueAction cia = new CloseIssueAction();
+            cia.setEnabled(false);
+            close.setAction(cia);
+            close.setIcon(OsbPlugin.loadIcon("icon_valid16.png"));
+            fixedPopup.add(add);
+            fixedPopup.add(close);
+        }
+        return fixedPopup;
+    }
 }
Index: /applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisibleAction.java
===================================================================
--- /applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisibleAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisibleAction.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.openvisible;
@@ -40,5 +40,5 @@
 public class OpenVisibleAction extends JosmAction {
     private File lastDirectory;
-    
+
     public OpenVisibleAction() {
         super(tr("Open Visible ..."), "openvisible",
@@ -60,7 +60,7 @@
         LatLon bottomLeft = view.getLatLon(bounds.x, bounds.y + bounds.height);
         LatLon topRight = view.getLatLon(bounds.x + bounds.width, bounds.y);
-        
+
         System.err.println("FileFind Bounds: " + bottomLeft + " to " + topRight);
-        
+
         JFileChooser fileChooser;
         if(lastDirectory != null) {
@@ -73,5 +73,5 @@
         File[] files = fileChooser.getSelectedFiles();
         lastDirectory = fileChooser.getCurrentDirectory();
-        
+
         for(File file : files) {
             try {
@@ -85,5 +85,5 @@
                         openFileAsGpx(file);
                     }
-                    
+
                 }
             } catch (FileNotFoundException e1) {
@@ -95,7 +95,7 @@
             }
         }
-        
+
     }
-    
+
     private void openAsData(File file) throws SAXException, IOException, FileNotFoundException {
         String fn = file.getName();
Index: /applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisiblePlugin.java
===================================================================
--- /applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisiblePlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisiblePlugin.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.openvisible;
Index: /applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OsmGpxBounds.java
===================================================================
--- /applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OsmGpxBounds.java	(revision 12777)
+++ /applications/editors/josm/plugins/openvisible/src/at/dallermassl/josm/plugin/openvisible/OsmGpxBounds.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.openvisible;
@@ -27,9 +27,9 @@
     private double minLon = 90.0;
     private double maxLon = -90.0;
-    
+
     public OsmGpxBounds() {
-        
+
     }
-    
+
     /**
      * Parses the given input stream (gpx or osm file).
@@ -46,6 +46,6 @@
         }
     }
-    
-    @Override 
+
+    @Override
     public void startElement(String ns, String lname, String qname, Attributes a) {
         if (qname.equals("node") || qname.equals("trkpt")) {
@@ -58,5 +58,5 @@
         }
     }
-    
+
     /**
      * Returns <code>true</code>, if the given coordinates intersect with the
@@ -75,5 +75,5 @@
         return ((lat2-lat1) > 0) && ((lon2-lon1) > 0);
     }
-        
+
     public static void main(String[] args) {
         if(args.length < 5) {
@@ -87,15 +87,15 @@
         String[] files = new String[args.length - 4];
         System.arraycopy(args, 4, files, 0, args.length - 4);
-            
-        try {    
+
+        try {
             File file;
             for(String fileName : files) {
                 file = new File(fileName);
-                if(!file.isDirectory() 
+                if(!file.isDirectory()
                   && (file.getName().endsWith("gpx") || file.getName().endsWith("osm"))) {
                     OsmGpxBounds parser = new OsmGpxBounds();
                     parser.parse(new BufferedInputStream(new FileInputStream(file)));
                     if(parser.intersects(minLat, maxLat, minLon, maxLon)) {
-                        System.out.println(file.getAbsolutePath()); // + "," + parser.minLat + "," + parser.maxLat + "," + parser.minLon + "," + parser.maxLon);                        
+                        System.out.println(file.getAbsolutePath()); // + "," + parser.minLat + "," + parser.maxLat + "," + parser.minLon + "," + parser.maxLon);
                     }
 //                    System.out.println(parser.intersects(47.0555, 47.09, 15.406, 15.4737));
@@ -112,9 +112,9 @@
 
     /**
-     * 
+     *
      */
     private static void printHelp() {
         System.out.println(OsmGpxBounds.class.getName() + " <minLat> <maxLat> <minLon> <maxLon> <files+>");
-        
+
     }
 
Index: /applications/editors/josm/plugins/osmarender/src/OsmarenderPlugin.java
===================================================================
--- /applications/editors/josm/plugins/osmarender/src/OsmarenderPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/osmarender/src/OsmarenderPlugin.java	(revision 12778)
@@ -38,126 +38,126 @@
 public class OsmarenderPlugin extends Plugin {
 
-	private class Action extends JosmAction {
+    private class Action extends JosmAction {
 
-		public Action() {
-			super(tr("Osmarender"), null, tr("Osmarender"), null, true);
-		}
+        public Action() {
+            super(tr("Osmarender"), null, tr("Osmarender"), null, true);
+        }
 
-		public void actionPerformed(ActionEvent e) {
-			// get all stuff visible on screen
-			LatLon bottomLeft = Main.map.mapView.getLatLon(0,Main.map.mapView.getHeight());
-			LatLon topRight = Main.map.mapView.getLatLon(Main.map.mapView.getWidth(), 0);
-			Bounds b = new Bounds(bottomLeft, topRight);
+        public void actionPerformed(ActionEvent e) {
+            // get all stuff visible on screen
+            LatLon bottomLeft = Main.map.mapView.getLatLon(0,Main.map.mapView.getHeight());
+            LatLon topRight = Main.map.mapView.getLatLon(Main.map.mapView.getWidth(), 0);
+            Bounds b = new Bounds(bottomLeft, topRight);
 
-			try {
-				writeGenerated(b);
-			} catch(Exception ex) {
-				//how handle the exception?
-			}
+            try {
+                writeGenerated(b);
+            } catch(Exception ex) {
+                //how handle the exception?
+            }
 
-			CollectBackReferencesVisitor backRefsV = new CollectBackReferencesVisitor(Main.ds, true);
-			DataSet fromDataSet = new DataSet();
-			for (Node n : Main.ds.nodes) {
-				if (n.deleted || n.incomplete) continue;
-				if (n.coor.isWithin(b)) {
-					fromDataSet.nodes.add(n);
-					n.visit(backRefsV);
-				}
-			}
-			for (OsmPrimitive p : new HashSet<OsmPrimitive>(backRefsV.data)) {
-				if (p instanceof Way) {
-					backRefsV.data.addAll(((Way) p).nodes);
-				}
-			}
-			for (OsmPrimitive p : backRefsV.data)
-				fromDataSet.addPrimitive(p);
+            CollectBackReferencesVisitor backRefsV = new CollectBackReferencesVisitor(Main.ds, true);
+            DataSet fromDataSet = new DataSet();
+            for (Node n : Main.ds.nodes) {
+                if (n.deleted || n.incomplete) continue;
+                if (n.coor.isWithin(b)) {
+                    fromDataSet.nodes.add(n);
+                    n.visit(backRefsV);
+                }
+            }
+            for (OsmPrimitive p : new HashSet<OsmPrimitive>(backRefsV.data)) {
+                if (p instanceof Way) {
+                    backRefsV.data.addAll(((Way) p).nodes);
+                }
+            }
+            for (OsmPrimitive p : backRefsV.data)
+                fromDataSet.addPrimitive(p);
 
-			String firefox = Main.pref.get("osmarender.firefox", "firefox");
-			try {
-				// write to plugin dir
-				OsmWriter.output(new FileOutputStream(getPluginDir()+File.separator+"data.osm"), new OsmWriter.All(fromDataSet, true));
+            String firefox = Main.pref.get("osmarender.firefox", "firefox");
+            try {
+                // write to plugin dir
+                OsmWriter.output(new FileOutputStream(getPluginDir()+File.separator+"data.osm"), new OsmWriter.All(fromDataSet, true));
 
-				// get the exec line
-				String exec = firefox;
-				if (System.getProperty("os.name").startsWith("Windows"))
-					exec += " file:///"+getPluginDir().replace('\\','/').replace(" ","%20")+File.separator+"generated.xml\"";
-				else
-					exec += " "+getPluginDir()+File.separator+"generated.xml";
+                // get the exec line
+                String exec = firefox;
+                if (System.getProperty("os.name").startsWith("Windows"))
+                    exec += " file:///"+getPluginDir().replace('\\','/').replace(" ","%20")+File.separator+"generated.xml\"";
+                else
+                    exec += " "+getPluginDir()+File.separator+"generated.xml";
 
-				// launch up the viewer
-				Runtime.getRuntime().exec(exec);
-			} catch (IOException e1) {
-				JOptionPane.showMessageDialog(Main.parent, tr("Firefox not found. Please set firefox executable in the Map Settings page of the preferences."));
-			}
-		}
-	}
+                // launch up the viewer
+                Runtime.getRuntime().exec(exec);
+            } catch (IOException e1) {
+                JOptionPane.showMessageDialog(Main.parent, tr("Firefox not found. Please set firefox executable in the Map Settings page of the preferences."));
+            }
+        }
+    }
 
-	private JMenuItem osmarenderMenu;
+    private JMenuItem osmarenderMenu;
 
-	public OsmarenderPlugin() throws IOException {
-		osmarenderMenu = MainMenu.add(Main.main.menu.viewMenu, new Action());
-		osmarenderMenu.setVisible(false);
+    public OsmarenderPlugin() throws IOException {
+        osmarenderMenu = MainMenu.add(Main.main.menu.viewMenu, new Action());
+        osmarenderMenu.setVisible(false);
 
-		// install the xsl and xml file
-		copy("/osmarender.xsl", "osmarender.xsl");
-		copy("/osm-map-features.xml", "osm-map-features.xml");
-	}
+        // install the xsl and xml file
+        copy("/osmarender.xsl", "osmarender.xsl");
+        copy("/osm-map-features.xml", "osm-map-features.xml");
+    }
 
-	@Override
-	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-		if (oldFrame != null && newFrame == null) {
-			// disable
-			osmarenderMenu.setVisible(false);
-		} else if (oldFrame == null && newFrame != null) {
-			// enable
-			osmarenderMenu.setVisible(true);
-		}
-	}
+    @Override
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+        if (oldFrame != null && newFrame == null) {
+            // disable
+            osmarenderMenu.setVisible(false);
+        } else if (oldFrame == null && newFrame != null) {
+            // enable
+            osmarenderMenu.setVisible(true);
+        }
+    }
 
-	@Override public PreferenceSetting getPreferenceSetting() {
-		return new PreferenceSetting(){
-			private JTextField firefox = new JTextField(10);
-			public void addGui(PreferenceDialog gui) {
-				gui.map.add(new JLabel(tr("osmarender options")), GBC.eol().insets(0,5,0,0));
-				gui.map.add(new JLabel(tr("Firefox executable")), GBC.std().insets(10,5,5,0));
-				gui.map.add(firefox, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
-				firefox.setText(Main.pref.get("osmarender.firefox"));
-			}
-			public boolean ok() {
-				Main.pref.put("osmarender.firefox", firefox.getText());
-				return false;
-			}
-		};
-	}
+    @Override public PreferenceSetting getPreferenceSetting() {
+        return new PreferenceSetting(){
+            private JTextField firefox = new JTextField(10);
+            public void addGui(PreferenceDialog gui) {
+                gui.map.add(new JLabel(tr("osmarender options")), GBC.eol().insets(0,5,0,0));
+                gui.map.add(new JLabel(tr("Firefox executable")), GBC.std().insets(10,5,5,0));
+                gui.map.add(firefox, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
+                firefox.setText(Main.pref.get("osmarender.firefox"));
+            }
+            public boolean ok() {
+                Main.pref.put("osmarender.firefox", firefox.getText());
+                return false;
+            }
+        };
+    }
 
-	private void writeGenerated(Bounds b) throws IOException {
-		String bounds_tag = "<bounds " +
-			"minlat=\"" + b.min.lat() + "\" " +
-			"maxlat=\"" + b.max.lat() + "\" " +
-			"minlon=\"" + b.min.lon() + "\" " +
-			"maxlon=\"" + b.max.lon() + "\" " + "/>";
+    private void writeGenerated(Bounds b) throws IOException {
+        String bounds_tag = "<bounds " +
+            "minlat=\"" + b.min.lat() + "\" " +
+            "maxlat=\"" + b.max.lat() + "\" " +
+            "minlon=\"" + b.min.lon() + "\" " +
+            "maxlon=\"" + b.max.lon() + "\" " + "/>";
 
-		BufferedReader reader = new BufferedReader(
-				new FileReader( getPluginDir() + File.separator + "osm-map-features.xml") );
-		PrintWriter writer = new PrintWriter( getPluginDir() + File.separator + "generated.xml");
+        BufferedReader reader = new BufferedReader(
+                new FileReader( getPluginDir() + File.separator + "osm-map-features.xml") );
+        PrintWriter writer = new PrintWriter( getPluginDir() + File.separator + "generated.xml");
 
-		// osm-map-fetaures.xml contain two placemark
-		// (bounds_mkr1 and bounds_mkr2). We write the bounds tag
-		// between the two
-		String str = null;
-		while( (str = reader.readLine()) != null ) {
-			if(str.contains("<!--bounds_mkr1-->")) {
-				writer.println(str);
-				writer.println("    " + bounds_tag);
-				while(!str.contains("<!--bounds_mkr2-->")) {
-					str = reader.readLine();
-				}
-				writer.println(str);
-			} else {
-				writer.println(str);
-			}
-		}
+        // osm-map-fetaures.xml contain two placemark
+        // (bounds_mkr1 and bounds_mkr2). We write the bounds tag
+        // between the two
+        String str = null;
+        while( (str = reader.readLine()) != null ) {
+            if(str.contains("<!--bounds_mkr1-->")) {
+                writer.println(str);
+                writer.println("    " + bounds_tag);
+                while(!str.contains("<!--bounds_mkr2-->")) {
+                    str = reader.readLine();
+                }
+                writer.println(str);
+            } else {
+                writer.println(str);
+            }
+        }
 
-		writer.close();
-	}
+        writer.close();
+    }
 }
Index: /applications/editors/josm/plugins/plastic_laf/src/plastic_laf/Plugin.java
===================================================================
--- /applications/editors/josm/plugins/plastic_laf/src/plastic_laf/Plugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/plastic_laf/src/plastic_laf/Plugin.java	(revision 12778)
@@ -7,7 +7,7 @@
 
 public class Plugin {
-	public Plugin() throws UnsupportedLookAndFeelException {
-		UIManager.getDefaults().put("ClassLoader", getClass().getClassLoader());
-		UIManager.setLookAndFeel(new PlasticLookAndFeel());
-	}
+    public Plugin() throws UnsupportedLookAndFeelException {
+        UIManager.getDefaults().put("ClassLoader", getClass().getClassLoader());
+        UIManager.setLookAndFeel(new PlasticLookAndFeel());
+    }
 }
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/InstallPanel.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/InstallPanel.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/InstallPanel.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -30,5 +30,5 @@
     /**
      * @param pluginUpdateFrame
-     * @param descriptions 
+     * @param descriptions
      */
     public InstallPanel(PluginUpdateFrame pluginUpdateFrame, List<SiteDescription> descriptions) {
@@ -36,5 +36,5 @@
         setBorder(new javax.swing.border.EmptyBorder(12,12,12,12));
         final JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
-        
+
         /* Setup the table */
         table = new JTable(pluginModel = new PluginTableModel(descriptions));
@@ -44,5 +44,5 @@
         table.setPreferredScrollableViewportSize(new Dimension(500,200));
         table.getSelectionModel().addListSelectionListener(this);
-        
+
         TableColumn col1 = table.getColumnModel().getColumn(0);
         TableColumn col2 = table.getColumnModel().getColumn(1);
@@ -82,5 +82,5 @@
 
     /**
-     * 
+     *
      */
     public void install() {
@@ -101,5 +101,5 @@
         infoBox.setText(text);
         infoBox.setCaretPosition(0);
-        
+
     }
 
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginDescription.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginDescription.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginDescription.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -23,5 +23,5 @@
     private String description;
     private List<PluginResource> resources = new ArrayList<PluginResource>();
-    
+
     /**
      * Add a resource to the plugin description.
@@ -31,5 +31,5 @@
         resources.add(resource);
     }
-    
+
     /**
      * @return the id
@@ -87,5 +87,5 @@
         return this.resources;
     }
-    
+
     /**
      * @return the installedVersion
@@ -136,17 +136,17 @@
         }
         if(errorReported) {
-            JOptionPane.showMessageDialog(Main.parent, "One or more installs had an error: " + errorMessages.toString());            
+            JOptionPane.showMessageDialog(Main.parent, "One or more installs had an error: " + errorMessages.toString());
         }
     }
-    
+
     /* (non-Javadoc)
      * @see java.lang.Object#toString()
      */
     public String toString() {
-        return getClass().getSimpleName() + "[id=" + id 
-                                          + ", name=" + name 
-                                          + ", version=" + version 
-                                          + ", desc=" + description 
-                                          + ", resources=" + resources 
+        return getClass().getSimpleName() + "[id=" + id
+                                          + ", name=" + name
+                                          + ", version=" + version
+                                          + ", desc=" + description
+                                          + ", resources=" + resources
                                           + "]";
     }
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginHelper.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginHelper.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginHelper.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -18,9 +18,9 @@
  */
 public class PluginHelper {
-    
+
     private static PluginHelper INSTANCE = new PluginHelper();
     private Map<String, JMenu>menus;
     private VariableHelper variableHelper;
-    
+
     /**
      * Private constructor
@@ -35,10 +35,10 @@
 //        registerMenu("layer", Main.main.menu.layerMenu);
         registerMenu("help", Main.main.menu.helpMenu);
-        
+
         variableHelper = new VariableHelper();
         variableHelper.addAll(Main.pref.getAllPrefix(""));
         variableHelper.add("josm.user.dir", Main.pref.getPreferencesDir());
     }
-    
+
     /**
      * Returns the singleton instance of this helper.
@@ -48,5 +48,5 @@
         return INSTANCE;
     }
-    
+
     /**
      * Adds a menu to the main menu of JOSM and registers it under the given id.
@@ -59,8 +59,8 @@
         registerMenu(menuId, menu);
     }
-    
+
     /**
      * Register the menu under the given id so other plugins can retrieve
-     * the menu with {@link #getMenu(String)}. 
+     * the menu with {@link #getMenu(String)}.
      * @param menuId
      * @param menu
@@ -69,7 +69,7 @@
         menus.put(menuId, menu);
     }
-    
+
     /**
-     * Returns the main menu that was registered with the given id or <code>null</code> 
+     * Returns the main menu that was registered with the given id or <code>null</code>
      * if no menu was registered with that id. The default menus have the ids:
      * <code>file</code>, <code>view</code>, <code>edit</code>, <code>tools</code>,
@@ -87,5 +87,5 @@
         return this.variableHelper;
     }
-    
+
     /**
      * Returns the plugin with the given id or <code>null</code>
@@ -104,7 +104,7 @@
         return null;
     }
-    
 
-    
+
+
 
 }
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginManagerAction.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginManagerAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginManagerAction.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -16,5 +16,5 @@
  */
 public class PluginManagerAction extends AbstractAction {
-    
+
     /**
      * Constructor
@@ -36,5 +36,5 @@
         // left a list of sites, right buttons "add remote site"
         // list has checkboxes
-        // adding: name and url where site.xml can be found. 
+        // adding: name and url where site.xml can be found.
         // site.xml containing a list of plugin.xml files
         // plugin info holds name, version and dependencies (including versions)
@@ -43,12 +43,12 @@
         // page to download, page to install, page to enable new plugins
         // finish
-        
+
         // plugin.xml holds info
-        // name, version, dependencies, installpath, 
-        
+        // name, version, dependencies, installpath,
+
         // info about other resources: images, log4j.jar, ....
         // need source url and target dir (relative to .josm? or main app dir (for josm update))
         // need restart of josm afterwards
-        
+
         // pluginmanager could also load the plugins itself, so dependencies could be respected
     }
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginManagerPlugin.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginManagerPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginManagerPlugin.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -14,5 +14,5 @@
  */
 public class PluginManagerPlugin extends Plugin {
-    
+
     public PluginManagerPlugin() {
 //        JMenu menu = PluginHelper.getInstance().getMenu("tools");
@@ -20,5 +20,5 @@
 //        menu.add(new PluginManagerAction());
     }
-    
+
     @Override
     public PreferenceSetting getPreferenceSetting() {
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginManagerPreference.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginManagerPreference.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginManagerPreference.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -56,5 +56,5 @@
         if(sites.keySet().size() == 0) {
             // add default entry (for demonstration purpose)
-            sites.put(PREF_KEY_REMOTE_SITE_PREFIX + "0"+PREF_KEY_SITE_URL_SUFFIX, 
+            sites.put(PREF_KEY_REMOTE_SITE_PREFIX + "0"+PREF_KEY_SITE_URL_SUFFIX,
                 "http://www.tegmento.org/~cdaller/josm/");
         }
@@ -73,5 +73,5 @@
             }
             ++siteCount;
-        }        
+        }
         return listModel;
     }
@@ -82,5 +82,5 @@
     // only in 1.6 allowed @Override
     public void addGui(final PreferenceDialog gui) {
-        
+
         siteListModel = createListModel();
         siteList = new JList(siteListModel);
@@ -114,5 +114,5 @@
                 else {
                     int[] selected = siteList.getSelectedIndices();
-                    for (int i = selected.length - 1; i >=0; --i) {                        
+                    for (int i = selected.length - 1; i >=0; --i) {
                         siteListModel.removeElementAt(selected[i]);
                     }
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginResource.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginResource.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginResource.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -22,5 +22,5 @@
     private String errorMessage;
     private Exception errorException;
-    
+
     /**
      * @return the resourceUrl
@@ -47,5 +47,5 @@
         this.target = target;
     }
-    
+
     /**
      * @return the errorMessage
@@ -73,11 +73,11 @@
     }
     /**
-     * Installs the resource into to the target location. 
-     * @throws IOException if the resource could not be read or written. 
+     * Installs the resource into to the target location.
+     * @throws IOException if the resource could not be read or written.
      */
     public void install() {
        File targetFile = new File(target);
-       if(targetFile.isDirectory() 
-          || targetFile.getAbsolutePath().endsWith("/") 
+       if(targetFile.isDirectory()
+          || targetFile.getAbsolutePath().endsWith("/")
           || targetFile.getAbsolutePath().endsWith("\\")) {
            targetFile = new File(targetFile, resourceUrl.getFile());
@@ -88,5 +88,5 @@
            return;
        }
-       
+
        // copy resource to local filesystem:
        System.out.println("Install " + resourceUrl + " to " + targetFile);
@@ -112,5 +112,5 @@
              } catch(IOException ignore) {}
        }
-       
+
     }
     /* (non-Javadoc)
@@ -120,4 +120,4 @@
         return getClass().getSimpleName() + "[url=" + resourceUrl + ", target=" + target + "]";
     }
- 
+
 }
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginTableModel.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginTableModel.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginTableModel.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -17,10 +17,10 @@
     private List<SiteDescription> sites;
     private List<PluginDescription> plugins;
-    
+
     public PluginTableModel(List<SiteDescription> descriptions) {
         this.sites = descriptions;
         update();
     }
-    
+
     private void update() {
         plugins = new ArrayList<PluginDescription>();
@@ -29,6 +29,6 @@
         }
     }
-    
-    
+
+
 
     /* (non-Javadoc)
@@ -65,11 +65,11 @@
             return plugin.getInstalledVersion() + " -> " + plugin.getVersion();
         } else {
-            return plugin.getVersion();            
+            return plugin.getVersion();
         }
         default: throw new IllegalArgumentException("Illegal Column Index " + columnIndex);
         }
     }
-    
-    
+
+
 
     /* (non-Javadoc)
@@ -121,5 +121,5 @@
             }
         }
-        
+
     }
 
@@ -151,8 +151,8 @@
         this.plugins = plugins;
     }
-    
-    
-    
-    
+
+
+
+
 
 }
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginUpdateFrame.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginUpdateFrame.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/PluginUpdateFrame.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -32,5 +32,5 @@
     /**
      * @param title
-     * @param descriptions 
+     * @param descriptions
      * @throws HeadlessException
      */
@@ -39,7 +39,7 @@
         init(descriptions);
     }
-    
+
     public void init(List<SiteDescription> descriptions) {
-        
+
         /* Setup panes */
         JPanel content = new JPanel(new BorderLayout(12,12));
@@ -53,5 +53,5 @@
 
         content.add(BorderLayout.CENTER,tabPane);
-        
+
         JPanel buttonPannel = new JPanel();
         // <FIXXME date="23.06.2007" author="cdaller">
@@ -59,5 +59,5 @@
         JButton okButton = new JButton(tr("Install"));
         JButton cancelButton = new JButton(tr("Cancel"));
-        // </FIXXME> 
+        // </FIXXME>
         buttonPannel.add(okButton);
         buttonPannel.add(cancelButton);
@@ -68,15 +68,15 @@
                 setVisible(false);
                 dispose();
-            }   
+            }
         });
-        
+
         cancelButton.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 setVisible(false);
                 dispose();
-            }   
+            }
         });
         content.add(BorderLayout.SOUTH,buttonPannel);
-        
+
         pack();
     }
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/SiteDescription.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/SiteDescription.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/SiteDescription.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -30,5 +30,5 @@
     private URL url;
     List<PluginDescription>plugins = new ArrayList<PluginDescription>();
-    
+
     /**
      * Default Constructor
@@ -47,5 +47,5 @@
         this.url = new URL(url);
     }
-    
+
     /**
      * @param name
@@ -56,5 +56,5 @@
         this.name = name;
     }
-    
+
 
     /**
@@ -71,8 +71,8 @@
     }
 
-    
+
     /**
      * Load the site description from the url.
-     * @throws IOException 
+     * @throws IOException
      */
     public void loadFromUrl() throws IOException {
@@ -84,6 +84,6 @@
         // TODO check and remember modified since date to compare and not load sites that did not change
         // connection.getIfModifiedSince()
-        // </FIXXME> 
-        
+        // </FIXXME>
+
         Reader in = new InputStreamReader(connection.getInputStream());
         SiteDescriptionParser parser = new SiteDescriptionParser(this);
@@ -111,5 +111,5 @@
             if(info != null) {
                 if(info.version == null) {
-                    plugin.setInstalledVersion("?");                    
+                    plugin.setInstalledVersion("?");
                 } else {
                     plugin.setInstalledVersion(info.version);
@@ -118,5 +118,5 @@
         }
     }
-    
+
     /**
      * @return the plugins
@@ -133,5 +133,5 @@
     }
 
-    
+
     /**
      * @return the url
@@ -158,7 +158,7 @@
             return name;
         }
-        
+
     }
-    
+
     /**
      * Used by ListCellRenderer, so not only a debug method!
@@ -168,5 +168,5 @@
         return getLabelName();
     }
-    
+
     public static void main(String[] args) {
         try {
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/SiteDescriptionParser.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/SiteDescriptionParser.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/SiteDescriptionParser.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -23,5 +23,5 @@
     private StringBuilder characters;
     private VariableHelper variableHelper;
-    
+
     /**
      * Constructor using a new SiteDescription object.
@@ -33,10 +33,10 @@
      * Constructor using a description object to fill.
      * @param siteDescription the object to fill.
-     * @param in the reader to fill the description with. 
+     * @param in the reader to fill the description with.
      */
     public SiteDescriptionParser(SiteDescription siteDescription) {
         this.siteDescription = siteDescription;
     }
-    
+
     /**
      * Returns the site description object.
@@ -117,6 +117,6 @@
         }
     }
-    
-    /** 
+
+    /**
      * Read characters for description.
      */
@@ -127,5 +127,5 @@
         characters.append(data, start, length);
     }
-    
+
     /* (non-Javadoc)
      * @see uk.co.wilson.xml.MinML2#endElement(java.lang.String, java.lang.String, java.lang.String)
@@ -158,5 +158,5 @@
        }
     }
-    
+
     /**
      * Clears the characters and returns the its previous content.
@@ -168,6 +168,6 @@
         return chars;
     }
-    
-    
+
+
 
 }
Index: /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/VariableHelper.java
===================================================================
--- /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/VariableHelper.java	(revision 12777)
+++ /applications/editors/josm/plugins/pluginmanager/src/at/dallermassl/josm/plugin/pluginmanager/VariableHelper.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.pluginmanager;
@@ -10,8 +10,8 @@
 
 /**
- * Helper class that replaces variables in strings with its values. The variables are in the 
+ * Helper class that replaces variables in strings with its values. The variables are in the
  * form ${name}. Replacement values may be set. As a fallback (if the variable is not found)
  * the system properties are used. If neither is found, the variable is not replaced.
- * 
+ *
  * @author cdaller
  *
@@ -20,9 +20,9 @@
     private Pattern varPattern = Pattern.compile("\\$\\{(.+?)\\}");
     private Map<String, String> variables;
-    
+
     public VariableHelper() {
         variables = new HashMap<String, String>();
     }
-    
+
     /**
      * Adds all key/values as variables.
@@ -32,5 +32,5 @@
         variables.putAll(values);
     }
-    
+
     /**
      * Adds a single key/value pair.
@@ -41,5 +41,5 @@
         variables.put(key, value);
     }
-    
+
     /**
      * Replaces all variable placeholder in the given string with the replacement.
@@ -71,5 +71,5 @@
         return source.toString();
     }
-    
+
     public static void main(String[] args) {
         VariableHelper helper = new VariableHelper();
Index: /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/HttpServer.java
===================================================================
--- /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/HttpServer.java	(revision 12777)
+++ /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/HttpServer.java	(revision 12778)
@@ -8,5 +8,5 @@
 
 /**
- * Simple HTTP server that spawns a {@link RequestProcessor} for every 
+ * Simple HTTP server that spawns a {@link RequestProcessor} for every
  * connection.
  *
@@ -17,59 +17,59 @@
 
     /** Default port for the HTTP server */
-	public static final int DEFAULT_PORT = 8111;
-	
-	/** The server socket */
-	private ServerSocket server;
+    public static final int DEFAULT_PORT = 8111;
 
-	/**
-	 * Constructor
-	 * @param port The port this server will listen on
-	 * @throws IOException when connection errors
-	 */
-	public HttpServer(int port)
-		throws IOException 
-	{
-		super("RemoteControl HTTP Server");
-		this.setDaemon(true);
-		// Start the server socket with only 1 connection.
+    /** The server socket */
+    private ServerSocket server;
+
+    /**
+     * Constructor
+     * @param port The port this server will listen on
+     * @throws IOException when connection errors
+     */
+    public HttpServer(int port)
+        throws IOException
+    {
+        super("RemoteControl HTTP Server");
+        this.setDaemon(true);
+        // Start the server socket with only 1 connection.
         // Also make sure we only listen
         // on the local interface so nobody from the outside can connect!
-		this.server = new ServerSocket(port, 1, 
+        this.server = new ServerSocket(port, 1,
             InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
-	}
+    }
 
-	/**
-	 * The main loop, spawns a {@link RequestProcessor} for each connection
-	 */
-	public void run() 
-	{
-		System.out.println("RemoteControl::Accepting connections on port " + server.getLocalPort());
-		while (true) 
-		{
-			try 
-			{
-				Socket request = server.accept();
-				RequestProcessor.processRequest(request);
-			}
-			catch( SocketException se)
-			{
-				if( !server.isClosed() )
-					se.printStackTrace();
-			}
-			catch (IOException ioe) 
-			{
-				ioe.printStackTrace();
-			}
-		}
-	}
-	
-	/**
+    /**
+     * The main loop, spawns a {@link RequestProcessor} for each connection
+     */
+    public void run()
+    {
+        System.out.println("RemoteControl::Accepting connections on port " + server.getLocalPort());
+        while (true)
+        {
+            try
+            {
+                Socket request = server.accept();
+                RequestProcessor.processRequest(request);
+            }
+            catch( SocketException se)
+            {
+                if( !server.isClosed() )
+                    se.printStackTrace();
+            }
+            catch (IOException ioe)
+            {
+                ioe.printStackTrace();
+            }
+        }
+    }
+
+    /**
      * Stops the HTTP server
-     *  
+     *
      * @throws IOException
-	 */
-	public void stopServer() throws IOException
-	{
-		server.close();
-	}
+     */
+    public void stopServer() throws IOException
+    {
+        server.close();
+    }
 }
Index: /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RemoteControlPlugin.java
===================================================================
--- /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RemoteControlPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RemoteControlPlugin.java	(revision 12778)
@@ -12,40 +12,40 @@
 public class RemoteControlPlugin extends Plugin 
 {
-	/** The HTTP server this plugin launches */
-	static HttpServer server;
+    /** The HTTP server this plugin launches */
+    static HttpServer server;
     
-	/**
-	 * Creates the plugin, and starts the HTTP server
-	 */
-	public RemoteControlPlugin()
-	{
-		restartServer();
-	}
-	
+    /**
+     * Creates the plugin, and starts the HTTP server
+     */
+    public RemoteControlPlugin()
+    {
+        restartServer();
+    }
+    
     @Override
-	public PreferenceSetting getPreferenceSetting() 
-	{
-		return new RemoteControlPreferences();
-	}
-	
-	/**
-	 * Starts or restarts the HTTP server
-	 *
-	 */
-	public void restartServer()
-	{
-		try
-		{
-			if (server != null)
-				server.stopServer();
-			
-			int port = HttpServer.DEFAULT_PORT;
-			server = new HttpServer(port);
-			server.start();
-		}
-		catch(IOException ioe)
-		{
-			ioe.printStackTrace();
-		}
-	}
+    public PreferenceSetting getPreferenceSetting() 
+    {
+        return new RemoteControlPreferences();
+    }
+    
+    /**
+     * Starts or restarts the HTTP server
+     *
+     */
+    public void restartServer()
+    {
+        try
+        {
+            if (server != null)
+                server.stopServer();
+            
+            int port = HttpServer.DEFAULT_PORT;
+            server = new HttpServer(port);
+            server.start();
+        }
+        catch(IOException ioe)
+        {
+            ioe.printStackTrace();
+        }
+    }
 }
Index: /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RemoteControlPreferences.java
===================================================================
--- /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RemoteControlPreferences.java	(revision 12777)
+++ /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RemoteControlPreferences.java	(revision 12778)
@@ -18,49 +18,49 @@
 /**
  * Preference settings for the Remote Control plugin
- * 
+ *
  * @author Frederik Ramm
  */
 public class RemoteControlPreferences implements PreferenceSetting
 {
-	private JCheckBox permissionLoadData = new JCheckBox(tr("load data from API"));
-	private JCheckBox permissionChangeSelection = new JCheckBox(tr("change the selection"));
-	private JCheckBox permissionChangeViewport = new JCheckBox(tr("change the viewport"));
-	private JCheckBox alwaysAskUserConfirm = new JCheckBox(tr("confirm all Remote Control actions manually"));
-	
-    public void addGui(final PreferenceDialog gui) 
+    private JCheckBox permissionLoadData = new JCheckBox(tr("load data from API"));
+    private JCheckBox permissionChangeSelection = new JCheckBox(tr("change the selection"));
+    private JCheckBox permissionChangeViewport = new JCheckBox(tr("change the viewport"));
+    private JCheckBox alwaysAskUserConfirm = new JCheckBox(tr("confirm all Remote Control actions manually"));
+
+    public void addGui(final PreferenceDialog gui)
     {
-		Version ver = Util.getVersion();
-		String description = tr("A plugin that allows JOSM to be controlled from other applications.");
-		if (ver != null)
-			description += "<br><br>" + tr("Version: {0}<br>Last change at {1}", ver.revision, ver.time) + "<br><br>";
-    	JPanel remote = gui.createPreferenceTab("remotecontrol.gif", tr("Remote Control"), tr("Settings for the Remote Control plugin."));    
-    	remote.add(new JLabel("<html>"+tr("The Remote Control plugin will always listen on port 8111 on localhost." + 
-    			"The port is not variable because it is referenced by external applications talking to the plugin.") + "</html>"), GBC.eol().insets(0,5,0,10).fill(GBC.HORIZONTAL));
+        Version ver = Util.getVersion();
+        String description = tr("A plugin that allows JOSM to be controlled from other applications.");
+        if (ver != null)
+            description += "<br><br>" + tr("Version: {0}<br>Last change at {1}", ver.revision, ver.time) + "<br><br>";
+        JPanel remote = gui.createPreferenceTab("remotecontrol.gif", tr("Remote Control"), tr("Settings for the Remote Control plugin."));
+        remote.add(new JLabel("<html>"+tr("The Remote Control plugin will always listen on port 8111 on localhost." +
+                "The port is not variable because it is referenced by external applications talking to the plugin.") + "</html>"), GBC.eol().insets(0,5,0,10).fill(GBC.HORIZONTAL));
 
-    	JPanel perms = new JPanel();
-    	perms.setLayout(new GridBagLayout());
-    	perms.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.gray), tr("Permitted actions")));
+        JPanel perms = new JPanel();
+        perms.setLayout(new GridBagLayout());
+        perms.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.gray), tr("Permitted actions")));
         perms.add(permissionLoadData, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
         perms.add(permissionChangeSelection, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
-        perms.add(permissionChangeViewport, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));       
+        perms.add(permissionChangeViewport, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
         remote.add(perms, GBC.eol().fill(GBC.HORIZONTAL));
-        
+
         remote.add(alwaysAskUserConfirm, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
         remote.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));
 
-        
+
         permissionLoadData.setSelected(Main.pref.getBoolean("remotecontrol.permission.load-data", true));
         permissionChangeSelection.setSelected(Main.pref.getBoolean("remotecontrol.permission.change-selection", true));
         permissionChangeViewport.setSelected(Main.pref.getBoolean("remotecontrol.permission.change-viewport", true));
         alwaysAskUserConfirm.setSelected(Main.pref.getBoolean("remotecontrol.always-confirm", false));
-        
+
     }
-    
+
     public boolean ok() {
-    	Main.pref.put("remotecontrol.permission.load-data", permissionLoadData.isSelected());
-    	Main.pref.put("remotecontrol.permission.change-selection", permissionChangeSelection.isSelected());
-    	Main.pref.put("remotecontrol.permission.change-viewport", permissionChangeViewport.isSelected());
-    	Main.pref.put("remotecontrol.always-confirm", alwaysAskUserConfirm.isSelected());
-    	return false;
+        Main.pref.put("remotecontrol.permission.load-data", permissionLoadData.isSelected());
+        Main.pref.put("remotecontrol.permission.change-selection", permissionChangeSelection.isSelected());
+        Main.pref.put("remotecontrol.permission.change-viewport", permissionChangeViewport.isSelected());
+        Main.pref.put("remotecontrol.always-confirm", alwaysAskUserConfirm.isSelected());
+        return false;
     }
 }
Index: /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RequestProcessor.java
===================================================================
--- /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RequestProcessor.java	(revision 12777)
+++ /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RequestProcessor.java	(revision 12778)
@@ -30,69 +30,69 @@
  * Processes HTTP "remote control" requests.
  */
-public class RequestProcessor extends Thread 
+public class RequestProcessor extends Thread
 {
-	/** The socket this processor listens on */
-	private Socket request;
-	
-	private class AlreadyLoadedException extends Exception {};
-	private class DeniedException extends Exception {};
-	private class LoadDeniedException extends Exception {};
-  
-	/**
-	 * Constructor
-	 * 
-	 * @param request 
-	 */
-	public RequestProcessor(Socket request) 
-	{
-	    super("RemoteControl request processor");
-	    this.setDaemon(true);
-		this.request = request;
-	}
-  
-	/**
-	 * Spawns a new thread for the request
-	 * 
-	 * @param request The WMS request
-	 */
-	public static void processRequest(Socket request) 
-	{
-		RequestProcessor processor = new RequestProcessor(request);
-		processor.start();
-	}  
-  
-	/**
-	 * The work is done here.
-	 */
-	public void run() 
-	{
-		Writer out = null;
-		try 
-		{            
-	        OutputStream raw = new BufferedOutputStream( request.getOutputStream());         
-	        out = new OutputStreamWriter(raw);
-	        Reader in = new InputStreamReader(new BufferedInputStream(request.getInputStream()), "ASCII");
-	        
-	        StringBuffer requestLine = new StringBuffer();
-	        while (true) 
-	        {
-	            int c = in.read();
-	            if (c == '\r' || c == '\n') break;
-	            requestLine.append((char) c);
-	        }
-	        
-	        System.out.println("RemoteControl received: " + requestLine);
-	        String get = requestLine.toString();
-	        StringTokenizer st = new StringTokenizer(get);
-	        String method = st.nextToken();
-	        String url = st.nextToken();
-
-	        if(!method.equals("GET")) {
-	        	sendNotImplemented(out);
-	        	return;
-	        }
+    /** The socket this processor listens on */
+    private Socket request;
+
+    private class AlreadyLoadedException extends Exception {};
+    private class DeniedException extends Exception {};
+    private class LoadDeniedException extends Exception {};
+
+    /**
+     * Constructor
+     *
+     * @param request
+     */
+    public RequestProcessor(Socket request)
+    {
+        super("RemoteControl request processor");
+        this.setDaemon(true);
+        this.request = request;
+    }
+
+    /**
+     * Spawns a new thread for the request
+     *
+     * @param request The WMS request
+     */
+    public static void processRequest(Socket request)
+    {
+        RequestProcessor processor = new RequestProcessor(request);
+        processor.start();
+    }
+
+    /**
+     * The work is done here.
+     */
+    public void run()
+    {
+        Writer out = null;
+        try
+        {
+            OutputStream raw = new BufferedOutputStream( request.getOutputStream());
+            out = new OutputStreamWriter(raw);
+            Reader in = new InputStreamReader(new BufferedInputStream(request.getInputStream()), "ASCII");
+
+            StringBuffer requestLine = new StringBuffer();
+            while (true)
+            {
+                int c = in.read();
+                if (c == '\r' || c == '\n') break;
+                requestLine.append((char) c);
+            }
+
+            System.out.println("RemoteControl received: " + requestLine);
+            String get = requestLine.toString();
+            StringTokenizer st = new StringTokenizer(get);
+            String method = st.nextToken();
+            String url = st.nextToken();
+
+            if(!method.equals("GET")) {
+                sendNotImplemented(out);
+                return;
+            }
 
             st = new StringTokenizer(url, "&?");
-            String command = null; 
+            String command = null;
             HashMap<String,String> args = new HashMap<String,String>();
             while (st.hasMoreTokens())
@@ -106,239 +106,239 @@
                 }
             }
-            
+
             if (command.equals("/load_and_zoom")) {
-            	if (Main.pref.getBoolean("remotecontrol.always-confirm", false)) {
-            		if (JOptionPane.showConfirmDialog(Main.parent,
-            			"<html>" + tr("Remote Control has been asked to load data from the API.") +
+                if (Main.pref.getBoolean("remotecontrol.always-confirm", false)) {
+                    if (JOptionPane.showConfirmDialog(Main.parent,
+                        "<html>" + tr("Remote Control has been asked to load data from the API.") +
                         "<br>" + tr("Request details: {0}", url) + "<br>" + tr("Do you want to allow this?"),
-            			tr("Confirm Remote Control action"),
-            			JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
-            				sendForbidden(out);
-            				return;
-            		}
-            	}
-            	DownloadTask osmTask = new DownloadOsmTask();
-				if (!(args.containsKey("bottom") && args.containsKey("top") && 
-					args.containsKey("left") && args.containsKey("right"))) {
-					sendBadRequest(out);
-					System.out.println("load_and_zoom remote control request must have bottom,top,left,right parameters");
-					return;	
-				}
-				double minlat = 0;
-				double maxlat = 0;
-				double minlon = 0;
-				double maxlon = 0;
-				try {
-					minlat = Double.parseDouble(args.get("bottom"));
-					maxlat = Double.parseDouble(args.get("top"));
-					minlon = Double.parseDouble(args.get("left"));
-					maxlon = Double.parseDouble(args.get("right"));
-					
-					if (!Main.pref.getBoolean("remotecontrol.permission.load-data", true))
-						throw new LoadDeniedException();
-					
-					// find out whether some data has already been downloaded
-					Area present = Main.ds.getDataSourceArea();
-					if (present != null && !present.isEmpty()) {
-						Area toDownload = new Area(new Rectangle2D.Double(minlon,minlat,maxlon-minlon,maxlat-minlat));
-						toDownload.subtract(present);
-						if (toDownload.isEmpty()) throw new AlreadyLoadedException();
-						// the result might not be a rectangle (L shaped etc)
-						Rectangle2D downloadBounds = toDownload.getBounds2D();
-						minlat = downloadBounds.getMinY();
-						minlon = downloadBounds.getMinX();
-						maxlat = downloadBounds.getMaxY();
-						maxlon = downloadBounds.getMaxX();
-					}
-					osmTask.download(null, minlat,minlon,maxlat,maxlon);
-				} catch (AlreadyLoadedException ex) {
-					System.out.println("RemoteControl: no download necessary");
-				} catch (LoadDeniedException ex) {
-					System.out.println("RemoteControl: download forbidden by preferences");
-				} catch (Exception ex) {
-					sendError(out);
-					System.out.println("RemoteControl: Error parsing load_and_zoom remote control request:");
-					ex.printStackTrace();
-					return;
-				}
-				if (args.containsKey("select") && Main.pref.getBoolean("remotecontrol.permission.change-selection", true)) {
-					// select objects after downloading, zoom to selection.
-					final String selection = args.get("select");
-					Main.worker.execute(new Runnable() {
-						public void run() {
-							HashSet<Long> ways = new HashSet<Long>();
-							HashSet<Long> nodes = new HashSet<Long>();
-							HashSet<Long> relations = new HashSet<Long>();
-							HashSet<OsmPrimitive> newSel = new HashSet<OsmPrimitive>();
-							for (String item : selection.split(",")) {
-								if (item.startsWith("way"))	{
-									ways.add(Long.parseLong(item.substring(3)));
-								} else if (item.startsWith("node")) {
-									nodes.add(Long.parseLong(item.substring(4)));
-								} else if (item.startsWith("relation")) {
-									relations.add(Long.parseLong(item.substring(8)));
-								} else {
-									System.out.println("RemoteControl: invalid selection '"+item+"' ignored");
-								}
-							}
-							for (Way w : Main.ds.ways) if (ways.contains(w.id)) newSel.add(w);
-							for (Node n : Main.ds.nodes) if (nodes.contains(n.id)) newSel.add(n);
-							for (Relation r : Main.ds.relations) if (relations.contains(r.id)) newSel.add(r);	
-							Main.ds.setSelected(newSel);
-							if (Main.pref.getBoolean("remotecontrol.permission.change-viewport", true))
-								new AutoScaleAction("selection").actionPerformed(null);
-						}
-					});
-				} else if (Main.pref.getBoolean("remotecontrol.permission.change-viewport", true)) {
-					// after downloading, zoom to downloaded area.
-					final LatLon min = new LatLon(minlat, minlon);
-					final LatLon max = new LatLon(maxlat, maxlon);
-					
-					Main.worker.execute(new Runnable() {
-						public void run() {
-							BoundingXYVisitor bbox = new BoundingXYVisitor();
-							bbox.min = Main.proj.latlon2eastNorth(min);
-							bbox.max = Main.proj.latlon2eastNorth(max);
-							Main.map.mapView.recalculateCenterScale(bbox);
-						}
-					});
-				}
+                        tr("Confirm Remote Control action"),
+                        JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
+                            sendForbidden(out);
+                            return;
+                    }
+                }
+                DownloadTask osmTask = new DownloadOsmTask();
+                if (!(args.containsKey("bottom") && args.containsKey("top") &&
+                    args.containsKey("left") && args.containsKey("right"))) {
+                    sendBadRequest(out);
+                    System.out.println("load_and_zoom remote control request must have bottom,top,left,right parameters");
+                    return;
+                }
+                double minlat = 0;
+                double maxlat = 0;
+                double minlon = 0;
+                double maxlon = 0;
+                try {
+                    minlat = Double.parseDouble(args.get("bottom"));
+                    maxlat = Double.parseDouble(args.get("top"));
+                    minlon = Double.parseDouble(args.get("left"));
+                    maxlon = Double.parseDouble(args.get("right"));
+
+                    if (!Main.pref.getBoolean("remotecontrol.permission.load-data", true))
+                        throw new LoadDeniedException();
+
+                    // find out whether some data has already been downloaded
+                    Area present = Main.ds.getDataSourceArea();
+                    if (present != null && !present.isEmpty()) {
+                        Area toDownload = new Area(new Rectangle2D.Double(minlon,minlat,maxlon-minlon,maxlat-minlat));
+                        toDownload.subtract(present);
+                        if (toDownload.isEmpty()) throw new AlreadyLoadedException();
+                        // the result might not be a rectangle (L shaped etc)
+                        Rectangle2D downloadBounds = toDownload.getBounds2D();
+                        minlat = downloadBounds.getMinY();
+                        minlon = downloadBounds.getMinX();
+                        maxlat = downloadBounds.getMaxY();
+                        maxlon = downloadBounds.getMaxX();
+                    }
+                    osmTask.download(null, minlat,minlon,maxlat,maxlon);
+                } catch (AlreadyLoadedException ex) {
+                    System.out.println("RemoteControl: no download necessary");
+                } catch (LoadDeniedException ex) {
+                    System.out.println("RemoteControl: download forbidden by preferences");
+                } catch (Exception ex) {
+                    sendError(out);
+                    System.out.println("RemoteControl: Error parsing load_and_zoom remote control request:");
+                    ex.printStackTrace();
+                    return;
+                }
+                if (args.containsKey("select") && Main.pref.getBoolean("remotecontrol.permission.change-selection", true)) {
+                    // select objects after downloading, zoom to selection.
+                    final String selection = args.get("select");
+                    Main.worker.execute(new Runnable() {
+                        public void run() {
+                            HashSet<Long> ways = new HashSet<Long>();
+                            HashSet<Long> nodes = new HashSet<Long>();
+                            HashSet<Long> relations = new HashSet<Long>();
+                            HashSet<OsmPrimitive> newSel = new HashSet<OsmPrimitive>();
+                            for (String item : selection.split(",")) {
+                                if (item.startsWith("way")) {
+                                    ways.add(Long.parseLong(item.substring(3)));
+                                } else if (item.startsWith("node")) {
+                                    nodes.add(Long.parseLong(item.substring(4)));
+                                } else if (item.startsWith("relation")) {
+                                    relations.add(Long.parseLong(item.substring(8)));
+                                } else {
+                                    System.out.println("RemoteControl: invalid selection '"+item+"' ignored");
+                                }
+                            }
+                            for (Way w : Main.ds.ways) if (ways.contains(w.id)) newSel.add(w);
+                            for (Node n : Main.ds.nodes) if (nodes.contains(n.id)) newSel.add(n);
+                            for (Relation r : Main.ds.relations) if (relations.contains(r.id)) newSel.add(r);
+                            Main.ds.setSelected(newSel);
+                            if (Main.pref.getBoolean("remotecontrol.permission.change-viewport", true))
+                                new AutoScaleAction("selection").actionPerformed(null);
+                        }
+                    });
+                } else if (Main.pref.getBoolean("remotecontrol.permission.change-viewport", true)) {
+                    // after downloading, zoom to downloaded area.
+                    final LatLon min = new LatLon(minlat, minlon);
+                    final LatLon max = new LatLon(maxlat, maxlon);
+
+                    Main.worker.execute(new Runnable() {
+                        public void run() {
+                            BoundingXYVisitor bbox = new BoundingXYVisitor();
+                            bbox.min = Main.proj.latlon2eastNorth(min);
+                            bbox.max = Main.proj.latlon2eastNorth(max);
+                            Main.map.mapView.recalculateCenterScale(bbox);
+                        }
+                    });
+                }
             } else if (command.equals("/import")) {
-            	if (Main.pref.getBoolean("remotecontrol.always-confirm", false)) {
-            		if (JOptionPane.showConfirmDialog(Main.parent,
-            			"<html>" + tr("Remote Control has been asked to import data from the following URL:") + 
-                        "<br>" + url + 
+                if (Main.pref.getBoolean("remotecontrol.always-confirm", false)) {
+                    if (JOptionPane.showConfirmDialog(Main.parent,
+                        "<html>" + tr("Remote Control has been asked to import data from the following URL:") +
+                        "<br>" + url +
                         "<br>" + tr("Do you want to allow this?"),
-            			tr("Confirm Remote Control action"),
-            			JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
-            				sendForbidden(out);
-            				return;
-            		}
-            	}
-				if (!(args.containsKey("url"))) {
-					sendBadRequest(out);
-					System.out.println("'import' remote control request must have url parameter");
-					return;	
-				}
-				try {
-					if (!Main.pref.getBoolean("remotecontrol.permission.import", true))
-						throw new LoadDeniedException();
-					
-            	    DownloadTask osmTask = new DownloadOsmTask();
-					osmTask.loadUrl(false, URLDecoder.decode(args.get("url"), "UTF-8"));
-				} catch (LoadDeniedException ex) {
-					System.out.println("RemoteControl: import forbidden by preferences");
-				} catch (Exception ex) {
-					sendError(out);
-					System.out.println("RemoteControl: Error parsing import remote control request:");
-					ex.printStackTrace();
-					return;
-				}
+                        tr("Confirm Remote Control action"),
+                        JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
+                            sendForbidden(out);
+                            return;
+                    }
+                }
+                if (!(args.containsKey("url"))) {
+                    sendBadRequest(out);
+                    System.out.println("'import' remote control request must have url parameter");
+                    return;
+                }
+                try {
+                    if (!Main.pref.getBoolean("remotecontrol.permission.import", true))
+                        throw new LoadDeniedException();
+
+                    DownloadTask osmTask = new DownloadOsmTask();
+                    osmTask.loadUrl(false, URLDecoder.decode(args.get("url"), "UTF-8"));
+                } catch (LoadDeniedException ex) {
+                    System.out.println("RemoteControl: import forbidden by preferences");
+                } catch (Exception ex) {
+                    sendError(out);
+                    System.out.println("RemoteControl: Error parsing import remote control request:");
+                    ex.printStackTrace();
+                    return;
+                }
                 // TODO: select/zoom to downloaded
             }
-			sendHeader(out, "200 OK", "text/plain", false);
+            sendHeader(out, "200 OK", "text/plain", false);
             out.write("Content-length: 4\r\n");
             out.write("\r\n");
             out.write("OK\r\n");
             out.flush();
-		}
-		catch (IOException ioe) { }
-		catch(Exception e) {
-			e.printStackTrace();
-			try {
-				sendError(out);
-			} catch (IOException e1) { }
-		} finally {
-	        try {
-	        	request.close();        
-	        } catch (IOException e) {} 
-		}
-	}
-
-	/**
-	 * Sends a 500 error: server error
-	 * @param out The writer where the error is written
-	 * @throws IOException If the error can not be written
-	 */
-	private void sendError(Writer out) throws IOException
-	{
-		sendHeader(out, "500 Internal Server Error", "text/html", true);
-		out.write("<HTML>\r\n");
-		out.write("<HEAD><TITLE>Internal Error</TITLE>\r\n");
-		out.write("</HEAD>\r\n");
-		out.write("<BODY>");
-		out.write("<H1>HTTP Error 500: Internal Server Error</h2>\r\n");
-		out.write("</BODY></HTML>\r\n");
-		out.flush();
-	}
-
-	/**
-	 * Sends a 501 error: not implemented
-	 * @param out The writer where the error is written
-	 * @throws IOException If the error can not be written
-	 */
-	private void sendNotImplemented(Writer out) throws IOException
-	{
-		sendHeader(out, "501 Not Implemented", "text/html", true);
-		out.write("<HTML>\r\n");
-		out.write("<HEAD><TITLE>Not Implemented</TITLE>\r\n");
-		out.write("</HEAD>\r\n");
-		out.write("<BODY>");
-		out.write("<H1>HTTP Error 501: Not Implemented</h2>\r\n");
-		out.write("</BODY></HTML>\r\n");
-		out.flush();
-	}
-
-	/**
-	 * Sends a 403 error: forbidden
-	 * @param out The writer where the error is written
-	 * @throws IOException If the error can not be written
-	 */
-	private void sendForbidden(Writer out) throws IOException
-	{
-		sendHeader(out, "403 Forbidden", "text/html", true);
-		out.write("<HTML>\r\n");
-		out.write("<HEAD><TITLE>Forbidden</TITLE>\r\n");
-		out.write("</HEAD>\r\n");
-		out.write("<BODY>");
-		out.write("<H1>HTTP Error 403: Forbidden</h2>\r\n");
-		out.write("</BODY></HTML>\r\n");
-		out.flush();
-	}
-	/**
-	 * Sends a 403 error: forbidden
-	 * @param out The writer where the error is written
-	 * @throws IOException If the error can not be written
-	 */
-	private void sendBadRequest(Writer out) throws IOException
-	{
-		sendHeader(out, "400 Bad Request", "text/html", true);
-		out.write("<HTML>\r\n");
-		out.write("<HEAD><TITLE>Bad Request</TITLE>\r\n");
-		out.write("</HEAD>\r\n");
-		out.write("<BODY>");
-		out.write("<H1>HTTP Error 400: Bad Request</h2>\r\n");
-		out.write("</BODY></HTML>\r\n");
-		out.flush();
-	}
-	
-	/**
-	 * Send common HTTP headers to the client.
-	 * 
-	 * @param out The Writer
-	 * @param status The status string ("200 OK", "500", etc)
-	 * @param contentType The content type of the data sent
-	 * @param endHeaders If true, adds a new line, ending the headers.
-	 * @throws IOException When error
-	 */
-	private void sendHeader(Writer out, String status, String contentType, boolean endHeaders) throws IOException
-	{
-		out.write("HTTP/1.1 " + status + "\r\n");
-		Date now = new Date();
-		out.write("Date: " + now + "\r\n");
+        }
+        catch (IOException ioe) { }
+        catch(Exception e) {
+            e.printStackTrace();
+            try {
+                sendError(out);
+            } catch (IOException e1) { }
+        } finally {
+            try {
+                request.close();
+            } catch (IOException e) {}
+        }
+    }
+
+    /**
+     * Sends a 500 error: server error
+     * @param out The writer where the error is written
+     * @throws IOException If the error can not be written
+     */
+    private void sendError(Writer out) throws IOException
+    {
+        sendHeader(out, "500 Internal Server Error", "text/html", true);
+        out.write("<HTML>\r\n");
+        out.write("<HEAD><TITLE>Internal Error</TITLE>\r\n");
+        out.write("</HEAD>\r\n");
+        out.write("<BODY>");
+        out.write("<H1>HTTP Error 500: Internal Server Error</h2>\r\n");
+        out.write("</BODY></HTML>\r\n");
+        out.flush();
+    }
+
+    /**
+     * Sends a 501 error: not implemented
+     * @param out The writer where the error is written
+     * @throws IOException If the error can not be written
+     */
+    private void sendNotImplemented(Writer out) throws IOException
+    {
+        sendHeader(out, "501 Not Implemented", "text/html", true);
+        out.write("<HTML>\r\n");
+        out.write("<HEAD><TITLE>Not Implemented</TITLE>\r\n");
+        out.write("</HEAD>\r\n");
+        out.write("<BODY>");
+        out.write("<H1>HTTP Error 501: Not Implemented</h2>\r\n");
+        out.write("</BODY></HTML>\r\n");
+        out.flush();
+    }
+
+    /**
+     * Sends a 403 error: forbidden
+     * @param out The writer where the error is written
+     * @throws IOException If the error can not be written
+     */
+    private void sendForbidden(Writer out) throws IOException
+    {
+        sendHeader(out, "403 Forbidden", "text/html", true);
+        out.write("<HTML>\r\n");
+        out.write("<HEAD><TITLE>Forbidden</TITLE>\r\n");
+        out.write("</HEAD>\r\n");
+        out.write("<BODY>");
+        out.write("<H1>HTTP Error 403: Forbidden</h2>\r\n");
+        out.write("</BODY></HTML>\r\n");
+        out.flush();
+    }
+    /**
+     * Sends a 403 error: forbidden
+     * @param out The writer where the error is written
+     * @throws IOException If the error can not be written
+     */
+    private void sendBadRequest(Writer out) throws IOException
+    {
+        sendHeader(out, "400 Bad Request", "text/html", true);
+        out.write("<HTML>\r\n");
+        out.write("<HEAD><TITLE>Bad Request</TITLE>\r\n");
+        out.write("</HEAD>\r\n");
+        out.write("<BODY>");
+        out.write("<H1>HTTP Error 400: Bad Request</h2>\r\n");
+        out.write("</BODY></HTML>\r\n");
+        out.flush();
+    }
+
+    /**
+     * Send common HTTP headers to the client.
+     *
+     * @param out The Writer
+     * @param status The status string ("200 OK", "500", etc)
+     * @param contentType The content type of the data sent
+     * @param endHeaders If true, adds a new line, ending the headers.
+     * @throws IOException When error
+     */
+    private void sendHeader(Writer out, String status, String contentType, boolean endHeaders) throws IOException
+    {
+        out.write("HTTP/1.1 " + status + "\r\n");
+        Date now = new Date();
+        out.write("Date: " + now + "\r\n");
         out.write("Server: JOSM RemoteControl\r\n");
         out.write("Content-type: " + contentType + "\r\n");
         if (endHeaders)
-        	out.write("\r\n");
-	}
+            out.write("\r\n");
+    }
 }
Index: /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/Util.java
===================================================================
--- /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/Util.java	(revision 12777)
+++ /applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/Util.java	(revision 12778)
@@ -17,11 +17,11 @@
 /**
  * Utility class
- * 
+ *
  */
-public class Util 
+public class Util
 {
     /**
      * Utility method to retrieve the plugin for classes that can't access to the plugin object directly.
-     * 
+     *
      * @param clazz The plugin class
      * @return The YWMS plugin
@@ -29,5 +29,5 @@
     public static Plugin getPlugin(Class<? extends Plugin> clazz)
     {
-    	String classname = clazz.getName();
+        String classname = clazz.getName();
         for (PluginProxy plugin : Main.plugins)
         {
@@ -39,23 +39,23 @@
         return null;
     }
-    
-	/** 
-	 * Returns the plugin's directory of the plugin
-	 * 
-	 * @return The directory of the plugin
-	 */
-	public static String getPluginDir()
-	{
-		return Main.pref.getPreferencesDir() + "plugins/ywms/";
-	}
 
-	/**
-	 * Returns the version
-	 * @return The version of the application
-	 */
-	public static Version getVersion()
+    /**
+     * Returns the plugin's directory of the plugin
+     *
+     * @return The directory of the plugin
+     */
+    public static String getPluginDir()
+    {
+        return Main.pref.getPreferencesDir() + "plugins/ywms/";
+    }
+
+    /**
+     * Returns the version
+     * @return The version of the application
+     */
+    public static Version getVersion()
     {
         PluginInformation info = PluginInformation.getLoaded("ywms");
-        if (info == null) 
+        if (info == null)
             return null;
 
@@ -65,14 +65,14 @@
     /**
      * Utility class for displaying versions
-     * 
+     *
      * @author frsantos
      */
     public static class Version
     {
-    	/** The revision */
-    	public String revision;
-    	/** The build time */
-    	public String time;
-    	
+        /** The revision */
+        public String revision;
+        /** The build time */
+        public String time;
+
         /**
          * Constructor
@@ -80,9 +80,9 @@
          * @param time
          */
-        public Version(String revision, String time) 
+        public Version(String revision, String time)
         {
-			this.revision = revision;
-			this.time = time;
-		}
+            this.revision = revision;
+            this.time = time;
+        }
     }
 }
Index: /applications/editors/josm/plugins/slippy_map_chooser/src/OsmMapControl.java
===================================================================
--- /applications/editors/josm/plugins/slippy_map_chooser/src/OsmMapControl.java	(revision 12777)
+++ /applications/editors/josm/plugins/slippy_map_chooser/src/OsmMapControl.java	(revision 12778)
@@ -23,98 +23,98 @@
 public class OsmMapControl extends MouseAdapter implements MouseMotionListener, MouseListener {
 
-	// start and end point of selection rectangle
-	private Point iStartSelectionPoint;
-	private Point iEndSelectionPoint;
+    // start and end point of selection rectangle
+    private Point iStartSelectionPoint;
+    private Point iEndSelectionPoint;
 
-	// the SlippyMapChooserComponent
-	private final SlippyMapChooser iSlippyMapChooser;
+    // the SlippyMapChooserComponent
+    private final SlippyMapChooser iSlippyMapChooser;
 
-	private SizeButton iSizeButton = null;
-	private SourceButton iSourceButton = null;
+    private SizeButton iSizeButton = null;
+    private SourceButton iSourceButton = null;
 
-	/**
-	 * Create a new OsmMapControl
-	 */
-	public OsmMapControl(SlippyMapChooser navComp, JPanel contentPane, SizeButton sizeButton, SourceButton sourceButton) {
-		this.iSlippyMapChooser = navComp;
-		iSlippyMapChooser.addMouseListener(this);
-		iSlippyMapChooser.addMouseMotionListener(this);
+    /**
+     * Create a new OsmMapControl
+     */
+    public OsmMapControl(SlippyMapChooser navComp, JPanel contentPane, SizeButton sizeButton, SourceButton sourceButton) {
+        this.iSlippyMapChooser = navComp;
+        iSlippyMapChooser.addMouseListener(this);
+        iSlippyMapChooser.addMouseMotionListener(this);
 
-		String[] n = { ",", ".", "up", "right", "down", "left" };
-		int[] k =
-				{ KeyEvent.VK_COMMA, KeyEvent.VK_PERIOD, KeyEvent.VK_UP, KeyEvent.VK_RIGHT,
-						KeyEvent.VK_DOWN, KeyEvent.VK_LEFT };
+        String[] n = { ",", ".", "up", "right", "down", "left" };
+        int[] k =
+                { KeyEvent.VK_COMMA, KeyEvent.VK_PERIOD, KeyEvent.VK_UP, KeyEvent.VK_RIGHT,
+                        KeyEvent.VK_DOWN, KeyEvent.VK_LEFT };
 
-		if (contentPane != null) {
-			for (int i = 0; i < n.length; ++i) {
-				contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
-						KeyStroke.getKeyStroke(k[i], KeyEvent.CTRL_DOWN_MASK),
-						"MapMover.Zoomer." + n[i]);
-			}
-		}
-		iSizeButton = sizeButton;
-		iSourceButton = sourceButton;
-	}
+        if (contentPane != null) {
+            for (int i = 0; i < n.length; ++i) {
+                contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+                        KeyStroke.getKeyStroke(k[i], KeyEvent.CTRL_DOWN_MASK),
+                        "MapMover.Zoomer." + n[i]);
+            }
+        }
+        iSizeButton = sizeButton;
+        iSourceButton = sourceButton;
+    }
 
-	/**
-	 * Start drawing the selection rectangle if it was the 1st button (left
-	 * button)
-	 */
-	@Override
-	public void mousePressed(MouseEvent e) {
-		if (e.getButton() == MouseEvent.BUTTON1) {
-			if (!iSizeButton.hit(e.getPoint())) {
-				iStartSelectionPoint = e.getPoint();
-				iEndSelectionPoint = e.getPoint();
-			}
-		}
-		
-	}
+    /**
+     * Start drawing the selection rectangle if it was the 1st button (left
+     * button)
+     */
+    @Override
+    public void mousePressed(MouseEvent e) {
+        if (e.getButton() == MouseEvent.BUTTON1) {
+            if (!iSizeButton.hit(e.getPoint())) {
+                iStartSelectionPoint = e.getPoint();
+                iEndSelectionPoint = e.getPoint();
+            }
+        }
+        
+    }
 
-	public void mouseDragged(MouseEvent e) {		
-		if((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK){
-			if (iStartSelectionPoint != null) {				
-				iEndSelectionPoint = e.getPoint();
-				iSlippyMapChooser.setSelection(iStartSelectionPoint, iEndSelectionPoint);
-			}
-		}
-	}
+    public void mouseDragged(MouseEvent e) {        
+        if((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK){
+            if (iStartSelectionPoint != null) {             
+                iEndSelectionPoint = e.getPoint();
+                iSlippyMapChooser.setSelection(iStartSelectionPoint, iEndSelectionPoint);
+            }
+        }
+    }
 
-	/**
-	 * When dragging the map change the cursor back to it's pre-move cursor. If
-	 * a double-click occurs center and zoom the map on the clicked location.
-	 */
-	@Override
-	public void mouseReleased(MouseEvent e) {
-		if (e.getButton() == MouseEvent.BUTTON1) {
-			
-			int sourceButton = iSourceButton.hit(e.getPoint());
-			
-			if (iSizeButton.hit(e.getPoint())) {
-				iSizeButton.toggle();
-				iSlippyMapChooser.resizeSlippyMap();
-			}
-			else if(sourceButton == SourceButton.HIDE_OR_SHOW) {
-				iSourceButton.toggle();
-				iSlippyMapChooser.repaint();
-				
-			}else if(sourceButton == SourceButton.MAPNIK || sourceButton == SourceButton.OSMARENDER) {
-				iSlippyMapChooser.toggleMapSource(sourceButton);
-			}
-			else {
-				if (e.getClickCount() == 1) {
-					iSlippyMapChooser.setSelection(iStartSelectionPoint, e.getPoint());
+    /**
+     * When dragging the map change the cursor back to it's pre-move cursor. If
+     * a double-click occurs center and zoom the map on the clicked location.
+     */
+    @Override
+    public void mouseReleased(MouseEvent e) {
+        if (e.getButton() == MouseEvent.BUTTON1) {
+            
+            int sourceButton = iSourceButton.hit(e.getPoint());
+            
+            if (iSizeButton.hit(e.getPoint())) {
+                iSizeButton.toggle();
+                iSlippyMapChooser.resizeSlippyMap();
+            }
+            else if(sourceButton == SourceButton.HIDE_OR_SHOW) {
+                iSourceButton.toggle();
+                iSlippyMapChooser.repaint();
+                
+            }else if(sourceButton == SourceButton.MAPNIK || sourceButton == SourceButton.OSMARENDER) {
+                iSlippyMapChooser.toggleMapSource(sourceButton);
+            }
+            else {
+                if (e.getClickCount() == 1) {
+                    iSlippyMapChooser.setSelection(iStartSelectionPoint, e.getPoint());
 
-					// reset the selections start and end
-					iEndSelectionPoint = null;
-					iStartSelectionPoint = null;
-				}
-			}
-			
-		}
-	}
+                    // reset the selections start and end
+                    iEndSelectionPoint = null;
+                    iStartSelectionPoint = null;
+                }
+            }
+            
+        }
+    }
 
-	public void mouseMoved(MouseEvent e) {
-	}
+    public void mouseMoved(MouseEvent e) {
+    }
 
 }
Index: /applications/editors/josm/plugins/slippy_map_chooser/src/SizeButton.java
===================================================================
--- /applications/editors/josm/plugins/slippy_map_chooser/src/SizeButton.java	(revision 12777)
+++ /applications/editors/josm/plugins/slippy_map_chooser/src/SizeButton.java	(revision 12778)
@@ -15,40 +15,40 @@
  */
 public class SizeButton{
-	
-	private int x = 0;
-	private int y = 0;
-	
-	private ImageIcon enlargeImage;
-	private ImageIcon shrinkImage;
-	private boolean isEnlarged = false;
-	
-	
-	public SizeButton(){
-		enlargeImage = ImageProvider.get("", "view-fullscreen.png");
-		shrinkImage = ImageProvider.get("", "view-fullscreen-revert.png");		
-	}
-	
-	public void paint(Graphics g){
-		if(isEnlarged){
-			if(shrinkImage != null)
-				g.drawImage(shrinkImage.getImage(),x,y, null);
-		}else{
-			if(enlargeImage != null)
-				g.drawImage(enlargeImage.getImage(),x,y, null);
-		}
-	}
-	
-	public void toggle(){
-		isEnlarged = !isEnlarged;
-	}
-	
-	public boolean hit(Point point){
-		if(x < point.x && point.x < x + enlargeImage.getIconWidth()){
-			if(y < point.y && point.y < y + enlargeImage.getIconHeight() ){				
-				return true;
-			}
-		}
-		return false;
-	}
+    
+    private int x = 0;
+    private int y = 0;
+    
+    private ImageIcon enlargeImage;
+    private ImageIcon shrinkImage;
+    private boolean isEnlarged = false;
+    
+    
+    public SizeButton(){
+        enlargeImage = ImageProvider.get("", "view-fullscreen.png");
+        shrinkImage = ImageProvider.get("", "view-fullscreen-revert.png");      
+    }
+    
+    public void paint(Graphics g){
+        if(isEnlarged){
+            if(shrinkImage != null)
+                g.drawImage(shrinkImage.getImage(),x,y, null);
+        }else{
+            if(enlargeImage != null)
+                g.drawImage(enlargeImage.getImage(),x,y, null);
+        }
+    }
+    
+    public void toggle(){
+        isEnlarged = !isEnlarged;
+    }
+    
+    public boolean hit(Point point){
+        if(x < point.x && point.x < x + enlargeImage.getIconWidth()){
+            if(y < point.y && point.y < y + enlargeImage.getIconHeight() ){             
+                return true;
+            }
+        }
+        return false;
+    }
 
 }
Index: /applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooser.java
===================================================================
--- /applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooser.java	(revision 12777)
+++ /applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooser.java	(revision 12778)
@@ -40,235 +40,235 @@
 public class SlippyMapChooser extends JMapViewer implements DownloadSelection, ComponentListener {
 
-	private DownloadDialog iGui;
-
-	// upper left and lower right corners of the selection rectangle (x/y on
-	// ZOOM_MAX)
-	Point iSelectionRectStart;
-	Point iSelectionRectEnd;
-
-	private SizeButton iSizeButton = new SizeButton();
-	private SourceButton iSourceButton = new SourceButton();
-
-	// standard dimension
-	private Dimension iDownloadDialogDimension;
-	// screen size
-	private Dimension iScreenSize;
-
-	private TileSource[] sources = { new OsmTileSource.Mapnik(), new OsmTileSource.TilesAtHome() };
-	TileLoader cachedLoader;
-	TileLoader uncachedLoader;
-	JPanel slipyyMapTabPanel;
-	boolean firstShown = true;
-
-	/**
-	 * Create the chooser component.
-	 */
-	public SlippyMapChooser() {
-		super();
-		cachedLoader = new OsmFileCacheTileLoader(this);
-		uncachedLoader = new OsmTileLoader(this);
-		setZoomContolsVisible(false);
-		setMapMarkerVisible(false);
-		setMinimumSize(new Dimension(350, 350 / 2));
-		setFileCacheEnabled(SlippyMapChooserPlugin.ENABLE_FILE_CACHE);
-		setMaxTilesInmemory(SlippyMapChooserPlugin.MAX_TILES_IN_MEMORY);
-		addComponentListener(this);
-	}
-
-	public void setMaxTilesInmemory(int tiles) {
-		((MemoryTileCache) getTileCache()).setCacheSize(tiles);
-	}
-
-	public void setFileCacheEnabled(boolean enabled) {
-		if (enabled)
-			setTileLoader(cachedLoader);
-		else
-			setTileLoader(uncachedLoader);
-	}
-
-	public void addGui(final DownloadDialog gui) {
-		iGui = gui;
-		slipyyMapTabPanel = new JPanel();
-		slipyyMapTabPanel.setLayout(new BorderLayout());
-		slipyyMapTabPanel.add(this, BorderLayout.CENTER);
-		slipyyMapTabPanel.add(new JLabel((tr("Zoom: Mousewheel or double click.   "
-				+ "Move map: Hold right mousebutton and move mouse.   Select: Click."))),
-				BorderLayout.SOUTH);
-		iGui.tabpane.add(slipyyMapTabPanel, tr("Slippy map"));
-		iGui.tabpane.addComponentListener(this);
-		new OsmMapControl(this, slipyyMapTabPanel, iSizeButton, iSourceButton);
-	}
-
-	protected Point getTopLeftCoordinates() {
-		return new Point(center.x - (getWidth() / 2), center.y - (getHeight() / 2));
-	}
-
-	/**
-	 * Draw the map.
-	 */
-	@Override
-	public void paint(Graphics g) {
-		try {
-			super.paint(g);
-
-			// draw selection rectangle
-			if (iSelectionRectStart != null && iSelectionRectEnd != null) {
-
-				int zoomDiff = MAX_ZOOM - zoom;
-				Point tlc = getTopLeftCoordinates();
-				int x_min = (iSelectionRectStart.x >> zoomDiff) - tlc.x;
-				int y_min = (iSelectionRectStart.y >> zoomDiff) - tlc.y;
-				int x_max = (iSelectionRectEnd.x >> zoomDiff) - tlc.x;
-				int y_max = (iSelectionRectEnd.y >> zoomDiff) - tlc.y;
-
-				int w = x_max - x_min;
-				int h = y_max - y_min;
-				g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f));
-				g.fillRect(x_min, y_min, w, h);
-
-				g.setColor(Color.BLACK);
-				g.drawRect(x_min, y_min, w, h);
-
-			}
-
-			iSizeButton.paint(g);
-			iSourceButton.paint(g);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-	public void boundingBoxChanged(DownloadDialog gui) {
-
-		// test if a bounding box has been set set
-		if (gui.minlat == 0.0 && gui.minlon == 0.0 && gui.maxlat == 0.0 && gui.maxlon == 0.0)
-			return;
-
-		int y1 = OsmMercator.LatToY(gui.minlat, MAX_ZOOM);
-		int y2 = OsmMercator.LatToY(gui.maxlat, MAX_ZOOM);
-		int x1 = OsmMercator.LonToX(gui.minlon, MAX_ZOOM);
-		int x2 = OsmMercator.LonToX(gui.maxlon, MAX_ZOOM);
-
-		iSelectionRectStart = new Point(Math.min(x1, x2), Math.min(y1, y2));
-		iSelectionRectEnd = new Point(Math.max(x1, x2), Math.max(y1, y2));
-
-		// calc the screen coordinates for the new selection rectangle
-		MapMarkerDot xmin_ymin = new MapMarkerDot(gui.minlat, gui.minlon);
-		MapMarkerDot xmax_ymax = new MapMarkerDot(gui.maxlat, gui.maxlon);
-
-		Vector<MapMarker> marker = new Vector<MapMarker>(2);
-		marker.add(xmin_ymin);
-		marker.add(xmax_ymax);
-		setMapMarkerList(marker);
-		setDisplayToFitMapMarkers();
-		zoomOut();
-	}
-
-	/**
-	 * Callback for the OsmMapControl. (Re-)Sets the start and end point of the
-	 * selection rectangle.
-	 * 
-	 * @param aStart
-	 * @param aEnd
-	 */
-	public void setSelection(Point aStart, Point aEnd) {
-		if (aStart == null || aEnd == null)
-			return;
-		Point p_max = new Point(Math.max(aEnd.x, aStart.x), Math.max(aEnd.y, aStart.y));
-		Point p_min = new Point(Math.min(aEnd.x, aStart.x), Math.min(aEnd.y, aStart.y));
-
-		Point tlc = getTopLeftCoordinates();
-		int zoomDiff = MAX_ZOOM - zoom;
-		Point pEnd = new Point(p_max.x + tlc.x, p_max.y + tlc.y);
-		Point pStart = new Point(p_min.x + tlc.x, p_min.y + tlc.y);
-
-		pEnd.x <<= zoomDiff;
-		pEnd.y <<= zoomDiff;
-		pStart.x <<= zoomDiff;
-		pStart.y <<= zoomDiff;
-
-		iSelectionRectStart = pStart;
-		iSelectionRectEnd = pEnd;
-
-		Point2D.Double l1 = getPosition(p_max);
-		Point2D.Double l2 = getPosition(p_min);
-		iGui.minlat = Math.min(l2.x, l1.x);
-		iGui.minlon = Math.min(l1.y, l2.y);
-		iGui.maxlat = Math.max(l2.x, l1.x);
-		iGui.maxlon = Math.max(l1.y, l2.y);
-
-		iGui.boundingBoxChanged(this);
-		repaint();
-	}
-
-	/**
-	 * Performs resizing of the DownloadDialog in order to enlarge or shrink the
-	 * map.
-	 */
-	public void resizeSlippyMap() {
-		if (iScreenSize == null) {
-			Component c =
-					iGui.getParent().getParent().getParent().getParent().getParent().getParent()
-							.getParent().getParent().getParent();
-			// remember the initial set screen dimensions
-			iDownloadDialogDimension = c.getSize();
-			// retrive the size of the display
-			iScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
-		}
-
-		// resize
-		Component co =
-				iGui.getParent().getParent().getParent().getParent().getParent().getParent()
-						.getParent().getParent().getParent();
-		Dimension currentDimension = co.getSize();
-
-		// enlarge
-		if (currentDimension.equals(iDownloadDialogDimension)) {
-			// make the each dimension 90% of the absolute display size and
-			// center the DownloadDialog
-			int w = iScreenSize.width * 90 / 100;
-			int h = iScreenSize.height * 90 / 100;
-			co.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h);
-
-		}
-		// shrink
-		else {
-			// set the size back to the initial dimensions and center the
-			// DownloadDialog
-			int w = iDownloadDialogDimension.width;
-			int h = iDownloadDialogDimension.height;
-			co.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h);
-
-		}
-
-		repaint();
-	}
-
-	public void toggleMapSource(int mapSource) {
-		this.tileCache = new MemoryTileCache();
-		if (mapSource == SourceButton.MAPNIK) {
-			this.setTileSource(sources[0]);
-		} else {
-			this.setTileSource(sources[1]);
-		}
-	}
-
-	public void componentHidden(ComponentEvent e) {
-	}
-
-	public void componentMoved(ComponentEvent e) {
-	}
-
-	public void componentShown(ComponentEvent e) {
-	}
-
-	public void componentResized(ComponentEvent e) {
-		if (!this.equals(e.getSource()) || getHeight() == 0 || getWidth() == 0)
-			return;
-		firstShown = false;
-		// The bounding box has to be set after SlippyMapChooser's size has been
-		// finally set - otherwise the zoom level will be totally wrong (too wide)
-		boundingBoxChanged(iGui);
-	}
+    private DownloadDialog iGui;
+
+    // upper left and lower right corners of the selection rectangle (x/y on
+    // ZOOM_MAX)
+    Point iSelectionRectStart;
+    Point iSelectionRectEnd;
+
+    private SizeButton iSizeButton = new SizeButton();
+    private SourceButton iSourceButton = new SourceButton();
+
+    // standard dimension
+    private Dimension iDownloadDialogDimension;
+    // screen size
+    private Dimension iScreenSize;
+
+    private TileSource[] sources = { new OsmTileSource.Mapnik(), new OsmTileSource.TilesAtHome() };
+    TileLoader cachedLoader;
+    TileLoader uncachedLoader;
+    JPanel slipyyMapTabPanel;
+    boolean firstShown = true;
+
+    /**
+     * Create the chooser component.
+     */
+    public SlippyMapChooser() {
+        super();
+        cachedLoader = new OsmFileCacheTileLoader(this);
+        uncachedLoader = new OsmTileLoader(this);
+        setZoomContolsVisible(false);
+        setMapMarkerVisible(false);
+        setMinimumSize(new Dimension(350, 350 / 2));
+        setFileCacheEnabled(SlippyMapChooserPlugin.ENABLE_FILE_CACHE);
+        setMaxTilesInmemory(SlippyMapChooserPlugin.MAX_TILES_IN_MEMORY);
+        addComponentListener(this);
+    }
+
+    public void setMaxTilesInmemory(int tiles) {
+        ((MemoryTileCache) getTileCache()).setCacheSize(tiles);
+    }
+
+    public void setFileCacheEnabled(boolean enabled) {
+        if (enabled)
+            setTileLoader(cachedLoader);
+        else
+            setTileLoader(uncachedLoader);
+    }
+
+    public void addGui(final DownloadDialog gui) {
+        iGui = gui;
+        slipyyMapTabPanel = new JPanel();
+        slipyyMapTabPanel.setLayout(new BorderLayout());
+        slipyyMapTabPanel.add(this, BorderLayout.CENTER);
+        slipyyMapTabPanel.add(new JLabel((tr("Zoom: Mousewheel or double click.   "
+                + "Move map: Hold right mousebutton and move mouse.   Select: Click."))),
+                BorderLayout.SOUTH);
+        iGui.tabpane.add(slipyyMapTabPanel, tr("Slippy map"));
+        iGui.tabpane.addComponentListener(this);
+        new OsmMapControl(this, slipyyMapTabPanel, iSizeButton, iSourceButton);
+    }
+
+    protected Point getTopLeftCoordinates() {
+        return new Point(center.x - (getWidth() / 2), center.y - (getHeight() / 2));
+    }
+
+    /**
+     * Draw the map.
+     */
+    @Override
+    public void paint(Graphics g) {
+        try {
+            super.paint(g);
+
+            // draw selection rectangle
+            if (iSelectionRectStart != null && iSelectionRectEnd != null) {
+
+                int zoomDiff = MAX_ZOOM - zoom;
+                Point tlc = getTopLeftCoordinates();
+                int x_min = (iSelectionRectStart.x >> zoomDiff) - tlc.x;
+                int y_min = (iSelectionRectStart.y >> zoomDiff) - tlc.y;
+                int x_max = (iSelectionRectEnd.x >> zoomDiff) - tlc.x;
+                int y_max = (iSelectionRectEnd.y >> zoomDiff) - tlc.y;
+
+                int w = x_max - x_min;
+                int h = y_max - y_min;
+                g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f));
+                g.fillRect(x_min, y_min, w, h);
+
+                g.setColor(Color.BLACK);
+                g.drawRect(x_min, y_min, w, h);
+
+            }
+
+            iSizeButton.paint(g);
+            iSourceButton.paint(g);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void boundingBoxChanged(DownloadDialog gui) {
+
+        // test if a bounding box has been set set
+        if (gui.minlat == 0.0 && gui.minlon == 0.0 && gui.maxlat == 0.0 && gui.maxlon == 0.0)
+            return;
+
+        int y1 = OsmMercator.LatToY(gui.minlat, MAX_ZOOM);
+        int y2 = OsmMercator.LatToY(gui.maxlat, MAX_ZOOM);
+        int x1 = OsmMercator.LonToX(gui.minlon, MAX_ZOOM);
+        int x2 = OsmMercator.LonToX(gui.maxlon, MAX_ZOOM);
+
+        iSelectionRectStart = new Point(Math.min(x1, x2), Math.min(y1, y2));
+        iSelectionRectEnd = new Point(Math.max(x1, x2), Math.max(y1, y2));
+
+        // calc the screen coordinates for the new selection rectangle
+        MapMarkerDot xmin_ymin = new MapMarkerDot(gui.minlat, gui.minlon);
+        MapMarkerDot xmax_ymax = new MapMarkerDot(gui.maxlat, gui.maxlon);
+
+        Vector<MapMarker> marker = new Vector<MapMarker>(2);
+        marker.add(xmin_ymin);
+        marker.add(xmax_ymax);
+        setMapMarkerList(marker);
+        setDisplayToFitMapMarkers();
+        zoomOut();
+    }
+
+    /**
+     * Callback for the OsmMapControl. (Re-)Sets the start and end point of the
+     * selection rectangle.
+     * 
+     * @param aStart
+     * @param aEnd
+     */
+    public void setSelection(Point aStart, Point aEnd) {
+        if (aStart == null || aEnd == null)
+            return;
+        Point p_max = new Point(Math.max(aEnd.x, aStart.x), Math.max(aEnd.y, aStart.y));
+        Point p_min = new Point(Math.min(aEnd.x, aStart.x), Math.min(aEnd.y, aStart.y));
+
+        Point tlc = getTopLeftCoordinates();
+        int zoomDiff = MAX_ZOOM - zoom;
+        Point pEnd = new Point(p_max.x + tlc.x, p_max.y + tlc.y);
+        Point pStart = new Point(p_min.x + tlc.x, p_min.y + tlc.y);
+
+        pEnd.x <<= zoomDiff;
+        pEnd.y <<= zoomDiff;
+        pStart.x <<= zoomDiff;
+        pStart.y <<= zoomDiff;
+
+        iSelectionRectStart = pStart;
+        iSelectionRectEnd = pEnd;
+
+        Point2D.Double l1 = getPosition(p_max);
+        Point2D.Double l2 = getPosition(p_min);
+        iGui.minlat = Math.min(l2.x, l1.x);
+        iGui.minlon = Math.min(l1.y, l2.y);
+        iGui.maxlat = Math.max(l2.x, l1.x);
+        iGui.maxlon = Math.max(l1.y, l2.y);
+
+        iGui.boundingBoxChanged(this);
+        repaint();
+    }
+
+    /**
+     * Performs resizing of the DownloadDialog in order to enlarge or shrink the
+     * map.
+     */
+    public void resizeSlippyMap() {
+        if (iScreenSize == null) {
+            Component c =
+                    iGui.getParent().getParent().getParent().getParent().getParent().getParent()
+                            .getParent().getParent().getParent();
+            // remember the initial set screen dimensions
+            iDownloadDialogDimension = c.getSize();
+            // retrive the size of the display
+            iScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
+        }
+
+        // resize
+        Component co =
+                iGui.getParent().getParent().getParent().getParent().getParent().getParent()
+                        .getParent().getParent().getParent();
+        Dimension currentDimension = co.getSize();
+
+        // enlarge
+        if (currentDimension.equals(iDownloadDialogDimension)) {
+            // make the each dimension 90% of the absolute display size and
+            // center the DownloadDialog
+            int w = iScreenSize.width * 90 / 100;
+            int h = iScreenSize.height * 90 / 100;
+            co.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h);
+
+        }
+        // shrink
+        else {
+            // set the size back to the initial dimensions and center the
+            // DownloadDialog
+            int w = iDownloadDialogDimension.width;
+            int h = iDownloadDialogDimension.height;
+            co.setBounds((iScreenSize.width - w) / 2, (iScreenSize.height - h) / 2, w, h);
+
+        }
+
+        repaint();
+    }
+
+    public void toggleMapSource(int mapSource) {
+        this.tileCache = new MemoryTileCache();
+        if (mapSource == SourceButton.MAPNIK) {
+            this.setTileSource(sources[0]);
+        } else {
+            this.setTileSource(sources[1]);
+        }
+    }
+
+    public void componentHidden(ComponentEvent e) {
+    }
+
+    public void componentMoved(ComponentEvent e) {
+    }
+
+    public void componentShown(ComponentEvent e) {
+    }
+
+    public void componentResized(ComponentEvent e) {
+        if (!this.equals(e.getSource()) || getHeight() == 0 || getWidth() == 0)
+            return;
+        firstShown = false;
+        // The bounding box has to be set after SlippyMapChooser's size has been
+        // finally set - otherwise the zoom level will be totally wrong (too wide)
+        boundingBoxChanged(iGui);
+    }
 
 }
Index: /applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooserPlugin.java
===================================================================
--- /applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooserPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/slippy_map_chooser/src/SlippyMapChooserPlugin.java	(revision 12778)
@@ -14,59 +14,59 @@
 public class SlippyMapChooserPlugin extends Plugin implements PreferenceChangedListener {
 
-	static String iPluginFolder = "";
+    static String iPluginFolder = "";
 
-	private static final String KEY_MAX_TILES_IN_MEMORY = "slippy_map_chooser.max_tiles";
-	private static final String KEY_ENABLE_FILE_CACHE = "slippy_map_chooser.file_cache";
+    private static final String KEY_MAX_TILES_IN_MEMORY = "slippy_map_chooser.max_tiles";
+    private static final String KEY_ENABLE_FILE_CACHE = "slippy_map_chooser.file_cache";
 
-	static int MAX_TILES_IN_MEMORY = 200;
-	static boolean ENABLE_FILE_CACHE = true;
+    static int MAX_TILES_IN_MEMORY = 200;
+    static boolean ENABLE_FILE_CACHE = true;
 
-	public SlippyMapChooserPlugin() {
-		// create the plugin folder
-		// iPluginFolder = getPluginDir();
-		// File pluginFolder = new File(iPluginFolder);
-		// if(!pluginFolder.exists())
-		// pluginFolder.mkdir();
-		//		
-		// //init the logger
-		// Logger.setLogFile(iPluginFolder+"\\slippy_map_chooser.log");
+    public SlippyMapChooserPlugin() {
+        // create the plugin folder
+        // iPluginFolder = getPluginDir();
+        // File pluginFolder = new File(iPluginFolder);
+        // if(!pluginFolder.exists())
+        // pluginFolder.mkdir();
+        //      
+        // //init the logger
+        // Logger.setLogFile(iPluginFolder+"\\slippy_map_chooser.log");
 
-		// Add this plugin to the preference changed listener list
-		Main.pref.listener.add(this);
+        // Add this plugin to the preference changed listener list
+        Main.pref.listener.add(this);
 
-		// load prefs
-		String maxTiles = Main.pref.get(KEY_MAX_TILES_IN_MEMORY);
-		if (!maxTiles.equals("")) {
-			preferenceChanged(KEY_MAX_TILES_IN_MEMORY, maxTiles);
-		} else {
-			Main.pref.put(KEY_MAX_TILES_IN_MEMORY, Integer.toString(MAX_TILES_IN_MEMORY));
-		}
-		String enableFileCache = Main.pref.get(KEY_ENABLE_FILE_CACHE);
-		if (!enableFileCache.equals("")) {
-			preferenceChanged(KEY_ENABLE_FILE_CACHE, enableFileCache);
-		} else {
-			Main.pref.put(KEY_ENABLE_FILE_CACHE, Boolean.toString(ENABLE_FILE_CACHE));
-		}
-	}
+        // load prefs
+        String maxTiles = Main.pref.get(KEY_MAX_TILES_IN_MEMORY);
+        if (!maxTiles.equals("")) {
+            preferenceChanged(KEY_MAX_TILES_IN_MEMORY, maxTiles);
+        } else {
+            Main.pref.put(KEY_MAX_TILES_IN_MEMORY, Integer.toString(MAX_TILES_IN_MEMORY));
+        }
+        String enableFileCache = Main.pref.get(KEY_ENABLE_FILE_CACHE);
+        if (!enableFileCache.equals("")) {
+            preferenceChanged(KEY_ENABLE_FILE_CACHE, enableFileCache);
+        } else {
+            Main.pref.put(KEY_ENABLE_FILE_CACHE, Boolean.toString(ENABLE_FILE_CACHE));
+        }
+    }
 
-	public void addDownloadSelection(List<DownloadSelection> list) {
-		list.add(new SlippyMapChooser());
-	}
+    public void addDownloadSelection(List<DownloadSelection> list) {
+        list.add(new SlippyMapChooser());
+    }
 
-	public void preferenceChanged(String key, String newValue) {
-		if (KEY_MAX_TILES_IN_MEMORY.equals(key)) {
-			try {
-				MAX_TILES_IN_MEMORY = Integer.parseInt(newValue);
-			} catch (Exception e) {
-				MAX_TILES_IN_MEMORY = 1000;
-			}
-		} else if (KEY_ENABLE_FILE_CACHE.equals(key)) {
-			try {
-				ENABLE_FILE_CACHE = Boolean.parseBoolean(newValue);
-			} catch (Exception e) {
-				MAX_TILES_IN_MEMORY = 1000;
-			}
-		}
-	}
+    public void preferenceChanged(String key, String newValue) {
+        if (KEY_MAX_TILES_IN_MEMORY.equals(key)) {
+            try {
+                MAX_TILES_IN_MEMORY = Integer.parseInt(newValue);
+            } catch (Exception e) {
+                MAX_TILES_IN_MEMORY = 1000;
+            }
+        } else if (KEY_ENABLE_FILE_CACHE.equals(key)) {
+            try {
+                ENABLE_FILE_CACHE = Boolean.parseBoolean(newValue);
+            } catch (Exception e) {
+                MAX_TILES_IN_MEMORY = 1000;
+            }
+        }
+    }
 
 }
Index: /applications/editors/josm/plugins/slippy_map_chooser/src/SourceButton.java
===================================================================
--- /applications/editors/josm/plugins/slippy_map_chooser/src/SourceButton.java	(revision 12777)
+++ /applications/editors/josm/plugins/slippy_map_chooser/src/SourceButton.java	(revision 12778)
@@ -8,81 +8,81 @@
 public class SourceButton {
 
-	private int x = 0;
-	private int y = 30;
+    private int x = 0;
+    private int y = 30;
 
-	private ImageIcon enlargeImage;
-	private ImageIcon shrinkImage;
-	private ImageIcon imageMapnik;
-	private ImageIcon imageOsmarender;
+    private ImageIcon enlargeImage;
+    private ImageIcon shrinkImage;
+    private ImageIcon imageMapnik;
+    private ImageIcon imageOsmarender;
 
-	private boolean isEnlarged = false;
+    private boolean isEnlarged = false;
 
-	private boolean isMapnik = true;
+    private boolean isMapnik = true;
 
-	public static final int HIDE_OR_SHOW = 1;
-	public static final int MAPNIK = 2;
-	public static final int OSMARENDER = 3;
+    public static final int HIDE_OR_SHOW = 1;
+    public static final int MAPNIK = 2;
+    public static final int OSMARENDER = 3;
 
-	public SourceButton() {
-		enlargeImage = ImageProvider.get("", "layer-switcher-maximize.png");
-		shrinkImage = ImageProvider.get("", "layer-switcher-minimize.png");
-		imageMapnik = ImageProvider.get("", "blue_Mapnik.png");
-		imageOsmarender = ImageProvider.get("", "blue_Osmarender.png");
-	}
+    public SourceButton() {
+        enlargeImage = ImageProvider.get("", "layer-switcher-maximize.png");
+        shrinkImage = ImageProvider.get("", "layer-switcher-minimize.png");
+        imageMapnik = ImageProvider.get("", "blue_Mapnik.png");
+        imageOsmarender = ImageProvider.get("", "blue_Osmarender.png");
+    }
 
-	public void paint(Graphics g) {
+    public void paint(Graphics g) {
 
-		if (isEnlarged) {
-			if (isMapnik) {
-				g.drawImage(imageMapnik.getImage(), g.getClipBounds().width
-						- imageMapnik.getIconWidth(), y, null);
-			} else {
-				g.drawImage(imageOsmarender.getImage(), g.getClipBounds().width
-						- imageMapnik.getIconWidth(), y, null);
-			}
+        if (isEnlarged) {
+            if (isMapnik) {
+                g.drawImage(imageMapnik.getImage(), g.getClipBounds().width
+                        - imageMapnik.getIconWidth(), y, null);
+            } else {
+                g.drawImage(imageOsmarender.getImage(), g.getClipBounds().width
+                        - imageMapnik.getIconWidth(), y, null);
+            }
 
-			if (shrinkImage != null) {
-				this.x = g.getClipBounds().width - shrinkImage.getIconWidth();
-				g.drawImage(shrinkImage.getImage(), x, y, null);
-			}
+            if (shrinkImage != null) {
+                this.x = g.getClipBounds().width - shrinkImage.getIconWidth();
+                g.drawImage(shrinkImage.getImage(), x, y, null);
+            }
 
-		} else {
-			if (enlargeImage != null) {
-				this.x = g.getClipBounds().width - enlargeImage.getIconWidth();
-				g.drawImage(enlargeImage.getImage(), x, y, null);
-			}
-		}
-	}
+        } else {
+            if (enlargeImage != null) {
+                this.x = g.getClipBounds().width - enlargeImage.getIconWidth();
+                g.drawImage(enlargeImage.getImage(), x, y, null);
+            }
+        }
+    }
 
-	public void toggle() {
-		this.isEnlarged = !this.isEnlarged;
+    public void toggle() {
+        this.isEnlarged = !this.isEnlarged;
 
-	}
+    }
 
-	public int hit(Point point) {
-		if (isEnlarged) {
-			if (x < point.x && point.x < x + shrinkImage.getIconWidth()) {
-				if (y < point.y && point.y < y + shrinkImage.getIconHeight()) {
-					return HIDE_OR_SHOW;
-				}
-			} else if (x - imageMapnik.getIconWidth() < point.x && point.x < x) {
-				if (y < point.y && point.y < y + imageMapnik.getIconHeight() / 2) {
-					isMapnik = false;
-					return OSMARENDER;
-				} else if (y + imageMapnik.getIconHeight() / 2 < point.y
-						&& point.y < y + imageMapnik.getIconHeight()) {
-					isMapnik = true;
-					return MAPNIK;
-				}
-			}
-		} else {
-			if (x < point.x && point.x < x + enlargeImage.getIconWidth()) {
-				if (y < point.y && point.y < y + enlargeImage.getIconHeight()) {
-					return HIDE_OR_SHOW;
-				}
-			}
-		}
+    public int hit(Point point) {
+        if (isEnlarged) {
+            if (x < point.x && point.x < x + shrinkImage.getIconWidth()) {
+                if (y < point.y && point.y < y + shrinkImage.getIconHeight()) {
+                    return HIDE_OR_SHOW;
+                }
+            } else if (x - imageMapnik.getIconWidth() < point.x && point.x < x) {
+                if (y < point.y && point.y < y + imageMapnik.getIconHeight() / 2) {
+                    isMapnik = false;
+                    return OSMARENDER;
+                } else if (y + imageMapnik.getIconHeight() / 2 < point.y
+                        && point.y < y + imageMapnik.getIconHeight()) {
+                    isMapnik = true;
+                    return MAPNIK;
+                }
+            }
+        } else {
+            if (x < point.x && point.x < x + enlargeImage.getIconWidth()) {
+                if (y < point.y && point.y < y + enlargeImage.getIconHeight()) {
+                    return HIDE_OR_SHOW;
+                }
+            }
+        }
 
-		return 0;
-	}
+        return 0;
+    }
 }
Index: /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java
===================================================================
--- /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java	(revision 12778)
@@ -35,7 +35,7 @@
 /**
  * Class that displays a slippy map layer.
- * 
+ *
  * @author Frederik Ramm <frederik@remote.org>
- * 
+ *
  */
 public class SlippyMapLayer extends Layer implements ImageObserver,
@@ -57,5 +57,5 @@
     {
         super(tr("Slippy Map"));
-	background = true;
+    background = true;
 
         clearTileStorage();
@@ -468,5 +468,5 @@
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.data.Preferences.PreferenceChangedListener#preferenceChanged(java.lang.String,
      *      java.lang.String)
Index: /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPlugin.java
===================================================================
--- /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPlugin.java	(revision 12778)
@@ -8,7 +8,7 @@
 /**
  * Main class for the slippy map plugin.
- * 
+ *
  * @author Frederik Ramm <frederik@remote.org>
- * 
+ *
  */
 public class SlippyMapPlugin extends Plugin
@@ -21,14 +21,14 @@
     public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame)
     {
-    	if (newFrame != null){
-	        SlippyMapLayer smlayer;
-	        smlayer = new SlippyMapLayer();
-	        Main.main.addLayer(smlayer);
-    	}
+        if (newFrame != null){
+            SlippyMapLayer smlayer;
+            smlayer = new SlippyMapLayer();
+            Main.main.addLayer(smlayer);
+        }
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.openstreetmap.josm.plugins.Plugin#getPreferenceSetting()
      */
Index: /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferenceSetting.java
===================================================================
--- /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferenceSetting.java	(revision 12777)
+++ /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferenceSetting.java	(revision 12778)
@@ -20,7 +20,7 @@
 /**
  * Preference Dialog for Slippy Map Tiles
- * 
+ *
  * @author Hakan Tandogan <hakan@gurkensalat.com>
- * 
+ *
  */
 public class SlippyMapPreferenceSetting implements PreferenceSetting
Index: /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferences.java
===================================================================
--- /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferences.java	(revision 12777)
+++ /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferences.java	(revision 12778)
@@ -5,7 +5,7 @@
 /**
  * Preferences for Slippy Map Tiles
- * 
+ *
  * @author Hakan Tandogan <hakan@gurkensalat.com>
- * 
+ *
  */
 public class SlippyMapPreferences
@@ -14,5 +14,5 @@
 
     public static String PREFERENCE_TILE_URL = PREFERENCE_PREFIX + ".tile_url";
-    
+
     public static String getMapUrl()
     {
Index: /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapTile.java
===================================================================
--- /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapTile.java	(revision 12777)
+++ /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapTile.java	(revision 12778)
@@ -13,7 +13,7 @@
 /**
  * Class that contains information about one single slippy map tile.
- * 
+ *
  * @author Frederik Ramm <frederik@remote.org>
- * 
+ *
  */
 public class SlippyMapTile
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ActionConstants.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ActionConstants.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ActionConstants.java	(revision 12778)
@@ -14,9 +14,9 @@
  */
 public final class ActionConstants {
- 
-	/**
-	 * 
-	 */
-	private ActionConstants() { }
+
+    /**
+     *
+     */
+    private ActionConstants() { }
 
     public static final String SELECTED_KEY = "actionConstants.selected";
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveAction.java	(revision 12778)
@@ -48,5 +48,5 @@
             autoSave = ((AbstractButton)e.getSource()).isSelected();
         }
-        
+
         if(autoSave) {
             if(gpsDataTimer == null) {
@@ -54,9 +54,9 @@
             }
             TimerTask task;
-            
+
             String gpxFilename = MessageFormat.format(GPS_FILE_NAME_PATTERN, new Date());
             task = new AutoSaveGpsLayerTimerTask(gpxFilename, LiveGpsLayer.LAYER_NAME);
             gpsDataTimer.schedule(task, 1000, AUTO_SAVE_PERIOD_SEC * 1000);
-            
+
             String osmFilename = MessageFormat.format(OSM_FILE_NAME_PATTERN, new Date());
             task = new AutoSaveEditLayerTimerTask(osmFilename);
@@ -67,6 +67,6 @@
             }
         }
-        
-        
+
+
     }
 }
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveEditLayerTimerTask.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveEditLayerTimerTask.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveEditLayerTimerTask.java	(revision 12778)
@@ -28,5 +28,5 @@
 public class AutoSaveEditLayerTimerTask extends TimerTask {
     private File file;
-    
+
     public AutoSaveEditLayerTimerTask(String filename) {
         file = new File(filename);
@@ -49,5 +49,5 @@
 //                outFile = file;
 //            }
-            
+
             // write to temporary file, on success, rename tmp file to target file:
             File tmpFile = new File(file.getAbsoluteFile()+".tmp");
@@ -60,9 +60,9 @@
         } catch (IOException x) {
             x.printStackTrace();
-            JOptionPane.showMessageDialog(Main.parent, 
-                tr("Error while exporting {0}: {1}", file.getAbsoluteFile(), x.getMessage()), 
-                tr("Error"), 
+            JOptionPane.showMessageDialog(Main.parent,
+                tr("Error while exporting {0}: {1}", file.getAbsoluteFile(), x.getMessage()),
+                tr("Error"),
                 JOptionPane.ERROR_MESSAGE);
-        }       
+        }
     }
 
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveGpsLayerTimerTask.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveGpsLayerTimerTask.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveGpsLayerTimerTask.java	(revision 12778)
@@ -29,5 +29,5 @@
  * if the layer does not exist at the start of the timer task. If the layer does not exist,
  * the file is not written.
- * 
+ *
  * @author cdaller
  *
@@ -36,5 +36,5 @@
     private String gpsLayerName;
     private File file;
-    
+
     /**
      * Constructor using the file to write to and the name of the layer.
@@ -47,5 +47,5 @@
         this.file = new File(filename);
     }
-    
+
     /**
      * @return the gpsLayerName
@@ -62,5 +62,5 @@
     public void run() {
 
-        try {            
+        try {
 
             GpxLayer gpsLayer = LayerUtil.findGpsLayer(gpsLayerName, GpxLayer.class);
@@ -78,13 +78,13 @@
             synchronized(LiveGpsLock.class) {
                 gpxWriter.write(gpsLayer.data);
-            }   
+            }
             tmpFile.renameTo(file);
         } catch (IOException ioExc) {
             ioExc.printStackTrace();
-            JOptionPane.showMessageDialog(Main.parent, 
-                tr("Error while exporting {0}: {1}", file.getAbsoluteFile(), ioExc.getMessage()), 
-                tr("Error"), 
+            JOptionPane.showMessageDialog(Main.parent,
+                tr("Error while exporting {0}: {1}", file.getAbsoluteFile(), ioExc.getMessage()),
+                tr("Error"),
                 JOptionPane.ERROR_MESSAGE);
-        }       
+        }
     }
 }
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ButtonDescription.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ButtonDescription.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ButtonDescription.java	(revision 12778)
@@ -44,5 +44,5 @@
 
     /**
-     * Default Constructor 
+     * Default Constructor
      */
     public ButtonDescription() {
@@ -52,5 +52,5 @@
      * @param hotkey
      * @param actions a list of actions to be performed.
-     * @param type if <code>null</code> {@link ButtonType#SINGLE} is used. 
+     * @param type if <code>null</code> {@link ButtonType#SINGLE} is used.
      */
     public ButtonDescription(String label, String hotkey, String iconName, String buttonAction, ButtonType type) {
@@ -61,5 +61,5 @@
      * @param hotkey
      * @param actions a list of actions to be performed.
-     * @param type if <code>null</code> {@link ButtonType#SINGLE} is used. 
+     * @param type if <code>null</code> {@link ButtonType#SINGLE} is used.
      */
     public ButtonDescription(String label, String hotkey, String iconName, SurveyorActionDescription actionDescription, ButtonType type) {
@@ -77,9 +77,9 @@
         return list;
     }
-    
+
     /**
      * @param hotkey
      * @param actions a list of actions to be performed.
-     * @param type if <code>null</code> {@link ButtonType#SINGLE} is used. 
+     * @param type if <code>null</code> {@link ButtonType#SINGLE} is used.
      */
     public ButtonDescription(String label, String hotkey, String iconName, List<SurveyorActionDescription> actions, ButtonType type) {
@@ -140,5 +140,5 @@
         return this.type;
     }
-    
+
     /**
      * Set the button type as a string.
@@ -159,5 +159,5 @@
         this.type = type;
     }
-    
+
     /**
      * Sets the name of the icon.
@@ -167,5 +167,5 @@
         this.iconName = icon;
     }
-    
+
     /**
      * Creates the button.
@@ -173,7 +173,7 @@
      */
     public JComponent createComponent() {
-        
+
         String actionName = tr(getLabel()) + " (" + hotkey + ")";
-           
+
         Icon icon = ImageProvider.getIfAvailable("markers",iconName);
         if (icon == null)
@@ -185,5 +185,5 @@
         action.setActions(actions);
         action.setGpsDataSource(gpsDataSource);
-                
+
         AbstractButton button;
         if(type == ButtonType.TOGGLE) {
@@ -206,14 +206,14 @@
         return button;
     }
-    
+
     private static void connectActionAndButton(Action action, AbstractButton button) {
         SelectionStateAdapter adapter = new SelectionStateAdapter(action, button);
         adapter.configure();
     }
- 
-    /**
-     * Class that connects the selection state of the action 
+
+    /**
+     * Class that connects the selection state of the action
      * to the selection state of the button.
-     * 
+     *
      * @author R.J. Lorimer
      */
@@ -223,5 +223,5 @@
         public SelectionStateAdapter(Action theAction, AbstractButton theButton) {
             action = theAction;
-            button = theButton;         
+            button = theButton;
         }
         protected void configure() {
@@ -234,5 +234,5 @@
             action.putValue(ActionConstants.SELECTED_KEY, valueObj);
         }
-        
+
         public void propertyChange(PropertyChangeEvent evt) {
             if(evt.getPropertyName().equals(ActionConstants.SELECTED_KEY)) {
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ButtonType.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ButtonType.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ButtonType.java	(revision 12778)
@@ -9,6 +9,6 @@
  *
  */
-public enum ButtonType { 
-    SINGLE, 
-    TOGGLE 
+public enum ButtonType {
+    SINGLE,
+    TOGGLE
 }
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/GpsActionEvent.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/GpsActionEvent.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/GpsActionEvent.java	(revision 12778)
@@ -16,5 +16,5 @@
     private static final long serialVersionUID = 2674961758007055637L;
     private LatLon coordinates;
-    
+
 
     /**
@@ -36,5 +36,5 @@
     }
 
- 
+
 
 }
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/MetaAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/MetaAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/MetaAction.java	(revision 12778)
@@ -18,7 +18,7 @@
 /**
  * Action that fires a {@link SurveyorAction} to the registered actions.
- * 
+ *
  * @author cdaller
- * 
+ *
  */
 public class MetaAction extends AbstractAction {
@@ -30,5 +30,5 @@
 
     /**
-     * 
+     *
      */
     public MetaAction() {
@@ -70,5 +70,5 @@
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
      */
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorAction.java	(revision 12778)
@@ -18,5 +18,5 @@
      */
     public void actionPerformed(GpsActionEvent event);
-    
+
     /**
      * Sets the parameters for the action execution.
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionDescription.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionDescription.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionDescription.java	(revision 12778)
@@ -19,8 +19,8 @@
     private List<String> params;
     private SurveyorAction action;
-    
-    
+
+
     /**
-     * Default Constructor 
+     * Default Constructor
      */
     public SurveyorActionDescription() {
@@ -80,5 +80,5 @@
         this.params = params;
     }
-    
+
     public void actionPerformed(GpsActionEvent e) {
         if(action == null) {
@@ -88,5 +88,5 @@
         action.actionPerformed(e);
     }
-    
+
     /**
      * Sets the classname of the action to use. Callback method of xml parser.
@@ -96,5 +96,5 @@
         setActionClass(claszName);
     }
-    
+
     /**
      * Set the params as a comma separated string.
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionFactory.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionFactory.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionFactory.java	(revision 12778)
@@ -12,6 +12,6 @@
  * the action instances are used as singletons!
  * A package name of "at.dallermassl.josm.plugin.surveyor.action" is assumed, if the class could
- * not be found. 
- * 
+ * not be found.
+ *
  * @author cdaller
  *
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorComponent.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorComponent.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorComponent.java	(revision 12778)
@@ -32,5 +32,5 @@
 /**
  * @author cdaller
- * 
+ *
  */
 public class SurveyorComponent extends JComponent implements PropertyChangeListener, GpsDataSource {
@@ -57,5 +57,5 @@
         add(buttonPanel, BorderLayout.CENTER);
     }
-    
+
     /**
      * Set the number of rows as a string (callback method from xml parser).
@@ -66,5 +66,5 @@
         buttonPanel.setLayout(new GridLayout(rows, columns));
     }
-    
+
     /**
      * Set the number of columns as a string (callback method from xml parser).
@@ -76,5 +76,5 @@
         buttonPanel.setLayout(new GridLayout(rows, columns));
     }
-    
+
     /**
      * Set the width as a string.
@@ -87,5 +87,5 @@
         }
     }
-    
+
     /**
      * Set the width as a string.
@@ -115,10 +115,10 @@
         }
     }
-    
-    
+
+
 
     public static void main(String[] args) {
-        
-        
+
+
         // parse xml file and create component from it:
         Reader in = new InputStreamReader(SurveyorComponent.class.getClassLoader().getResourceAsStream("surveyor.xml"));
@@ -151,6 +151,6 @@
         } catch (SAXException e) {
             e.printStackTrace();
-        }        
-        
+        }
+
 //        SurveyorComponent surveyorComponent = new SurveyorComponent();
 //        surveyorComponent.setGridSize(3,3);
@@ -163,5 +163,5 @@
 //        surveyorComponent.addButton(new ButtonDescription("Residential", "R", null, "ConsolePrinterAction", null));
 //        surveyorComponent.addButton(new ButtonDescription("Parking", "P", "images/symbols/parking.png", "ConsolePrinterAction", null));
-        
+
         JFrame frame = new JFrame();
         frame.add(surveyorComponent);
@@ -179,5 +179,5 @@
             streetLabel.setText(tr("Way: ") + gpsData.getWayInfo());
         }
-        
+
     }
 
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java	(revision 12778)
@@ -27,5 +27,5 @@
  * Plugin that uses live gps data and a button panel to add nodes/waypoints etc at the current
  * position.
- * 
+ *
  * TODO: auto save marker layer and data layer?
  * TODO: in action retrieve buttontype state to set on/off values
@@ -34,14 +34,14 @@
  */
 public class SurveyorPlugin {
-    
+
     private static JFrame surveyorFrame;
     public static final String PREF_KEY_STREET_NAME_FONT_SIZE = "surveyor.way.fontsize";
-    
+
     /**
-     * 
+     *
      */
     public SurveyorPlugin() {
         super();
-        
+
         // try to determine if the livegps plugin was already loaded:
 //        PluginInformation pluginInfo = PluginInformation.getLoaded("livegps");
@@ -57,13 +57,13 @@
             Class.forName("livegps.LiveGpsPlugin");
         } catch(ClassNotFoundException cnfe) {
-            String message = 
+            String message =
                 tr("SurveyorPlugin depends on LiveGpsPlugin!") + "\n" +
                 tr("LiveGpsPlugin not found, please install and activate.") + "\n" +
-                tr("SurveyorPlugin is disabled for the moment"); 
+                tr("SurveyorPlugin is disabled for the moment");
             JOptionPane.showMessageDialog(Main.parent, message, tr("SurveyorPlugin"), JOptionPane.ERROR_MESSAGE);
             return;
         }
-        
-        
+
+
         LiveGpsPlugin gpsPlugin = null;
         Iterator<PluginProxy> proxyIter = Main.plugins.iterator();
@@ -101,4 +101,4 @@
         SurveyorPlugin.surveyorFrame = surveyorFrame;
     }
-    
+
 }
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java	(revision 12778)
@@ -68,10 +68,10 @@
 //          comp.addButton(new ButtonDescription("Residential", "R", null,
 //          new SurveyorActionDescription("SetWaypointAction", new String[] {"residential", "images/reorder.png"}), null));
-//          comp.addButton(new ButtonDescription("Parking", "P", "images/symbols/parking.png", 
+//          comp.addButton(new ButtonDescription("Parking", "P", "images/symbols/parking.png",
 //          new SurveyorActionDescription("SetNodeAction", new String[] {"amenity", "parking", "createdby", "surveyor"}), null));
-            
+
             // add component as gps event listener:
             gpsPlugin.addPropertyChangeListener(comp);
-            
+
             // add some hotkeys to the component:
             ActionMap actionMap = comp.getActionMap();
@@ -103,5 +103,5 @@
             });
             inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0), "autocenter");
-           
+
             surveyorFrame.add(comp);
             surveyorFrame.pack();
@@ -111,5 +111,5 @@
             // <FIXXME date="28.04.2007" author="cdaller">
             // TODO get old pos of frame from properties
-            // </FIXXME> 
+            // </FIXXME>
             SurveyorPlugin.setSurveyorFrame(surveyorFrame);
         }
@@ -127,5 +127,5 @@
             // <FIXXME date="04.05.2007" author="cdaller">
             // TODO copy xml file to .josm directory if it does not exist!
-            // </FIXXME> 
+            // </FIXXME>
         }
         SurveyorComponent component= null;
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/AbstractSurveyorAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/AbstractSurveyorAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/AbstractSurveyorAction.java	(revision 12778)
@@ -15,5 +15,5 @@
 public abstract class AbstractSurveyorAction implements SurveyorAction {
     private List<String> parameters;
-    
+
     /**
      * Returns the parameters.
@@ -23,5 +23,5 @@
         return parameters;
     }
-        
+
     /* (non-Javadoc)
      * @see at.dallermassl.josm.plugin.surveyor.SurveyorAction#setParameters(java.util.List)
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/ConsolePrinterAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/ConsolePrinterAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/ConsolePrinterAction.java	(revision 12778)
@@ -20,5 +20,5 @@
     public void actionPerformed(GpsActionEvent event) {
         LatLon coordinates = event.getCoordinates();
-        System.out.println(getClass().getSimpleName() + " KOORD: " + coordinates.lat() + ", " 
+        System.out.println(getClass().getSimpleName() + " KOORD: " + coordinates.lat() + ", "
             + coordinates.lon() + " params: " + getParameters());
     }
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/PlayAudioAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/PlayAudioAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/PlayAudioAction.java	(revision 12778)
@@ -25,5 +25,5 @@
 /**
  * Action that plays an audio file.
- * 
+ *
  * @author cdaller
  *
@@ -86,7 +86,7 @@
                 }
             }
-            
+
         });
-        
+
     }
 }
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetNodeAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetNodeAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetNodeAction.java	(revision 12778)
@@ -29,12 +29,12 @@
 public class SetNodeAction implements SurveyorAction {
     private Collection<Tuple<String, String>> keyValues;
-    
+
     /**
      * Default Constructor
      */
     public SetNodeAction() {
-        
+
     }
-    
+
     /* (non-Javadoc)
      * @see at.dallermassl.josm.plugin.surveyor.SurveyorAction#setParameters(java.util.List)
@@ -55,5 +55,5 @@
                 System.err.println("SetNodeAction: ignoring invalid key value pair: " + keyValuePair);
             }
-        }        
+        }
     }
 
@@ -73,7 +73,7 @@
             Main.ds.setSelected(node);
         }
-        Main.map.repaint();        
+        Main.map.repaint();
     }
 
-    
+
 }
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetWaypointAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetWaypointAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetWaypointAction.java	(revision 12778)
@@ -31,5 +31,5 @@
  * Action that sets a marker into a marker layer. The first parameter of the action
  * is used as the text of the marker, the second (if it exists) as an icon.
- * 
+ *
  * @author cdaller
  *
@@ -40,10 +40,10 @@
     public static final String MARKER_LAYER_NAME = "surveyorwaypointlayer";
     private WaypointDialog dialog;
-    
+
     /**
      * Default Constructor.
      */
     public SetWaypointAction() {
-        
+
     }
 
@@ -61,12 +61,12 @@
                 markerTitle = markerTitle + " " + tr("start");
             } else {
-                markerTitle = markerTitle + " " + tr("end");                
+                markerTitle = markerTitle + " " + tr("end");
             }
         }
-        
+
         if(dialog == null) {
             dialog = new WaypointDialog();
         }
-        
+
         String markerText = markerTitle;
         String inputText = dialog.openDialog(SurveyorPlugin.getSurveyorFrame(), "Waypoint Description");
@@ -75,8 +75,8 @@
             markerText = markerText + " " + inputText;
         }
-        
+
         String iconName = getParameters().size() > 1 ? getParameters().get(1) : null;
-        
-        // add the waypoint to the marker layer AND to the gpx layer 
+
+        // add the waypoint to the marker layer AND to the gpx layer
         // (easy export of data + waypoints):
         MarkerLayer layer = getMarkerLayer();
@@ -87,13 +87,13 @@
         synchronized(LiveGpsLock.class) {
             //layer.data.add(new Marker(event.getCoordinates(), markerText, iconName));
-	    layer.data.add(new Marker(event.getCoordinates(), markerText, iconName, null, -1.0, 0.0));
+        layer.data.add(new Marker(event.getCoordinates(), markerText, iconName, null, -1.0, 0.0));
             if(gpsLayer != null) {
                 gpsLayer.data.waypoints.add(waypoint);
             }
         }
-        
+
         Main.map.repaint();
     }
-    
+
     /**
      * Returns the marker layer with the name {@link #MARKER_LAYER_NAME}.
@@ -103,9 +103,9 @@
         if(markerLayer == null) {
             markerLayer = LayerUtil.findGpsLayer(MARKER_LAYER_NAME, MarkerLayer.class);
-           
+
             if(markerLayer == null) {
                 // not found, add a new one
                 //markerLayer = new MarkerLayer(new GpxData(), MARKER_LAYER_NAME, null);
-		markerLayer = new MarkerLayer(new GpxData(), MARKER_LAYER_NAME, null, null);
+        markerLayer = new MarkerLayer(new GpxData(), MARKER_LAYER_NAME, null, null);
                 Main.main.addLayer(markerLayer);
             }
@@ -113,5 +113,5 @@
         return markerLayer;
     }
-    
+
     /**
      * Returns the gpx layer that is filled by the live gps data.
@@ -126,5 +126,5 @@
                     break;
                 }
-            } 
+            }
         }
         return liveGpsLayer;
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/TaggingPresetAction.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/TaggingPresetAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/TaggingPresetAction.java	(revision 12778)
@@ -23,5 +23,5 @@
     private String presetName;
     private TaggingPreset preset;
-    
+
 
     /* (non-Javadoc)
@@ -34,5 +34,5 @@
         }
         LatLon coordinates = event.getCoordinates();
-        System.out.println(getClass().getSimpleName() + " KOORD: " + coordinates.lat() + ", " 
+        System.out.println(getClass().getSimpleName() + " KOORD: " + coordinates.lat() + ", "
             + coordinates.lon() + ", preset=" + presetName);
 //        Node node = new Node(coordinates);
@@ -43,5 +43,5 @@
 //        }
 //        Main.map.repaint();
-        
+
         // call an annotationpreset to add additional properties...
         preset.actionPerformed(null);
@@ -63,5 +63,5 @@
             System.err.println("No valid preset '" + parameters.get(0) + "' found - disable action!");
             return;
-        }        
+        }
     }
 
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/DialogClosingThread.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/DialogClosingThread.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/DialogClosingThread.java	(revision 12778)
@@ -24,5 +24,5 @@
     private long timeout;
     private long loopCount;
-    
+
     /**
      * Using the given dialog and the default timeout.
@@ -31,6 +31,6 @@
     public DialogClosingThread(JDialog dialog) {
         this(dialog, DEFAULT_TIMEOUT);
-    }   
-       
+    }
+
     /**
      * @param dialog
@@ -61,5 +61,5 @@
         dialog.dispose();
     }
-    
+
     public void reset() {
         this.loopCount = timeout / 1000;
@@ -105,9 +105,9 @@
         }
     }
-    
+
     public void observe(Component component) {
         component.addKeyListener(this);
     }
-    
+
     public void observe(JTextField textfield) {
         textfield.getDocument().addDocumentListener(this);
@@ -120,5 +120,5 @@
     public void changedUpdate(DocumentEvent e) {
         reset();
-        System.out.println("changedUpdate: " + e);        
+        System.out.println("changedUpdate: " + e);
     }
 
@@ -138,5 +138,5 @@
     public void removeUpdate(DocumentEvent e) {
         reset();
-        System.out.println("removeUpdate: " + e);        
+        System.out.println("removeUpdate: " + e);
     }
 }
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/WaypointDialog.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/WaypointDialog.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/WaypointDialog.java	(revision 12778)
@@ -21,7 +21,7 @@
  */
 public class WaypointDialog {
-    
+
     public String openDialog(JFrame frame, String message) {
-        
+
         JTextField textField = new JTextField(10);
 
@@ -66,5 +66,5 @@
         dialog.pack();
         dialog.setVisible(true);
-        
+
 
         System.out.println("value: " + optionPane.getValue());
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/LayerUtil.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/LayerUtil.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/LayerUtil.java	(revision 12778)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package at.dallermassl.josm.plugin.surveyor.util;
Index: /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/ResourceLoader.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/ResourceLoader.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/ResourceLoader.java	(revision 12778)
@@ -15,9 +15,9 @@
  */
 public class ResourceLoader {
-    
+
     private ResourceLoader() {
-        
+
     }
-    
+
     /**
      * Returns an inputstream from urls, files and classloaders, depending on the name.
Index: /applications/editors/josm/plugins/surveyor/src/org/dinopolis/util/collection/Tuple.java
===================================================================
--- /applications/editors/josm/plugins/surveyor/src/org/dinopolis/util/collection/Tuple.java	(revision 12777)
+++ /applications/editors/josm/plugins/surveyor/src/org/dinopolis/util/collection/Tuple.java	(revision 12778)
@@ -9,5 +9,5 @@
 /**
  * Simple implementation of a tuple (two objects).
- * 
+ *
  * @author cdaller
  *
@@ -16,11 +16,11 @@
     T1 first;
     T2 second;
-    
+
     /**
-     * Default Constructor 
+     * Default Constructor
      */
     public Tuple() {
     }
-    
+
     /**
      * Constructor filling the values.
Index: /applications/editors/josm/plugins/tagging-preset-tester/src/org/openstreetmap/josm/plugins/taggingpresettester/TaggingPresetTester.java
===================================================================
--- /applications/editors/josm/plugins/tagging-preset-tester/src/org/openstreetmap/josm/plugins/taggingpresettester/TaggingPresetTester.java	(revision 12777)
+++ /applications/editors/josm/plugins/tagging-preset-tester/src/org/openstreetmap/josm/plugins/taggingpresettester/TaggingPresetTester.java	(revision 12778)
@@ -30,90 +30,90 @@
 public class TaggingPresetTester extends JFrame {
 
-	private JComboBox taggingPresets;
-	private final String[] args;
-	private JPanel taggingPresetPanel = new JPanel(new BorderLayout());
-	private JPanel panel = new JPanel(new BorderLayout());
+    private JComboBox taggingPresets;
+    private final String[] args;
+    private JPanel taggingPresetPanel = new JPanel(new BorderLayout());
+    private JPanel panel = new JPanel(new BorderLayout());
 
-	public void reload() {
-		Vector<TaggingPreset> allPresets = new Vector<TaggingPreset>();
-		for (String source : args) {
-			InputStream in = null;
-			try {
-				if (source.startsWith("http") || source.startsWith("ftp") || source.startsWith("file"))
-					in = new URL(source).openStream();
-				else
-					in = new FileInputStream(source);
-				allPresets.addAll(TaggingPreset.readAll(new BufferedReader(new InputStreamReader(in))));
-			} catch (IOException e) {
-				e.printStackTrace();
-				JOptionPane.showMessageDialog(null, "Could not read tagging preset source: "+source);
-			} catch (SAXException e) {
-				e.printStackTrace();
-				JOptionPane.showMessageDialog(null, "Error parsing "+source+": "+e.getMessage());
-			}
+    public void reload() {
+        Vector<TaggingPreset> allPresets = new Vector<TaggingPreset>();
+        for (String source : args) {
+            InputStream in = null;
+            try {
+                if (source.startsWith("http") || source.startsWith("ftp") || source.startsWith("file"))
+                    in = new URL(source).openStream();
+                else
+                    in = new FileInputStream(source);
+                allPresets.addAll(TaggingPreset.readAll(new BufferedReader(new InputStreamReader(in))));
+            } catch (IOException e) {
+                e.printStackTrace();
+                JOptionPane.showMessageDialog(null, "Could not read tagging preset source: "+source);
+            } catch (SAXException e) {
+                e.printStackTrace();
+                JOptionPane.showMessageDialog(null, "Error parsing "+source+": "+e.getMessage());
+            }
 
-			try {
-				if (in != null)
-					in.close();
-			} catch (IOException e) {
-			}
-		}
-		taggingPresets.setModel(new DefaultComboBoxModel(allPresets));
-	}
+            try {
+                if (in != null)
+                    in.close();
+            } catch (IOException e) {
+            }
+        }
+        taggingPresets.setModel(new DefaultComboBoxModel(allPresets));
+    }
 
-	public void reselect() {
-		taggingPresetPanel.removeAll();
-		TaggingPreset preset = (TaggingPreset)taggingPresets.getSelectedItem();
-		if (preset == null)
-			return;
-		Collection<OsmPrimitive> x = Collections.emptySet();
-		JPanel p = preset.createPanel(x);
-		p.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-		if (p != null)
-			taggingPresetPanel.add(p, BorderLayout.NORTH);
-		panel.validate();
-		panel.repaint();
-	}
+    public void reselect() {
+        taggingPresetPanel.removeAll();
+        TaggingPreset preset = (TaggingPreset)taggingPresets.getSelectedItem();
+        if (preset == null)
+            return;
+        Collection<OsmPrimitive> x = Collections.emptySet();
+        JPanel p = preset.createPanel(x);
+        p.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+        if (p != null)
+            taggingPresetPanel.add(p, BorderLayout.NORTH);
+        panel.validate();
+        panel.repaint();
+    }
 
-	public TaggingPresetTester(String[] args) {
-		super("Tagging Preset Tester");
-		this.args = args;
-		taggingPresets = new JComboBox();
-		taggingPresets.setRenderer(new TaggingCellRenderer());
-		reload();
+    public TaggingPresetTester(String[] args) {
+        super("Tagging Preset Tester");
+        this.args = args;
+        taggingPresets = new JComboBox();
+        taggingPresets.setRenderer(new TaggingCellRenderer());
+        reload();
 
-		panel.add(taggingPresets, BorderLayout.NORTH);
-		panel.add(taggingPresetPanel, BorderLayout.CENTER);
-		taggingPresets.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				reselect();
-			}
-		});
-		reselect();
+        panel.add(taggingPresets, BorderLayout.NORTH);
+        panel.add(taggingPresetPanel, BorderLayout.CENTER);
+        taggingPresets.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                reselect();
+            }
+        });
+        reselect();
 
-		JButton b = new JButton("Reload");
-		b.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				int i = taggingPresets.getSelectedIndex();
-				reload();
-				taggingPresets.setSelectedIndex(i);
-			}
-		});
-		panel.add(b, BorderLayout.SOUTH);
+        JButton b = new JButton("Reload");
+        b.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                int i = taggingPresets.getSelectedIndex();
+                reload();
+                taggingPresets.setSelectedIndex(i);
+            }
+        });
+        panel.add(b, BorderLayout.SOUTH);
 
-		setContentPane(panel);
-		setSize(300,500);
-		setVisible(true);
-	}
+        setContentPane(panel);
+        setSize(300,500);
+        setVisible(true);
+    }
 
-	public static void main(String[] args) {
-		if (args.length == 0) {
-			JFileChooser c = new JFileChooser();
-			if (c.showOpenDialog(null) != JFileChooser.APPROVE_OPTION)
-				return;
-			args = new String[]{c.getSelectedFile().getPath()};
-		}
-		JFrame f = new TaggingPresetTester(args);
-		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-	}
+    public static void main(String[] args) {
+        if (args.length == 0) {
+            JFileChooser c = new JFileChooser();
+            if (c.showOpenDialog(null) != JFileChooser.APPROVE_OPTION)
+                return;
+            args = new String[]{c.getSelectedFile().getPath()};
+        }
+        JFrame f = new TaggingPresetTester(args);
+        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+    }
 }
Index: /applications/editors/josm/plugins/tagging-preset-tester/src/org/openstreetmap/josm/plugins/taggingpresettester/TaggingPresetTesterAction.java
===================================================================
--- /applications/editors/josm/plugins/tagging-preset-tester/src/org/openstreetmap/josm/plugins/taggingpresettester/TaggingPresetTesterAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/tagging-preset-tester/src/org/openstreetmap/josm/plugins/taggingpresettester/TaggingPresetTesterAction.java	(revision 12778)
@@ -19,22 +19,22 @@
 public class TaggingPresetTesterAction extends JosmAction {
 
-	public TaggingPresetTesterAction() {
-		super(tr("Tagging Preset Tester"), "tagging-preset-tester",
-		tr("Open the tagging preset test tool for previewing tagging preset dialogs."),
-		Shortcut.registerShortcut("tools:taggingresettester",
-		tr("Tool: {0}", tr("Tagging Preset Tester")),
-		KeyEvent.VK_A, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);
-		Main.main.menu.helpMenu.addSeparator();
-		MainMenu.add(Main.main.menu.helpMenu, this);
-	}
+    public TaggingPresetTesterAction() {
+        super(tr("Tagging Preset Tester"), "tagging-preset-tester",
+        tr("Open the tagging preset test tool for previewing tagging preset dialogs."),
+        Shortcut.registerShortcut("tools:taggingresettester",
+        tr("Tool: {0}", tr("Tagging Preset Tester")),
+        KeyEvent.VK_A, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);
+        Main.main.menu.helpMenu.addSeparator();
+        MainMenu.add(Main.main.menu.helpMenu, this);
+    }
 
-	public void actionPerformed(ActionEvent e) {
-		String taggingPresetSources = Main.pref.get("taggingpreset.sources");
-		if (taggingPresetSources.equals("")) {
-			JOptionPane.showMessageDialog(Main.parent, tr("You have to specify tagging preset sources in the preferences first."));
-			return;
-		}
-		String[] args = taggingPresetSources.split(";");
-		new TaggingPresetTester(args);
-	}
+    public void actionPerformed(ActionEvent e) {
+        String taggingPresetSources = Main.pref.get("taggingpreset.sources");
+        if (taggingPresetSources.equals("")) {
+            JOptionPane.showMessageDialog(Main.parent, tr("You have to specify tagging preset sources in the preferences first."));
+            return;
+        }
+        String[] args = taggingPresetSources.split(";");
+        new TaggingPresetTester(args);
+    }
 }
Index: /applications/editors/josm/plugins/tcxplugin/src/org/openstreetmap/josm/io/TcxReader.java
===================================================================
--- /applications/editors/josm/plugins/tcxplugin/src/org/openstreetmap/josm/io/TcxReader.java	(revision 12777)
+++ /applications/editors/josm/plugins/tcxplugin/src/org/openstreetmap/josm/io/TcxReader.java	(revision 12778)
@@ -47,136 +47,136 @@
 public class TcxReader {
 
-	private File tcxFile;
+    private File tcxFile;
 
-	private GpxData gpxData;
+    private GpxData gpxData;
 
-	/**
-	 * @param tcxFile
-	 */
-	public TcxReader(File tcxFile) {
-		super();
-		this.tcxFile = tcxFile;
-		parseFile();
-	}
+    /**
+     * @param tcxFile
+     */
+    public TcxReader(File tcxFile) {
+        super();
+        this.tcxFile = tcxFile;
+        parseFile();
+    }
 
-	/**
-	 * 
-	 */
-	@SuppressWarnings("unchecked") private void parseFile() {
-		try {
-			JAXBContext jc = JAXBContext
-			        .newInstance(TrainingCenterDatabaseT.class);
-			Unmarshaller unmarshaller = jc.createUnmarshaller();
-			JAXBElement<TrainingCenterDatabaseT> element = (JAXBElement<TrainingCenterDatabaseT>)unmarshaller
-			        .unmarshal(tcxFile);
+    /**
+     * 
+     */
+    @SuppressWarnings("unchecked") private void parseFile() {
+        try {
+            JAXBContext jc = JAXBContext
+                    .newInstance(TrainingCenterDatabaseT.class);
+            Unmarshaller unmarshaller = jc.createUnmarshaller();
+            JAXBElement<TrainingCenterDatabaseT> element = (JAXBElement<TrainingCenterDatabaseT>)unmarshaller
+                    .unmarshal(tcxFile);
 
-			TrainingCenterDatabaseT tcd = element.getValue();
+            TrainingCenterDatabaseT tcd = element.getValue();
 
-			gpxData = new GpxData();
+            gpxData = new GpxData();
 
-			// Usually logged activities are in the activities tag.
-			parseDataFromActivities(tcd);
-			// GPS tracks in the course tag are generated by the user.
-			// Maybe not a good idea to import them.
-			parseDataFromCourses(tcd);
+            // Usually logged activities are in the activities tag.
+            parseDataFromActivities(tcd);
+            // GPS tracks in the course tag are generated by the user.
+            // Maybe not a good idea to import them.
+            parseDataFromCourses(tcd);
 
-		} catch (JAXBException e) {
-			throw new RuntimeException(e);
-		}
-	}
+        } catch (JAXBException e) {
+            throw new RuntimeException(e);
+        }
+    }
 
-	/**
-	 * @param tcd
-	 */
-	private void parseDataFromActivities(TrainingCenterDatabaseT tcd) {
-		if ((tcd.getActivities() != null)
-		        && (tcd.getActivities().getActivity() != null)) {
-			for (ActivityT activity : tcd.getActivities().getActivity()) {
-				if (activity.getLap() != null) {
-					for (ActivityLapT activityLap : activity.getLap()) {
-						if (activityLap.getTrack() != null) {
-							GpxTrack currentTrack = new GpxTrack();
-							gpxData.tracks.add(currentTrack);
-							for (TrackT track : activityLap.getTrack()) {
-								if (track.getTrackpoint() != null) {
-									Collection<WayPoint> currentTrackSeg = new ArrayList<WayPoint>();
-									currentTrack.trackSegs.add(currentTrackSeg);
-									for (TrackpointT trackpoint : track
-									        .getTrackpoint()) {
-										// Some trackspoints don't have a
-										// position.
-										// Check it
-										// first to avoid an NPE!
-										if (trackpoint.getPosition() != null) {
-											LatLon latLon = new LatLon(
-											        trackpoint
-											                .getPosition()
-											                .getLatitudeDegrees(),
-											        trackpoint
-											                .getPosition()
-											                .getLongitudeDegrees());
-											WayPoint currentWayPoint = new WayPoint(
-											        latLon);
-											// We usually have altitude info
-											// here
-											// (trackpoint.getAltitudeMeters())
-											// Don't know how to add it to
-											// the GPX
-											// Data...
-											currentTrackSeg
-											        .add(currentWayPoint);
-										}
-									}
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
+    /**
+     * @param tcd
+     */
+    private void parseDataFromActivities(TrainingCenterDatabaseT tcd) {
+        if ((tcd.getActivities() != null)
+                && (tcd.getActivities().getActivity() != null)) {
+            for (ActivityT activity : tcd.getActivities().getActivity()) {
+                if (activity.getLap() != null) {
+                    for (ActivityLapT activityLap : activity.getLap()) {
+                        if (activityLap.getTrack() != null) {
+                            GpxTrack currentTrack = new GpxTrack();
+                            gpxData.tracks.add(currentTrack);
+                            for (TrackT track : activityLap.getTrack()) {
+                                if (track.getTrackpoint() != null) {
+                                    Collection<WayPoint> currentTrackSeg = new ArrayList<WayPoint>();
+                                    currentTrack.trackSegs.add(currentTrackSeg);
+                                    for (TrackpointT trackpoint : track
+                                            .getTrackpoint()) {
+                                        // Some trackspoints don't have a
+                                        // position.
+                                        // Check it
+                                        // first to avoid an NPE!
+                                        if (trackpoint.getPosition() != null) {
+                                            LatLon latLon = new LatLon(
+                                                    trackpoint
+                                                            .getPosition()
+                                                            .getLatitudeDegrees(),
+                                                    trackpoint
+                                                            .getPosition()
+                                                            .getLongitudeDegrees());
+                                            WayPoint currentWayPoint = new WayPoint(
+                                                    latLon);
+                                            // We usually have altitude info
+                                            // here
+                                            // (trackpoint.getAltitudeMeters())
+                                            // Don't know how to add it to
+                                            // the GPX
+                                            // Data...
+                                            currentTrackSeg
+                                                    .add(currentWayPoint);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
 
-	/**
-	 * @param tcd
-	 */
-	private void parseDataFromCourses(TrainingCenterDatabaseT tcd) {
-		if ((tcd.getCourses() != null)
-		        && (tcd.getCourses().getCourse() != null)) {
-			for (CourseT course : tcd.getCourses().getCourse()) {
-				if (course.getTrack() != null) {
-					GpxTrack currentTrack = new GpxTrack();
-					gpxData.tracks.add(currentTrack);
-					for (TrackT track : course.getTrack()) {
-						if (track.getTrackpoint() != null) {
-							Collection<WayPoint> currentTrackSeg = new ArrayList<WayPoint>();
-							currentTrack.trackSegs.add(currentTrackSeg);
-							for (TrackpointT trackpoint : track.getTrackpoint()) {
-								// Some trackspoints don't have a position.
-								// Check it
-								// first to avoid an NPE!
-								if (trackpoint.getPosition() != null) {
-									LatLon latLon = new LatLon(
-									        trackpoint.getPosition()
-									                .getLatitudeDegrees(),
-									        trackpoint.getPosition()
-									                .getLongitudeDegrees());
-									WayPoint currentWayPoint = new WayPoint(
-									        latLon);
-									// We usually have altitude info here
-									// (trackpoint.getAltitudeMeters())
-									// Don't know how to add it to the GPX
-									// Data...
-									currentTrackSeg.add(currentWayPoint);
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
+    /**
+     * @param tcd
+     */
+    private void parseDataFromCourses(TrainingCenterDatabaseT tcd) {
+        if ((tcd.getCourses() != null)
+                && (tcd.getCourses().getCourse() != null)) {
+            for (CourseT course : tcd.getCourses().getCourse()) {
+                if (course.getTrack() != null) {
+                    GpxTrack currentTrack = new GpxTrack();
+                    gpxData.tracks.add(currentTrack);
+                    for (TrackT track : course.getTrack()) {
+                        if (track.getTrackpoint() != null) {
+                            Collection<WayPoint> currentTrackSeg = new ArrayList<WayPoint>();
+                            currentTrack.trackSegs.add(currentTrackSeg);
+                            for (TrackpointT trackpoint : track.getTrackpoint()) {
+                                // Some trackspoints don't have a position.
+                                // Check it
+                                // first to avoid an NPE!
+                                if (trackpoint.getPosition() != null) {
+                                    LatLon latLon = new LatLon(
+                                            trackpoint.getPosition()
+                                                    .getLatitudeDegrees(),
+                                            trackpoint.getPosition()
+                                                    .getLongitudeDegrees());
+                                    WayPoint currentWayPoint = new WayPoint(
+                                            latLon);
+                                    // We usually have altitude info here
+                                    // (trackpoint.getAltitudeMeters())
+                                    // Don't know how to add it to the GPX
+                                    // Data...
+                                    currentTrackSeg.add(currentWayPoint);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
 
-	public GpxData getGpxData() {
-		return gpxData;
-	}
+    public GpxData getGpxData() {
+        return gpxData;
+    }
 }
Index: /applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/SimplifyWayAction.java
===================================================================
--- /applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/SimplifyWayAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/SimplifyWayAction.java	(revision 12778)
@@ -49,5 +49,5 @@
                 if (bounds.size() > 0) {
                     Way way = (Way) prim;
-                    // We check if each node of each way is at least in one download 
+                    // We check if each node of each way is at least in one download
                     // bounding box. Otherwise nodes may get deleted that are necessary by
                     // unloaded ways (see Ticket #1594)
@@ -83,5 +83,5 @@
             return;
         } else if (ways > 10) {
-        	//TRANSLATION: Although for English the use of trn is needless it is important for other languages
+            //TRANSLATION: Although for English the use of trn is needless it is important for other languages
             int option = JOptionPane.showConfirmDialog(Main.parent, trn(
                     "The selection contains {0} way. Are you sure you want to simplify it?",
Index: /applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/UtilsPlugin.java
===================================================================
--- /applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/UtilsPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/UtilsPlugin.java	(revision 12778)
@@ -22,16 +22,16 @@
 
 public class UtilsPlugin extends Plugin {
-	JMenuItem SimplifyWay;
+    JMenuItem SimplifyWay;
 
-	public UtilsPlugin() {
-		SimplifyWay = MainMenu.add(Main.main.menu.toolsMenu, new SimplifyWayAction());
-		SimplifyWay.setEnabled(false);
-	}
-	
-	@Override
-	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-		if (oldFrame == null && newFrame != null) {
-			SimplifyWay.setEnabled(true);
-		}
-	}
+    public UtilsPlugin() {
+        SimplifyWay = MainMenu.add(Main.main.menu.toolsMenu, new SimplifyWayAction());
+        SimplifyWay.setEnabled(false);
+    }
+
+    @Override
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+        if (oldFrame == null && newFrame != null) {
+            SimplifyWay.setEnabled(true);
+        }
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ErrorTreeRenderer.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ErrorTreeRenderer.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ErrorTreeRenderer.java	(revision 12778)
@@ -16,32 +16,32 @@
 public class ErrorTreeRenderer extends DefaultTreeCellRenderer
 {
-	/** Serializable ID */
-	private static final long serialVersionUID = 5567632718124640198L;
+    /** Serializable ID */
+    private static final long serialVersionUID = 5567632718124640198L;
 
-	@Override
-	public Component getTreeCellRendererComponent(JTree tree, Object value,
-			boolean selected, boolean expanded, boolean leaf, int row,
-			boolean hasFocus) 
-	{
-		super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
-		
-		DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
-		Object nodeInfo = node.getUserObject();
+    @Override
+    public Component getTreeCellRendererComponent(JTree tree, Object value,
+            boolean selected, boolean expanded, boolean leaf, int row,
+            boolean hasFocus)
+    {
+        super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
 
-		if (nodeInfo instanceof Severity)
-		{
-			Severity s = (Severity)nodeInfo;
-			setIcon(ImageProvider.get("data", s.getIcon()));
-		}
-		else if (nodeInfo instanceof TestError)
-		{
-			TestError error = (TestError)nodeInfo;
-			MultipleNameVisitor v = new MultipleNameVisitor();
-			v.visit(error.getPrimitives());
-			setText(v.getText());
-			setIcon(v.getIcon());
-		}
+        DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
+        Object nodeInfo = node.getUserObject();
 
-		return this;
-	}
+        if (nodeInfo instanceof Severity)
+        {
+            Severity s = (Severity)nodeInfo;
+            setIcon(ImageProvider.get("data", s.getIcon()));
+        }
+        else if (nodeInfo instanceof TestError)
+        {
+            TestError error = (TestError)nodeInfo;
+            MultipleNameVisitor v = new MultipleNameVisitor();
+            v.visit(error.getPrimitives());
+            setText(v.getText());
+            setIcon(v.getIcon());
+        }
+
+        return this;
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java	(revision 12778)
@@ -28,19 +28,19 @@
 public class GridLayer extends Layer
 {
-	/**
-	 * Constructor 
-	 * @param name
-	 */
-	public GridLayer(String name) 
+    /**
+     * Constructor 
+     * @param name
+     */
+    public GridLayer(String name) 
     {
-		super(name);
-	}
+        super(name);
+    }
 
-	/**
-	 * Return a static icon.
-	 */
-	@Override public Icon getIcon() {
-		return ImageProvider.get("layer", "validator");
-	}
+    /**
+     * Return a static icon.
+     */
+    @Override public Icon getIcon() {
+        return ImageProvider.get("layer", "validator");
+    }
 
     /**
@@ -50,24 +50,24 @@
     public void paint(final Graphics g, final MapView mv) 
     {
-    	if( !Main.pref.hasKey(PreferenceEditor.PREF_DEBUG + ".grid") )
-    		return;
-    	
-    	int gridWidth = Integer.parseInt(Main.pref.get(PreferenceEditor.PREF_DEBUG + ".grid") );
-    	int width = mv.getWidth();
-		int height = mv.getHeight();
+        if( !Main.pref.hasKey(PreferenceEditor.PREF_DEBUG + ".grid") )
+            return;
+        
+        int gridWidth = Integer.parseInt(Main.pref.get(PreferenceEditor.PREF_DEBUG + ".grid") );
+        int width = mv.getWidth();
+        int height = mv.getHeight();
 
-		EastNorth origin = mv.getEastNorth(0, 0);
-		EastNorth border = mv.getEastNorth(width, height);
+        EastNorth origin = mv.getEastNorth(0, 0);
+        EastNorth border = mv.getEastNorth(width, height);
 
-    	if( border.east() * gridWidth > 50 )
-    		return;
+        if( border.east() * gridWidth > 50 )
+            return;
 
         g.setColor(Color.RED.darker().darker());
-    	HighlightCellVisitor visitor = new HighlightCellVisitor(g, mv, gridWidth);
-    	for(OsmPrimitive p : Main.ds.getSelected() )
-    		p.visit(visitor);
+        HighlightCellVisitor visitor = new HighlightCellVisitor(g, mv, gridWidth);
+        for(OsmPrimitive p : Main.ds.getSelected() )
+            p.visit(visitor);
         
         long x0 = (long)Math.floor(origin.east()  * gridWidth);
-		long x1 = (long)Math.floor(border.east()  * gridWidth);
+        long x1 = (long)Math.floor(border.east()  * gridWidth);
         long y0 = (long)Math.floor(origin.north() * gridWidth) + 1;
         long y1 = (long)Math.floor(border.north() * gridWidth) + 1;        
@@ -77,42 +77,42 @@
         
         g.setColor(Color.RED.brighter().brighter());
-    	for( double x = x0; x <= x1; x++)
-    	{
-    		Point point = mv.getPoint( new EastNorth(x/gridWidth, 0));
-			g.drawLine(point.x, 0, point.x, height);
-    	}
+        for( double x = x0; x <= x1; x++)
+        {
+            Point point = mv.getPoint( new EastNorth(x/gridWidth, 0));
+            g.drawLine(point.x, 0, point.x, height);
+        }
 
-    	for( double y = y0; y <= y1; y++)
-    	{
-    		Point point = mv.getPoint( new EastNorth(0, y/gridWidth));
-			g.drawLine(0, point.y, width, point.y);
-    	}
+        for( double y = y0; y <= y1; y++)
+        {
+            Point point = mv.getPoint( new EastNorth(0, y/gridWidth));
+            g.drawLine(0, point.y, width, point.y);
+        }
     }
 
-	@Override 
+    @Override 
     public String getToolTipText() 
     {
-		return null;
-	}
+        return null;
+    }
 
-	@Override 
-	public void mergeFrom(Layer from) {}
+    @Override 
+    public void mergeFrom(Layer from) {}
 
-	@Override 
-	public boolean isMergable(Layer other) {
-		return false;
-	}
+    @Override 
+    public boolean isMergable(Layer other) {
+        return false;
+    }
 
-	@Override 
-	public void visitBoundingBox(BoundingXYVisitor v) {}
+    @Override 
+    public void visitBoundingBox(BoundingXYVisitor v) {}
 
-	@Override 
-	public Object getInfoComponent() 
+    @Override 
+    public Object getInfoComponent() 
     {
-	    return getToolTipText();
-	}
+        return getToolTipText();
+    }
 
-	@Override 
-	public Component[] getMenuEntries() 
+    @Override 
+    public Component[] getMenuEntries() 
     {
         return new Component[]{
@@ -125,72 +125,72 @@
     }
 
-	@Override public void destroy() { }
-	
-	/**
-	 * Visitor that highlights all cells the selected primitives go through
-	 */
-	class HighlightCellVisitor implements Visitor
-	{
-		/** The MapView */
-		private final MapView mv;
-		/** The graphics */
-		private final Graphics g;
-		/** The grid width */
-		private final int gridDetail;
-		/** The width of a cell */
-		private int cellWidth;
+    @Override public void destroy() { }
+    
+    /**
+     * Visitor that highlights all cells the selected primitives go through
+     */
+    class HighlightCellVisitor implements Visitor
+    {
+        /** The MapView */
+        private final MapView mv;
+        /** The graphics */
+        private final Graphics g;
+        /** The grid width */
+        private final int gridDetail;
+        /** The width of a cell */
+        private int cellWidth;
 
-		/**
-		 * Constructor
-		 * @param g the graphics
-		 * @param mv The MapView
-		 * @param gridDetail The grid detail
-		 */
-		public HighlightCellVisitor(final Graphics g, final MapView mv, int gridDetail)
-		{
-			this.g = g;
-			this.mv = mv;
-			this.gridDetail = gridDetail;
-			
-    		Point p = mv.getPoint( new EastNorth(0, 0) );
-    		Point p2 = mv.getPoint( new EastNorth(1d/gridDetail, 1d/gridDetail) );
-    		cellWidth = Math.abs(p2.x - p.x);
-		}
+        /**
+         * Constructor
+         * @param g the graphics
+         * @param mv The MapView
+         * @param gridDetail The grid detail
+         */
+        public HighlightCellVisitor(final Graphics g, final MapView mv, int gridDetail)
+        {
+            this.g = g;
+            this.mv = mv;
+            this.gridDetail = gridDetail;
+            
+            Point p = mv.getPoint( new EastNorth(0, 0) );
+            Point p2 = mv.getPoint( new EastNorth(1d/gridDetail, 1d/gridDetail) );
+            cellWidth = Math.abs(p2.x - p.x);
+        }
 
-		public void visit(Node n) 
-		{
-			double x = n.eastNorth.east() * gridDetail;
-	        double y = n.eastNorth.north()* gridDetail + 1;
+        public void visit(Node n) 
+        {
+            double x = n.eastNorth.east() * gridDetail;
+            double y = n.eastNorth.north()* gridDetail + 1;
 
-	        drawCell( Math.floor(x), Math.floor(y) );
-		}
+            drawCell( Math.floor(x), Math.floor(y) );
+        }
 
-		public void visit(Way w) 
-		{
-			Node lastN = null;
-			for (Node n : w.nodes) {
-				if (lastN == null) {
-					lastN = n;
-					continue;
-				}
-				for (Point2D p : Util.getSegmentCells(lastN, n, gridDetail)) {
-					drawCell( p.getX(), p.getY() );
-				}
-				lastN = n;
-			}
-		}
+        public void visit(Way w) 
+        {
+            Node lastN = null;
+            for (Node n : w.nodes) {
+                if (lastN == null) {
+                    lastN = n;
+                    continue;
+                }
+                for (Point2D p : Util.getSegmentCells(lastN, n, gridDetail)) {
+                    drawCell( p.getX(), p.getY() );
+                }
+                lastN = n;
+            }
+        }
 
-		public void visit(Relation r) {}
-		
-		/** 
-		 * Draws a solid cell at the (x,y) location
-		 * @param x
-		 * @param y
-		 */
-		protected void drawCell(double x, double y)
-		{
-    		Point p = mv.getPoint( new EastNorth(x/gridDetail, y/gridDetail) );
-			g.fillRect(p.x, p.y, cellWidth, cellWidth);
-		}
-	}
+        public void visit(Relation r) {}
+        
+        /** 
+         * Draws a solid cell at the (x,y) location
+         * @param x
+         * @param y
+         */
+        protected void drawCell(double x, double y)
+        {
+            Point p = mv.getPoint( new EastNorth(x/gridDetail, y/gridDetail) );
+            g.fillRect(p.x, p.y, cellWidth, cellWidth);
+        }
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/PreferenceEditor.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/PreferenceEditor.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/PreferenceEditor.java	(revision 12778)
@@ -26,101 +26,101 @@
 public class PreferenceEditor implements PreferenceSetting
 {
-	private OSMValidatorPlugin plugin;
+    private OSMValidatorPlugin plugin;
 
-	/** The preferences prefix */
-	public static final String PREFIX = "validator";
+    /** The preferences prefix */
+    public static final String PREFIX = "validator";
 
-	/** The preferences key for debug preferences */
-	public static final String PREF_DEBUG = PREFIX + ".debug";
+    /** The preferences key for debug preferences */
+    public static final String PREF_DEBUG = PREFIX + ".debug";
 
-	/** The preferences key for debug preferences */
-	public static final String PREF_LAYER = PREFIX + ".layer";
+    /** The preferences key for debug preferences */
+    public static final String PREF_LAYER = PREFIX + ".layer";
 
-	/** The preferences key for enabled tests */
-	public static final String PREF_TESTS = PREFIX + ".tests";
+    /** The preferences key for enabled tests */
+    public static final String PREF_TESTS = PREFIX + ".tests";
 
-	/** The preferences key for enabled tests */
-	public static final String PREF_USE_IGNORE = PREFIX + ".ignore";
+    /** The preferences key for enabled tests */
+    public static final String PREF_USE_IGNORE = PREFIX + ".ignore";
 
-	/** The preferences key for enabled tests before upload*/
-	public static final String PREF_TESTS_BEFORE_UPLOAD = PREFIX + ".testsBeforeUpload";
+    /** The preferences key for enabled tests before upload*/
+    public static final String PREF_TESTS_BEFORE_UPLOAD = PREFIX + ".testsBeforeUpload";
 
-	/**
-	 * The preferences key for enabling the permanent filtering
-	 * of the displayed errors in the tree regarding the current selection 
-	 */
+    /**
+     * The preferences key for enabling the permanent filtering
+     * of the displayed errors in the tree regarding the current selection 
+     */
     public static final String PREF_FILTER_BY_SELECTION = PREFIX + ".selectionFilter";
 
-	private JCheckBox prefUseIgnore;
-	private JCheckBox prefUseLayer;
+    private JCheckBox prefUseIgnore;
+    private JCheckBox prefUseLayer;
 
-	/** The list of all tests */
-	private Collection<Test> allTests;
+    /** The list of all tests */
+    private Collection<Test> allTests;
 
-	public PreferenceEditor(OSMValidatorPlugin plugin) {
-		this.plugin = plugin;
-	}
+    public PreferenceEditor(OSMValidatorPlugin plugin) {
+        this.plugin = plugin;
+    }
 
-	public void addGui(PreferenceDialog gui)
-	{
-		JPanel testPanel = new JPanel(new GridBagLayout());
-		testPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+    public void addGui(PreferenceDialog gui)
+    {
+        JPanel testPanel = new JPanel(new GridBagLayout());
+        testPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
 
-		prefUseIgnore = new JCheckBox(tr("Use ignore list."), Main.pref.getBoolean(PREF_USE_IGNORE, true));
-		prefUseIgnore.setToolTipText(tr("Use the ignore list to suppress warnings."));
-		testPanel.add(prefUseIgnore, GBC.eol());
+        prefUseIgnore = new JCheckBox(tr("Use ignore list."), Main.pref.getBoolean(PREF_USE_IGNORE, true));
+        prefUseIgnore.setToolTipText(tr("Use the ignore list to suppress warnings."));
+        testPanel.add(prefUseIgnore, GBC.eol());
 
-		prefUseLayer = new JCheckBox(tr("Use error layer."), Main.pref.getBoolean(PREF_LAYER, true));
-		prefUseLayer.setToolTipText(tr("Use the error layer to display problematic elements."));
-		testPanel.add(prefUseLayer, GBC.eol());
+        prefUseLayer = new JCheckBox(tr("Use error layer."), Main.pref.getBoolean(PREF_LAYER, true));
+        prefUseLayer.setToolTipText(tr("Use the error layer to display problematic elements."));
+        testPanel.add(prefUseLayer, GBC.eol());
 
-		GBC a = GBC.eol().insets(-5,0,0,0);
-		a.anchor = GBC.EAST;
-		testPanel.add( new JLabel(tr("On demand")), GBC.std() );
-		testPanel.add( new JLabel(tr("On upload")), a );
+        GBC a = GBC.eol().insets(-5,0,0,0);
+        a.anchor = GBC.EAST;
+        testPanel.add( new JLabel(tr("On demand")), GBC.std() );
+        testPanel.add( new JLabel(tr("On upload")), a );
 
-		allTests = OSMValidatorPlugin.getTests();
-		for(Test test: allTests)
-		{
-			test.addGui(testPanel);
-		}
+        allTests = OSMValidatorPlugin.getTests();
+        for(Test test: allTests)
+        {
+            test.addGui(testPanel);
+        }
 
-		JScrollPane testPane = new JScrollPane(testPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
-		testPane.setBorder(null);
+        JScrollPane testPane = new JScrollPane(testPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+        testPane.setBorder(null);
 
-		Version ver = Util.getVersion();
-		String description = tr("A OSM data validator that checks for common errors made by users and editor programs.");
-		if( ver != null )
-			description += "<br>" + tr("Version {0} - Last change at {1}", ver.revision, ver.time);
-		JPanel tab = gui.createPreferenceTab("validator", tr("Data validator"), description);
-		tab.add(testPane, GBC.eol().fill(GBC.BOTH));
-		tab.add(GBC.glue(0,10), a);
-	}
+        Version ver = Util.getVersion();
+        String description = tr("A OSM data validator that checks for common errors made by users and editor programs.");
+        if( ver != null )
+            description += "<br>" + tr("Version {0} - Last change at {1}", ver.revision, ver.time);
+        JPanel tab = gui.createPreferenceTab("validator", tr("Data validator"), description);
+        tab.add(testPane, GBC.eol().fill(GBC.BOTH));
+        tab.add(GBC.glue(0,10), a);
+    }
 
-	public boolean ok()
-	{
-		StringBuilder tests = new StringBuilder();
-		StringBuilder testsBeforeUpload = new StringBuilder();
-		Boolean res = false;
+    public boolean ok()
+    {
+        StringBuilder tests = new StringBuilder();
+        StringBuilder testsBeforeUpload = new StringBuilder();
+        Boolean res = false;
 
-		for (Test test : allTests)
-		{
-			if(test.ok())
-			    res = false;
-			String name = test.getClass().getSimpleName();
-			tests.append( ',' ).append( name ).append( '=' ).append( test.enabled );
-			testsBeforeUpload.append( ',' ).append( name ).append( '=' ).append( test.testBeforeUpload );
-		}
+        for (Test test : allTests)
+        {
+            if(test.ok())
+                res = false;
+            String name = test.getClass().getSimpleName();
+            tests.append( ',' ).append( name ).append( '=' ).append( test.enabled );
+            testsBeforeUpload.append( ',' ).append( name ).append( '=' ).append( test.testBeforeUpload );
+        }
 
-		if (tests.length() > 0 ) tests = tests.deleteCharAt(0);
-		if (testsBeforeUpload.length() > 0 ) testsBeforeUpload = testsBeforeUpload.deleteCharAt(0);
+        if (tests.length() > 0 ) tests = tests.deleteCharAt(0);
+        if (testsBeforeUpload.length() > 0 ) testsBeforeUpload = testsBeforeUpload.deleteCharAt(0);
 
-		plugin.initializeTests( allTests );
+        plugin.initializeTests( allTests );
 
-		Main.pref.put( PREF_TESTS, tests.toString());
-		Main.pref.put( PREF_TESTS_BEFORE_UPLOAD, testsBeforeUpload.toString());
-		Main.pref.put( PREF_USE_IGNORE, prefUseIgnore.isSelected());
-		Main.pref.put( PREF_LAYER, prefUseLayer.isSelected());
-		return false;
-	}
+        Main.pref.put( PREF_TESTS, tests.toString());
+        Main.pref.put( PREF_TESTS_BEFORE_UPLOAD, testsBeforeUpload.toString());
+        Main.pref.put( PREF_USE_IGNORE, prefUseIgnore.isSelected());
+        Main.pref.put( PREF_LAYER, prefUseLayer.isSelected());
+        return false;
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Severity.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Severity.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Severity.java	(revision 12778)
@@ -10,14 +10,14 @@
 /** The error severity */
 public enum Severity {
-	/** Error messages */
-	ERROR(tr("Errors"), "error.gif",       Main.pref.getColor(marktr("validation error"), Color.RED)),
-	/** Warning messages */ 
-	WARNING(tr("Warnings"), "warning.gif", Main.pref.getColor(marktr("validation warning"), Color.YELLOW)), 
-	/** Other messages */ 
-	OTHER(tr("Other"), "other.gif",        Main.pref.getColor(marktr("validation other"), Color.CYAN)); 
-	
-	/** Description of the severity code */
-	private final String message;
-	
+    /** Error messages */
+    ERROR(tr("Errors"), "error.gif",       Main.pref.getColor(marktr("validation error"), Color.RED)),
+    /** Warning messages */
+    WARNING(tr("Warnings"), "warning.gif", Main.pref.getColor(marktr("validation warning"), Color.YELLOW)),
+    /** Other messages */
+    OTHER(tr("Other"), "other.gif",        Main.pref.getColor(marktr("validation other"), Color.CYAN));
+
+    /** Description of the severity code */
+    private final String message;
+
     /** Associated icon */
     private final String icon;
@@ -26,32 +26,32 @@
     private final Color color;
 
-	/**
-	 * Constructor
-	 * 
-	 * @param message Description
-	 * @param icon Associated icon
-	 * @param color The color of this severity
-	 */
-    Severity(String message, String icon, Color color) 
+    /**
+     * Constructor
+     *
+     * @param message Description
+     * @param icon Associated icon
+     * @param color The color of this severity
+     */
+    Severity(String message, String icon, Color color)
     {
         this.message = message;
-		this.icon = icon;
+        this.icon = icon;
         this.color = color;
     }
 
-	@Override
-	public String toString() 
-	{
-		return message;
-	}
+    @Override
+    public String toString()
+    {
+        return message;
+    }
 
-	/** 
-	 * Gets the associated icon
-	 * @return the associated icon
-	 */
-	public String getIcon() 
-	{
-		return icon;
-	}
+    /**
+     * Gets the associated icon
+     * @return the associated icon
+     */
+    public String getIcon()
+    {
+        return icon;
+    }
 
     /**
@@ -63,5 +63,5 @@
         return color;
     }
-    
-    
+
+
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Test.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Test.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Test.java	(revision 12778)
@@ -27,10 +27,10 @@
 public class Test implements Visitor
 {
-	/** Name of the test */
-	protected String name;
-	
-	/** Description of the test */
-	protected String description;
-	
+    /** Name of the test */
+    protected String name;
+    
+    /** Description of the test */
+    protected String description;
+    
     /** Whether this test is enabled. Enabled by default */
     protected boolean enabled = true;
@@ -48,69 +48,69 @@
     protected boolean isBeforeUpload;
 
-	/** The list of errors */
-	protected List<TestError> errors = new ArrayList<TestError>(30);
-
-	/** Whether the test is run on a partial selection data */
-	protected boolean partialSelection;
-
-	/**
-	 * Constructor
-	 * @param name Name of the test
-	 * @param description Description of the test
-	 */
-	public Test(String name, String description)
-	{
-		this.name = name;
-		this.description = description;
-	}
-	
-	/**
-	 * Constructor
-	 * @param name Name of the test
-	 */
-	public Test(String name)
-	{
-		this.name = name;
-	}
-	
-	/**
-	 * Initializes any global data used this tester.
-	 * @param plugin The plugin
-	 * @throws Exception When cannot initialize the test
-	 */ 
-	public static void initialize(OSMValidatorPlugin plugin) throws Exception {}
-	
-	/**
-	 * Notification of the start of the test. The tester can initialize the
-	 * structures it may need for this test
-	 */ 
-	public void startTest() 
-	{
-		errors = new ArrayList<TestError>(30);
-	}
-
-	/**
-	 * Flag notifying that this test is run over a partial data selection
-	 * @param partialSelection Whether the test is on a partial selection data
-	 */ 
-	public void setPartialSelection(boolean partialSelection) 
-	{
-		this.partialSelection = partialSelection;
-	}
-	
-	/**
-	 * Gets the validation errors accumulated until this moment.
-	 * @return The list of errors 
-	 */
-	public List<TestError> getErrors() 
-	{
-		return errors;
-	}
-	
-	/**
-	 * Notification of the end of the test. The tester may perform additional
-	 * actions and destroy the used structures 
-	 */
-	public void endTest() {}
+    /** The list of errors */
+    protected List<TestError> errors = new ArrayList<TestError>(30);
+
+    /** Whether the test is run on a partial selection data */
+    protected boolean partialSelection;
+
+    /**
+     * Constructor
+     * @param name Name of the test
+     * @param description Description of the test
+     */
+    public Test(String name, String description)
+    {
+        this.name = name;
+        this.description = description;
+    }
+    
+    /**
+     * Constructor
+     * @param name Name of the test
+     */
+    public Test(String name)
+    {
+        this.name = name;
+    }
+    
+    /**
+     * Initializes any global data used this tester.
+     * @param plugin The plugin
+     * @throws Exception When cannot initialize the test
+     */ 
+    public static void initialize(OSMValidatorPlugin plugin) throws Exception {}
+    
+    /**
+     * Notification of the start of the test. The tester can initialize the
+     * structures it may need for this test
+     */ 
+    public void startTest() 
+    {
+        errors = new ArrayList<TestError>(30);
+    }
+
+    /**
+     * Flag notifying that this test is run over a partial data selection
+     * @param partialSelection Whether the test is on a partial selection data
+     */ 
+    public void setPartialSelection(boolean partialSelection) 
+    {
+        this.partialSelection = partialSelection;
+    }
+    
+    /**
+     * Gets the validation errors accumulated until this moment.
+     * @return The list of errors 
+     */
+    public List<TestError> getErrors() 
+    {
+        return errors;
+    }
+    
+    /**
+     * Notification of the end of the test. The tester may perform additional
+     * actions and destroy the used structures 
+     */
+    public void endTest() {}
 
     /**
@@ -124,6 +124,6 @@
         for (OsmPrimitive p : selection)
         {
-        	if( !p.deleted && !p.incomplete )
-        		p.visit(this);
+            if( !p.deleted && !p.incomplete )
+                p.visit(this);
         }
     }
@@ -131,56 +131,56 @@
     public void visit(Node n) {}
 
-	public void visit(Way w) {}
-
-	public void visit(Relation r) {}
-
-	/**
-	 * Allow the tester to manage its own preferences 
-	 * @param testPanel The panel to add any preferences component
-	 */
-	public void addGui(JPanel testPanel) 
-	{
-		checkEnabled = new JCheckBox(name, enabled);
-		checkEnabled.setToolTipText(description);
-		testPanel.add(checkEnabled, GBC.std());
-
-		GBC a = GBC.eol();
-		a.anchor = GBC.EAST;
-		checkBeforeUpload = new JCheckBox();
-		checkBeforeUpload.setSelected(testBeforeUpload);
-		testPanel.add(checkBeforeUpload, a);
-	}
-
-	/**
-	 * Called when the used submits the preferences
-	 */
-	public boolean ok()
-	{
-		enabled = checkEnabled.isSelected();
-		testBeforeUpload = checkBeforeUpload.isSelected();
-		return false;
-	}
-	
-	/**
-	 * Fixes the error with the appropiate command
-	 * 
-	 * @param testError
-	 * @return The command to fix the error
-	 */
-	public Command fixError(TestError testError)
-	{
-		return null;
-	}
-	
-	/**
-	 * Returns true if the given error can be fixed automatically
-	 * 
-	 * @param testError The error to check if can be fixed
-	 * @return true if the error can be fixed
-	 */
-	public boolean isFixable(TestError testError)
-	{
-		return false;
-	}
+    public void visit(Way w) {}
+
+    public void visit(Relation r) {}
+
+    /**
+     * Allow the tester to manage its own preferences 
+     * @param testPanel The panel to add any preferences component
+     */
+    public void addGui(JPanel testPanel) 
+    {
+        checkEnabled = new JCheckBox(name, enabled);
+        checkEnabled.setToolTipText(description);
+        testPanel.add(checkEnabled, GBC.std());
+
+        GBC a = GBC.eol();
+        a.anchor = GBC.EAST;
+        checkBeforeUpload = new JCheckBox();
+        checkBeforeUpload.setSelected(testBeforeUpload);
+        testPanel.add(checkBeforeUpload, a);
+    }
+
+    /**
+     * Called when the used submits the preferences
+     */
+    public boolean ok()
+    {
+        enabled = checkEnabled.isSelected();
+        testBeforeUpload = checkBeforeUpload.isSelected();
+        return false;
+    }
+    
+    /**
+     * Fixes the error with the appropiate command
+     * 
+     * @param testError
+     * @return The command to fix the error
+     */
+    public Command fixError(TestError testError)
+    {
+        return null;
+    }
+    
+    /**
+     * Returns true if the given error can be fixed automatically
+     * 
+     * @param testError The error to check if can be fixed
+     * @return true if the error can be fixed
+     */
+    public boolean isFixable(TestError testError)
+    {
+        return false;
+    }
 
     /**
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/TestError.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/TestError.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/TestError.java	(revision 12778)
@@ -372,5 +372,5 @@
          * Checks if the given segment is in the visible area.
          * NOTE: This will return true for a small number of non-visible
-         *		 segments.
+         *       segments.
          * @param ls The segment to check
          * @return true if the segment is visible
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateUploadHook.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateUploadHook.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateUploadHook.java	(revision 12778)
@@ -29,89 +29,89 @@
 public class ValidateUploadHook implements UploadHook
 {
-	/** Serializable ID */
-	private static final long serialVersionUID = -2304521273582574603L;
+    /** Serializable ID */
+    private static final long serialVersionUID = -2304521273582574603L;
 
-	private OSMValidatorPlugin plugin;
+    private OSMValidatorPlugin plugin;
 
-	public ValidateUploadHook(OSMValidatorPlugin plugin)
-	{
-		this.plugin = plugin;
-	}
+    public ValidateUploadHook(OSMValidatorPlugin plugin)
+    {
+        this.plugin = plugin;
+    }
 
-	/**
-	 * Validate the modified data before uploading
-	 */
-	public boolean checkUpload(Collection<OsmPrimitive> add, Collection<OsmPrimitive> update, Collection<OsmPrimitive> delete)
-	{
-		Collection<Test> tests = OSMValidatorPlugin.getEnabledTests(true);
-		if( tests.isEmpty() )
-			return true;
+    /**
+     * Validate the modified data before uploading
+     */
+    public boolean checkUpload(Collection<OsmPrimitive> add, Collection<OsmPrimitive> update, Collection<OsmPrimitive> delete)
+    {
+        Collection<Test> tests = OSMValidatorPlugin.getEnabledTests(true);
+        if( tests.isEmpty() )
+            return true;
 
-		AgregatePrimitivesVisitor v = new AgregatePrimitivesVisitor();
-		v.visit(add);
-		Collection<OsmPrimitive> selection = v.visit(update);
+        AgregatePrimitivesVisitor v = new AgregatePrimitivesVisitor();
+        v.visit(add);
+        Collection<OsmPrimitive> selection = v.visit(update);
 
-		List<TestError> errors = new ArrayList<TestError>(30);
-		for(Test test : tests)
-		{
-			test.setBeforeUpload(true);
-			test.setPartialSelection(true);
-			test.startTest();
-			test.visit(selection);
-			test.endTest();
-			errors.addAll( test.getErrors() );
-		}
-		tests = null;
-		if(errors == null || errors.isEmpty())
-			return true;
+        List<TestError> errors = new ArrayList<TestError>(30);
+        for(Test test : tests)
+        {
+            test.setBeforeUpload(true);
+            test.setPartialSelection(true);
+            test.startTest();
+            test.visit(selection);
+            test.endTest();
+            errors.addAll( test.getErrors() );
+        }
+        tests = null;
+        if(errors == null || errors.isEmpty())
+            return true;
 
-		if(Main.pref.getBoolean(PreferenceEditor.PREF_USE_IGNORE, true))
-		{
-			int nume = 0;
-			for(TestError error : errors)
-			{
-				List<String> s = new ArrayList<String>();
-				s.add(error.getIgnoreState());
-				s.add(error.getIgnoreGroup());
-				s.add(error.getIgnoreSubGroup());
-				for(String state : s)
-				{
-					if(state != null && plugin.ignoredErrors.contains(state))
-					{
-						error.setIgnored(true);
-					}
-				}
-				if(!error.getIgnored())
-					++nume;
-			}
-			if(nume == 0)
-				return true;
-		}
-		return displayErrorScreen(errors);
-	}
+        if(Main.pref.getBoolean(PreferenceEditor.PREF_USE_IGNORE, true))
+        {
+            int nume = 0;
+            for(TestError error : errors)
+            {
+                List<String> s = new ArrayList<String>();
+                s.add(error.getIgnoreState());
+                s.add(error.getIgnoreGroup());
+                s.add(error.getIgnoreSubGroup());
+                for(String state : s)
+                {
+                    if(state != null && plugin.ignoredErrors.contains(state))
+                    {
+                        error.setIgnored(true);
+                    }
+                }
+                if(!error.getIgnored())
+                    ++nume;
+            }
+            if(nume == 0)
+                return true;
+        }
+        return displayErrorScreen(errors);
+    }
 
-	/**
-	 * Displays a screen where the actions that would be taken are displayed and
-	 * give the user the possibility to cancel the upload.
-	 * @param errors The errors displayed in the screen
-	 * @return <code>true</code>, if the upload should continue. <code>false</code>
-	 *          if the user requested cancel.
-	 */
-	private boolean displayErrorScreen(List<TestError> errors)
-	{
-		JPanel p = new JPanel(new GridBagLayout());
-		ErrorTreePanel errorPanel = new ErrorTreePanel(errors);
-		errorPanel.expandAll();
-		p.add(new JScrollPane(errorPanel), GBC.eol());
+    /**
+     * Displays a screen where the actions that would be taken are displayed and
+     * give the user the possibility to cancel the upload.
+     * @param errors The errors displayed in the screen
+     * @return <code>true</code>, if the upload should continue. <code>false</code>
+     *          if the user requested cancel.
+     */
+    private boolean displayErrorScreen(List<TestError> errors)
+    {
+        JPanel p = new JPanel(new GridBagLayout());
+        ErrorTreePanel errorPanel = new ErrorTreePanel(errors);
+        errorPanel.expandAll();
+        p.add(new JScrollPane(errorPanel), GBC.eol());
 
-		int res  = JOptionPane.showConfirmDialog(Main.parent, p,
-		tr("Data with errors. Upload anyway?"), JOptionPane.YES_NO_OPTION);
-		if(res == JOptionPane.NO_OPTION)
-		{
-			plugin.validationDialog.tree.setErrors(errors);
-			plugin.validationDialog.setVisible(true);
-			DataSet.fireSelectionChanged(Main.ds.getSelected());
-		}
-		return res == JOptionPane.YES_OPTION;
-	}
+        int res  = JOptionPane.showConfirmDialog(Main.parent, p,
+        tr("Data with errors. Upload anyway?"), JOptionPane.YES_NO_OPTION);
+        if(res == JOptionPane.NO_OPTION)
+        {
+            plugin.validationDialog.tree.setErrors(errors);
+            plugin.validationDialog.setVisible(true);
+            DataSet.fireSelectionChanged(Main.ds.getSelected());
+        }
+        return res == JOptionPane.YES_OPTION;
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java	(revision 12778)
@@ -22,63 +22,63 @@
  */
 public class ChangePropertyKeyCommand extends Command {
-	/**
-	 * All primitives, that are affected with this command.
-	 */
-	private final List<OsmPrimitive> objects;
-	/**
-	 * The key that is subject to change.
-	 */
-	private final String key;
-	/**
-	 * The mew key.
-	 */
-	private final String newKey;
-	
-	/**
-	 * Constructor
-	 * 
-	 * @param objects all objects subject to change replacement
-	 * @param key The key to replace
-	 * @param newKey the new value of the key
-	 */
-	public ChangePropertyKeyCommand(Collection<? extends OsmPrimitive> objects, String key, String newKey) {
-		this.objects = new LinkedList<OsmPrimitive>(objects);
-		this.key = key;
-		this.newKey = newKey;
-	}
-	
-	@Override public boolean executeCommand() {
-		if (!super.executeCommand()) return false; // save old
-		for (OsmPrimitive osm : objects) {
-			if(osm.keys != null) 
-			{
-				osm.modified = true;
-				osm.put(newKey, osm.keys.remove(key) );
-			}
-		}
+    /**
+     * All primitives, that are affected with this command.
+     */
+    private final List<OsmPrimitive> objects;
+    /**
+     * The key that is subject to change.
+     */
+    private final String key;
+    /**
+     * The mew key.
+     */
+    private final String newKey;
+    
+    /**
+     * Constructor
+     * 
+     * @param objects all objects subject to change replacement
+     * @param key The key to replace
+     * @param newKey the new value of the key
+     */
+    public ChangePropertyKeyCommand(Collection<? extends OsmPrimitive> objects, String key, String newKey) {
+        this.objects = new LinkedList<OsmPrimitive>(objects);
+        this.key = key;
+        this.newKey = newKey;
+    }
+    
+    @Override public boolean executeCommand() {
+        if (!super.executeCommand()) return false; // save old
+        for (OsmPrimitive osm : objects) {
+            if(osm.keys != null) 
+            {
+                osm.modified = true;
+                osm.put(newKey, osm.keys.remove(key) );
+            }
+        }
         return true;
-	}
+    }
 
-	@Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
-		modified.addAll(objects);
-	}
+    @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
+        modified.addAll(objects);
+    }
 
-	@Override public MutableTreeNode description() {
-		String text = tr( "Replace \"{0}\" by \"{1}\" for", key, newKey);
-		if (objects.size() == 1) {
-			NameVisitor v = new NameVisitor();
-			objects.iterator().next().visit(v);
-			text += " "+tr(v.className)+" "+v.name;
-		} else
-			text += " "+objects.size()+" "+trn("object","objects",objects.size());
-		DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel(text, ImageProvider.get("data", "key"), JLabel.HORIZONTAL));
-		if (objects.size() == 1)
-			return root;
-		NameVisitor v = new NameVisitor();
-		for (OsmPrimitive osm : objects) {
-			osm.visit(v);
-			root.add(new DefaultMutableTreeNode(v.toLabel()));
-		}
-		return root;
+    @Override public MutableTreeNode description() {
+        String text = tr( "Replace \"{0}\" by \"{1}\" for", key, newKey);
+        if (objects.size() == 1) {
+            NameVisitor v = new NameVisitor();
+            objects.iterator().next().visit(v);
+            text += " "+tr(v.className)+" "+v.name;
+        } else
+            text += " "+objects.size()+" "+trn("object","objects",objects.size());
+        DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel(text, ImageProvider.get("data", "key"), JLabel.HORIZONTAL));
+        if (objects.size() == 1)
+            return root;
+        NameVisitor v = new NameVisitor();
+        for (OsmPrimitive osm : objects) {
+            osm.visit(v);
+            root.add(new DefaultMutableTreeNode(v.toLabel()));
+        }
+        return root;
     }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/Coastlines.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/Coastlines.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/Coastlines.java	(revision 12778)
@@ -21,67 +21,67 @@
 public class Coastlines extends Test
 {
-	protected static int UNORDERED_COASTLINES = 901;
+    protected static int UNORDERED_COASTLINES = 901;
 
-	/** All ways, grouped by cells */
-	Map<Point2D,List<Way>> _cellWays;
-	/** The already detected errors */
-	Bag<Way, Way> _errorWays;
+    /** All ways, grouped by cells */
+    Map<Point2D,List<Way>> _cellWays;
+    /** The already detected errors */
+    Bag<Way, Way> _errorWays;
 
-	/**
-	 * Constructor
-	 */
-	public Coastlines()
-	{
-		super(tr("Coastlines."),
-			  tr("This test checks that coastlines are correct."));
-	}
+    /**
+     * Constructor
+     */
+    public Coastlines()
+    {
+        super(tr("Coastlines."),
+              tr("This test checks that coastlines are correct."));
+    }
 
-	@Override
-	public void startTest()
-	{
-		_cellWays = new HashMap<Point2D,List<Way>>(1000);
-		_errorWays = new Bag<Way, Way>();
-	}
+    @Override
+    public void startTest()
+    {
+        _cellWays = new HashMap<Point2D,List<Way>>(1000);
+        _errorWays = new Bag<Way, Way>();
+    }
 
-	@Override
-	public void endTest()
-	{
-		_cellWays = null;
-		_errorWays = null;
-	}
+    @Override
+    public void endTest()
+    {
+        _cellWays = null;
+        _errorWays = null;
+    }
 
-	@Override
-	public void visit(Way w)
-	{
-		if( w.deleted || w.incomplete )
-			return;
+    @Override
+    public void visit(Way w)
+    {
+        if( w.deleted || w.incomplete )
+            return;
 
-		String natural = w.get("natural");
-		if( natural == null || !natural.equals("coastline") )
-			return;
+        String natural = w.get("natural");
+        if( natural == null || !natural.equals("coastline") )
+            return;
 
-		List<List<Way>> cellWays = Util.getWaysInCell(w, _cellWays);
-		for( List<Way> ways : cellWays)
-		{
-			for( Way w2 : ways)
-			{
-				if( _errorWays.contains(w, w2) || _errorWays.contains(w2, w) )
-					continue;
+        List<List<Way>> cellWays = Util.getWaysInCell(w, _cellWays);
+        for( List<Way> ways : cellWays)
+        {
+            for( Way w2 : ways)
+            {
+                if( _errorWays.contains(w, w2) || _errorWays.contains(w2, w) )
+                    continue;
 
-				String natural2 = w.get("natural");
-				if( natural2 == null || !natural2.equals("coastline") )
-					continue;
+                String natural2 = w.get("natural");
+                if( natural2 == null || !natural2.equals("coastline") )
+                    continue;
 
-				if( w.nodes.get(0).equals(w2.nodes.get(0)) || w.nodes.get(w.nodes.size() - 1).equals(w2.nodes.get(w2.nodes.size() - 1)))
-				{
-					List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
-					primitives.add(w);
-					primitives.add(w2);
-					errors.add( new TestError(this, Severity.ERROR, tr("Unordered coastline"), UNORDERED_COASTLINES, primitives) );
-					_errorWays.add(w, w2);
-				}
-			}
-			ways.add(w);
-		}
-	}
+                if( w.nodes.get(0).equals(w2.nodes.get(0)) || w.nodes.get(w.nodes.size() - 1).equals(w2.nodes.get(w2.nodes.size() - 1)))
+                {
+                    List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
+                    primitives.add(w);
+                    primitives.add(w2);
+                    errors.add( new TestError(this, Severity.ERROR, tr("Unordered coastline"), UNORDERED_COASTLINES, primitives) );
+                    _errorWays.add(w, w2);
+                }
+            }
+            ways.add(w);
+        }
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/CrossingWays.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/CrossingWays.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/CrossingWays.java	(revision 12778)
@@ -28,184 +28,184 @@
 public class CrossingWays extends Test
 {
-	protected static int CROSSING_WAYS = 601;
-
-	/** All way segments, grouped by cells */
-	Map<Point2D,List<ExtendedSegment>> cellSegments;
-	/** The already detected errors */
-	HashSet<WaySegment> errorSegments;
-	/** The already detected ways in error */
-	Map<List<Way>, List<WaySegment>> ways_seen;
-
-
-	/**
-	 * Constructor
-	 */
-	public CrossingWays()
-	{
-		super(tr("Crossing ways."),
-			  tr("This test checks if two roads, railways or waterways crosses in the same layer, but are not connected by a node."));
-	}
-
-
-	@Override
-	public void startTest()
-	{
-		cellSegments = new HashMap<Point2D,List<ExtendedSegment>>(1000);
-		errorSegments = new HashSet<WaySegment>();
-		ways_seen = new HashMap<List<Way>, List<WaySegment>>(50);
-	}
-
-	@Override
-	public void endTest()
-	{
-		cellSegments = null;
-		errorSegments = null;
-		ways_seen = null;
-	}
-
-	@Override
-	public void visit(Way w)
-	{
-		if( w.deleted || w.incomplete )
-			return;
-
-		String coastline1 = w.get("natural");
-		boolean isCoastline1 = coastline1 != null && (coastline1.equals("water") || coastline1.equals("coastline"));
-		String railway1 = w.get("railway");
-		boolean isSubway1 = railway1 != null && railway1.equals("subway");
-		if( w.get("highway") == null && w.get("waterway") == null && (railway1 == null || isSubway1)  && !isCoastline1)
-			return;
-
-		String layer1 = w.get("layer");
-
-		int nodesSize = w.nodes.size();
-		for (int i = 0; i < nodesSize - 1; i++) {
-			WaySegment ws = new WaySegment(w, i);
-			ExtendedSegment es1 = new ExtendedSegment(ws, layer1, railway1, coastline1);
-			List<List<ExtendedSegment>> cellSegments = getSegments(es1.n1, es1.n2);
-			for( List<ExtendedSegment> segments : cellSegments)
-			{
-				for( ExtendedSegment es2 : segments)
-				{
-					List<Way> prims;
-					List<WaySegment> highlight;
-
-					if (errorSegments.contains(ws) && errorSegments.contains(es2.ws))
-						continue;
-
-					String layer2 = es2.layer;
-					String railway2 = es2.railway;
-					String coastline2 = es2.coastline;
-					if (layer1 == null ? layer2 != null : !layer1.equals(layer2))
-						continue;
-
-					if( !es1.intersects(es2) ) continue;
-					if( isSubway1 && "subway".equals(railway2)) continue;
-
-					boolean isCoastline2 = coastline2 != null && (coastline2.equals("water") || coastline2.equals("coastline"));
-					if( isCoastline1 != isCoastline2 ) continue;
-
-					prims = Arrays.asList(es1.ws.way, es2.ws.way);
-					if ((highlight = ways_seen.get(prims)) == null)
-					{
-						highlight = new ArrayList<WaySegment>();
-						highlight.add(es1.ws);
-						highlight.add(es2.ws);
-
-						errors.add(new TestError(this, Severity.WARNING,
-						tr("Crossing ways"), CROSSING_WAYS, prims, highlight));
-						ways_seen.put(prims, highlight);
-					}
-					else
-					{
-						highlight.add(es1.ws);
-						highlight.add(es2.ws);
-					}
-				}
-				segments.add(es1);
-			}
-		}
-	}
-
-	/**
-	* Returns all the cells this segment crosses.  Each cell contains the list
-	* of segments already processed
-	*
-	* @param n1 The first node
-	* @param n2 The second node
-	* @return A list with all the cells the segment crosses
-	*/
-	public List<List<ExtendedSegment>> getSegments(Node n1, Node n2)
-	{
-		List<List<ExtendedSegment>> cells = new ArrayList<List<ExtendedSegment>>();
-		for( Point2D cell : Util.getSegmentCells(n1, n2, OSMValidatorPlugin.griddetail) )
-		{
-			List<ExtendedSegment> segments = cellSegments.get( cell );
-			if( segments == null )
-			{
-				segments = new ArrayList<ExtendedSegment>();
-				cellSegments.put(cell, segments);
-			}
-			cells.add(segments);
-		}
-
-		return cells;
-	}
-
-	/**
-	 * A way segment with some additional information
-	 * @author frsantos
-	 */
-	private class ExtendedSegment
-	{
-		public Node n1, n2;
-
-		public WaySegment ws;
-
-		/** The layer */
-		public String layer;
-
-		/** The railway type */
-		public String railway;
-
-		/** The coastline type */
-		public String coastline;
-
-		/**
-		 * Constructor
-		 * @param ws The way segment
-		 * @param layer The layer of the way this segment is in
-		 * @param railway The railway type of the way this segment is in
-		 * @param coastline The coastlyne typo of the way the segment is in
-		 */
-		public ExtendedSegment(WaySegment ws, String layer, String railway, String coastline)
-		{
-			this.ws = ws;
-			this.n1 = ws.way.nodes.get(ws.lowerIndex);
-			this.n2 = ws.way.nodes.get(ws.lowerIndex + 1);
-			this.layer = layer;
-			this.railway = railway;
-			this.coastline = coastline;
-		}
-
-		/**
-		 * Checks whether this segment crosses other segment
-		 * @param s2 The other segment
-		 * @return true if both segements crosses
-		 */
-		public boolean intersects(ExtendedSegment s2)
-		{
-			if( n1.equals(s2.n1) || n2.equals(s2.n2) ||
-				n1.equals(s2.n2)   || n2.equals(s2.n1) )
-			{
-				return false;
-			}
-
-			return Line2D.linesIntersect(
-				n1.eastNorth.east(), n1.eastNorth.north(),
-				n2.eastNorth.east(), n2.eastNorth.north(),
-				s2.n1.eastNorth.east(), s2.n1.eastNorth.north(),
-				s2.n2.eastNorth.east(), s2.n2.eastNorth.north());
-		}
-	}
+    protected static int CROSSING_WAYS = 601;
+
+    /** All way segments, grouped by cells */
+    Map<Point2D,List<ExtendedSegment>> cellSegments;
+    /** The already detected errors */
+    HashSet<WaySegment> errorSegments;
+    /** The already detected ways in error */
+    Map<List<Way>, List<WaySegment>> ways_seen;
+
+
+    /**
+     * Constructor
+     */
+    public CrossingWays()
+    {
+        super(tr("Crossing ways."),
+              tr("This test checks if two roads, railways or waterways crosses in the same layer, but are not connected by a node."));
+    }
+
+
+    @Override
+    public void startTest()
+    {
+        cellSegments = new HashMap<Point2D,List<ExtendedSegment>>(1000);
+        errorSegments = new HashSet<WaySegment>();
+        ways_seen = new HashMap<List<Way>, List<WaySegment>>(50);
+    }
+
+    @Override
+    public void endTest()
+    {
+        cellSegments = null;
+        errorSegments = null;
+        ways_seen = null;
+    }
+
+    @Override
+    public void visit(Way w)
+    {
+        if( w.deleted || w.incomplete )
+            return;
+
+        String coastline1 = w.get("natural");
+        boolean isCoastline1 = coastline1 != null && (coastline1.equals("water") || coastline1.equals("coastline"));
+        String railway1 = w.get("railway");
+        boolean isSubway1 = railway1 != null && railway1.equals("subway");
+        if( w.get("highway") == null && w.get("waterway") == null && (railway1 == null || isSubway1)  && !isCoastline1)
+            return;
+
+        String layer1 = w.get("layer");
+
+        int nodesSize = w.nodes.size();
+        for (int i = 0; i < nodesSize - 1; i++) {
+            WaySegment ws = new WaySegment(w, i);
+            ExtendedSegment es1 = new ExtendedSegment(ws, layer1, railway1, coastline1);
+            List<List<ExtendedSegment>> cellSegments = getSegments(es1.n1, es1.n2);
+            for( List<ExtendedSegment> segments : cellSegments)
+            {
+                for( ExtendedSegment es2 : segments)
+                {
+                    List<Way> prims;
+                    List<WaySegment> highlight;
+
+                    if (errorSegments.contains(ws) && errorSegments.contains(es2.ws))
+                        continue;
+
+                    String layer2 = es2.layer;
+                    String railway2 = es2.railway;
+                    String coastline2 = es2.coastline;
+                    if (layer1 == null ? layer2 != null : !layer1.equals(layer2))
+                        continue;
+
+                    if( !es1.intersects(es2) ) continue;
+                    if( isSubway1 && "subway".equals(railway2)) continue;
+
+                    boolean isCoastline2 = coastline2 != null && (coastline2.equals("water") || coastline2.equals("coastline"));
+                    if( isCoastline1 != isCoastline2 ) continue;
+
+                    prims = Arrays.asList(es1.ws.way, es2.ws.way);
+                    if ((highlight = ways_seen.get(prims)) == null)
+                    {
+                        highlight = new ArrayList<WaySegment>();
+                        highlight.add(es1.ws);
+                        highlight.add(es2.ws);
+
+                        errors.add(new TestError(this, Severity.WARNING,
+                        tr("Crossing ways"), CROSSING_WAYS, prims, highlight));
+                        ways_seen.put(prims, highlight);
+                    }
+                    else
+                    {
+                        highlight.add(es1.ws);
+                        highlight.add(es2.ws);
+                    }
+                }
+                segments.add(es1);
+            }
+        }
+    }
+
+    /**
+    * Returns all the cells this segment crosses.  Each cell contains the list
+    * of segments already processed
+    *
+    * @param n1 The first node
+    * @param n2 The second node
+    * @return A list with all the cells the segment crosses
+    */
+    public List<List<ExtendedSegment>> getSegments(Node n1, Node n2)
+    {
+        List<List<ExtendedSegment>> cells = new ArrayList<List<ExtendedSegment>>();
+        for( Point2D cell : Util.getSegmentCells(n1, n2, OSMValidatorPlugin.griddetail) )
+        {
+            List<ExtendedSegment> segments = cellSegments.get( cell );
+            if( segments == null )
+            {
+                segments = new ArrayList<ExtendedSegment>();
+                cellSegments.put(cell, segments);
+            }
+            cells.add(segments);
+        }
+
+        return cells;
+    }
+
+    /**
+     * A way segment with some additional information
+     * @author frsantos
+     */
+    private class ExtendedSegment
+    {
+        public Node n1, n2;
+
+        public WaySegment ws;
+
+        /** The layer */
+        public String layer;
+
+        /** The railway type */
+        public String railway;
+
+        /** The coastline type */
+        public String coastline;
+
+        /**
+         * Constructor
+         * @param ws The way segment
+         * @param layer The layer of the way this segment is in
+         * @param railway The railway type of the way this segment is in
+         * @param coastline The coastlyne typo of the way the segment is in
+         */
+        public ExtendedSegment(WaySegment ws, String layer, String railway, String coastline)
+        {
+            this.ws = ws;
+            this.n1 = ws.way.nodes.get(ws.lowerIndex);
+            this.n2 = ws.way.nodes.get(ws.lowerIndex + 1);
+            this.layer = layer;
+            this.railway = railway;
+            this.coastline = coastline;
+        }
+
+        /**
+         * Checks whether this segment crosses other segment
+         * @param s2 The other segment
+         * @return true if both segements crosses
+         */
+        public boolean intersects(ExtendedSegment s2)
+        {
+            if( n1.equals(s2.n1) || n2.equals(s2.n2) ||
+                n1.equals(s2.n2)   || n2.equals(s2.n1) )
+            {
+                return false;
+            }
+
+            return Line2D.linesIntersect(
+                n1.eastNorth.east(), n1.eastNorth.north(),
+                n2.eastNorth.east(), n2.eastNorth.north(),
+                s2.n1.eastNorth.east(), s2.n1.eastNorth.north(),
+                s2.n2.eastNorth.east(), s2.n2.eastNorth.north());
+        }
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateNode.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateNode.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateNode.java	(revision 12778)
@@ -20,55 +20,55 @@
 public class DuplicateNode extends Test
 {
-	protected static int DUPLICATE_NODE = 1;
+    protected static int DUPLICATE_NODE = 1;
 
-	/** Bag of all nodes */
-	Bag<LatLon, OsmPrimitive> nodes;
+    /** Bag of all nodes */
+    Bag<LatLon, OsmPrimitive> nodes;
 
-	/**
-	 * Constructor
-	 */
-	public DuplicateNode()
-	{
-		super(tr("Duplicated nodes."),
-			  tr("This test checks that there are no nodes at the very same location."));
-	}
+    /**
+     * Constructor
+     */
+    public DuplicateNode()
+    {
+        super(tr("Duplicated nodes."),
+              tr("This test checks that there are no nodes at the very same location."));
+    }
 
 
-	@Override
-	public void startTest()
-	{
-		nodes = new Bag<LatLon, OsmPrimitive>(1000);
-	}
+    @Override
+    public void startTest()
+    {
+        nodes = new Bag<LatLon, OsmPrimitive>(1000);
+    }
 
-	@Override
-	public void endTest()
-	{
-		for(List<OsmPrimitive> duplicated : nodes.values() )
-		{
-			if( duplicated.size() > 1)
-			{
-				TestError testError = new TestError(this, Severity.ERROR, tr("Duplicated nodes"), DUPLICATE_NODE, duplicated);
-				errors.add( testError );
-			}
-		}
-		nodes = null;
-	}
+    @Override
+    public void endTest()
+    {
+        for(List<OsmPrimitive> duplicated : nodes.values() )
+        {
+            if( duplicated.size() > 1)
+            {
+                TestError testError = new TestError(this, Severity.ERROR, tr("Duplicated nodes"), DUPLICATE_NODE, duplicated);
+                errors.add( testError );
+            }
+        }
+        nodes = null;
+    }
 
-	@Override
-	public void visit(Node n)
-	{
-		if(!n.deleted && !n.incomplete)
-			nodes.add(n.coor, n);
-	}
+    @Override
+    public void visit(Node n)
+    {
+        if(!n.deleted && !n.incomplete)
+            nodes.add(n.coor, n);
+    }
 
-	/**
-	 * Merge the nodes into one.
-	 * Copied from UtilsPlugin.MergePointsAction
-	 */
-	@Override
-	public Command fixError(TestError testError)
-	{
-		Collection<? extends OsmPrimitive> sel = testError.getPrimitives();
-		LinkedList<Node> nodes = new LinkedList<Node>();
+    /**
+     * Merge the nodes into one.
+     * Copied from UtilsPlugin.MergePointsAction
+     */
+    @Override
+    public Command fixError(TestError testError)
+    {
+        Collection<? extends OsmPrimitive> sel = testError.getPrimitives();
+        LinkedList<Node> nodes = new LinkedList<Node>();
 
         for (OsmPrimitive osm : sel)
@@ -80,5 +80,5 @@
 
         Node target = null;
-		// select the target node in the same way as in the core action MergeNodesAction, rev.1084
+        // select the target node in the same way as in the core action MergeNodesAction, rev.1084
         for (Node n: nodes) {
             if (n.id > 0) {
@@ -93,10 +93,10 @@
 
         return null; // undoRedo handling done in mergeNodes
-	}
+    }
 
-	@Override
-	public boolean isFixable(TestError testError)
-	{
-		return (testError.getTester() instanceof DuplicateNode);
-	}
+    @Override
+    public boolean isFixable(TestError testError)
+    {
+        return (testError.getTester() instanceof DuplicateNode);
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicatedWayNodes.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicatedWayNodes.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicatedWayNodes.java	(revision 12778)
@@ -16,54 +16,54 @@
 
 public class DuplicatedWayNodes extends Test {
-	protected static int DUPLICATE_WAY_NODE = 501;
+    protected static int DUPLICATE_WAY_NODE = 501;
 
-	public DuplicatedWayNodes() {
-		super(tr("Duplicated way nodes."),
-			tr("Checks for ways with identical consecutive nodes."));
-	}
+    public DuplicatedWayNodes() {
+        super(tr("Duplicated way nodes."),
+            tr("Checks for ways with identical consecutive nodes."));
+    }
 
-	@Override public void visit(Way w) {
-		if (w.deleted || w.incomplete) return;
+    @Override public void visit(Way w) {
+        if (w.deleted || w.incomplete) return;
 
-		Node lastN = null;
-		for (Node n : w.nodes) {
-			if (lastN == null) {
-				lastN = n;
-				continue;
-			}
-			if (lastN == n) {
-				errors.add(new TestError(this, Severity.ERROR, tr("Duplicated way nodes"), DUPLICATE_WAY_NODE,
-					Arrays.asList(w), Arrays.asList(n)));
-				break;
-			}
-			lastN = n;
-		}
-	}
+        Node lastN = null;
+        for (Node n : w.nodes) {
+            if (lastN == null) {
+                lastN = n;
+                continue;
+            }
+            if (lastN == n) {
+                errors.add(new TestError(this, Severity.ERROR, tr("Duplicated way nodes"), DUPLICATE_WAY_NODE,
+                    Arrays.asList(w), Arrays.asList(n)));
+                break;
+            }
+            lastN = n;
+        }
+    }
 
-	@Override public Command fixError(TestError testError) {
-		Way w = (Way) testError.getPrimitives().iterator().next();
-		Way wnew = new Way(w);
-		wnew.nodes.clear();
-		Node lastN = null;
-		for (Node n : w.nodes) {
-			if (lastN == null) {
-				wnew.nodes.add(n);
-			} else if (n == lastN) {
-				// Skip this node
-			} else {
-				wnew.nodes.add(n);
-			}
-			lastN = n;
-		}
-		if (wnew.nodes.size() < 2) {
-			// Empty way, delete
-			return DeleteCommand.delete(Collections.singleton(w));
-		} else {
-			return new ChangeCommand(w, wnew);
-		}
-	}
+    @Override public Command fixError(TestError testError) {
+        Way w = (Way) testError.getPrimitives().iterator().next();
+        Way wnew = new Way(w);
+        wnew.nodes.clear();
+        Node lastN = null;
+        for (Node n : w.nodes) {
+            if (lastN == null) {
+                wnew.nodes.add(n);
+            } else if (n == lastN) {
+                // Skip this node
+            } else {
+                wnew.nodes.add(n);
+            }
+            lastN = n;
+        }
+        if (wnew.nodes.size() < 2) {
+            // Empty way, delete
+            return DeleteCommand.delete(Collections.singleton(w));
+        } else {
+            return new ChangeCommand(w, wnew);
+        }
+    }
 
-	@Override public boolean isFixable(TestError testError) {
-		return testError.getTester() instanceof DuplicatedWayNodes;
-	}	
+    @Override public boolean isFixable(TestError testError) {
+        return testError.getTester() instanceof DuplicatedWayNodes;
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/NodesWithSameName.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/NodesWithSameName.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/NodesWithSameName.java	(revision 12778)
@@ -14,40 +14,40 @@
 
 public class NodesWithSameName extends Test {
-	protected static int SAME_NAME = 801;
+    protected static int SAME_NAME = 801;
 
-	private Map<String, List<Node>> namesToNodes;
+    private Map<String, List<Node>> namesToNodes;
 
-	public NodesWithSameName() {
-		super(tr("Nodes with same name"),
-			tr("This test finds nodes that have the same name (might be duplicates)."));
-	}
+    public NodesWithSameName() {
+        super(tr("Nodes with same name"),
+            tr("This test finds nodes that have the same name (might be duplicates)."));
+    }
 
-	@Override public void startTest() {
-		namesToNodes = new HashMap<String, List<Node>>();
-	}
+    @Override public void startTest() {
+        namesToNodes = new HashMap<String, List<Node>>();
+    }
 
-	@Override public void visit(Node n) {
-		if (n.deleted || n.incomplete) return;
+    @Override public void visit(Node n) {
+        if (n.deleted || n.incomplete) return;
 
-		String name = n.get("name");
-		String sign = n.get("traffic_sign");
-		if (name == null || (sign != null && sign.equals("city_limit"))) return;
+        String name = n.get("name");
+        String sign = n.get("traffic_sign");
+        if (name == null || (sign != null && sign.equals("city_limit"))) return;
 
-		List<Node> nodes = namesToNodes.get(name);
-		if (nodes == null)
-			namesToNodes.put(name, nodes = new ArrayList<Node>());
+        List<Node> nodes = namesToNodes.get(name);
+        if (nodes == null)
+            namesToNodes.put(name, nodes = new ArrayList<Node>());
 
-		nodes.add(n);
-	}
+        nodes.add(n);
+    }
 
-	@Override public void endTest() {
-		for (List<Node> nodes : namesToNodes.values()) {
-			if (nodes.size() > 1) {
-				errors.add(new TestError(this, Severity.OTHER,
-					tr("Nodes with same name"), SAME_NAME, nodes));
-			}
-		}
+    @Override public void endTest() {
+        for (List<Node> nodes : namesToNodes.values()) {
+            if (nodes.size() > 1) {
+                errors.add(new TestError(this, Severity.OTHER,
+                    tr("Nodes with same name"), SAME_NAME, nodes));
+            }
+        }
 
-		namesToNodes = null;
-	}
+        namesToNodes = null;
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/OverlappingWays.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/OverlappingWays.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/OverlappingWays.java	(revision 12778)
@@ -21,150 +21,150 @@
 /**
  * Tests if there are overlapping ways
- * 
+ *
  * @author frsantos
  */
 public class OverlappingWays extends Test
 {
-	/** Bag of all way segments */
-	Bag<Pair<Node,Node>, WaySegment> nodePairs;
+    /** Bag of all way segments */
+    Bag<Pair<Node,Node>, WaySegment> nodePairs;
 
-	protected static int OVERLAPPING_HIGHWAY = 101;
-	protected static int OVERLAPPING_RAILWAY = 102;
-	protected static int OVERLAPPING_WAY = 103;
-	protected static int OVERLAPPING_HIGHWAY_AREA = 111;
-	protected static int OVERLAPPING_RAILWAY_AREA = 112;
-	protected static int OVERLAPPING_WAY_AREA = 113;
-	protected static int OVERLAPPING_AREA = 120;
+    protected static int OVERLAPPING_HIGHWAY = 101;
+    protected static int OVERLAPPING_RAILWAY = 102;
+    protected static int OVERLAPPING_WAY = 103;
+    protected static int OVERLAPPING_HIGHWAY_AREA = 111;
+    protected static int OVERLAPPING_RAILWAY_AREA = 112;
+    protected static int OVERLAPPING_WAY_AREA = 113;
+    protected static int OVERLAPPING_AREA = 120;
 
-	/** Constructor */
-	public OverlappingWays()
-	{
-		super(tr("Overlapping ways."),
-			  tr("This test checks that a connection between two nodes "
-				+ "is not used by more than one way."));
-		
-	}
+    /** Constructor */
+    public OverlappingWays()
+    {
+        super(tr("Overlapping ways."),
+              tr("This test checks that a connection between two nodes "
+                + "is not used by more than one way."));
+
+    }
 
 
-	@Override
-	public void startTest() 
-	{
-		nodePairs = new Bag<Pair<Node,Node>, WaySegment>(1000);
-	}
+    @Override
+    public void startTest()
+    {
+        nodePairs = new Bag<Pair<Node,Node>, WaySegment>(1000);
+    }
 
-	@Override
-	public void endTest()
-	{
-		Map<List<Way>, List<WaySegment>> ways_seen = new HashMap<List<Way>, List<WaySegment>>(500);
+    @Override
+    public void endTest()
+    {
+        Map<List<Way>, List<WaySegment>> ways_seen = new HashMap<List<Way>, List<WaySegment>>(500);
 
-		for (List<WaySegment> duplicated : nodePairs.values())
-		{
-			int ways = duplicated.size();
+        for (List<WaySegment> duplicated : nodePairs.values())
+        {
+            int ways = duplicated.size();
 
-			if (ways > 1)
-			{
-				List<OsmPrimitive> prims = new ArrayList<OsmPrimitive>();
-				List<Way> current_ways = new ArrayList<Way>();
-				List<WaySegment> highlight;
-				int highway = 0;
-				int railway = 0;
-				int area = 0;
+            if (ways > 1)
+            {
+                List<OsmPrimitive> prims = new ArrayList<OsmPrimitive>();
+                List<Way> current_ways = new ArrayList<Way>();
+                List<WaySegment> highlight;
+                int highway = 0;
+                int railway = 0;
+                int area = 0;
 
-				for (WaySegment ws : duplicated) 
-				{
-					if (ws.way.get("highway") != null)
-						highway++;
-					else if (ws.way.get("railway") != null)
-						railway++;
-					Boolean ar = OsmUtils.getOsmBoolean(ws.way.get("area"));
-					if (ar != null && ar)
-						area++;
-					if (ws.way.get("landuse") != null || ws.way.get("natural") != null
-					|| ws.way.get("amenity") != null || ws.way.get("leisure") != null
-					|| ws.way.get("building") != null)
-					{
-						area++; ways--;
-					}
+                for (WaySegment ws : duplicated)
+                {
+                    if (ws.way.get("highway") != null)
+                        highway++;
+                    else if (ws.way.get("railway") != null)
+                        railway++;
+                    Boolean ar = OsmUtils.getOsmBoolean(ws.way.get("area"));
+                    if (ar != null && ar)
+                        area++;
+                    if (ws.way.get("landuse") != null || ws.way.get("natural") != null
+                    || ws.way.get("amenity") != null || ws.way.get("leisure") != null
+                    || ws.way.get("building") != null)
+                    {
+                        area++; ways--;
+                    }
 
-					prims.add(ws.way);
-					current_ways.add(ws.way);
-				}
-				/* These ways not seen before
-				 * If two or more of the overlapping ways are
-				 * highways or railways mark a seperate error
-				 */
-				if ((highlight = ways_seen.get(current_ways)) == null)
-				{
-					String errortype;
-					int type;
+                    prims.add(ws.way);
+                    current_ways.add(ws.way);
+                }
+                /* These ways not seen before
+                 * If two or more of the overlapping ways are
+                 * highways or railways mark a seperate error
+                 */
+                if ((highlight = ways_seen.get(current_ways)) == null)
+                {
+                    String errortype;
+                    int type;
 
-					if(area > 0)
-					{
-						if (ways == 0 || duplicated.size() == area)
-						{
-							errortype = tr("Overlapping areas");
-							type = OVERLAPPING_AREA;
-						}
-						else if (highway == ways)
-						{
-							errortype = tr("Overlapping highways (with area)");
-							type = OVERLAPPING_HIGHWAY_AREA;
-						}
-						else if (railway == ways)
-						{
-							errortype = tr("Overlapping railways (with area)");
-							type = OVERLAPPING_RAILWAY_AREA;
-						}
-						else
-						{
-							errortype = tr("Overlapping ways (with area)");
-							type = OVERLAPPING_WAY_AREA;
-						}
-					}
-					else if (highway == ways)
-					{
-						errortype = tr("Overlapping highways");
-						type = OVERLAPPING_HIGHWAY;
-					}
-					else if (railway == ways)
-					{
-						errortype = tr("Overlapping railways");
-						type = OVERLAPPING_RAILWAY;
-					}
-					else
-					{
-						errortype = tr("Overlapping ways");
-						type = OVERLAPPING_WAY;
-					}
+                    if(area > 0)
+                    {
+                        if (ways == 0 || duplicated.size() == area)
+                        {
+                            errortype = tr("Overlapping areas");
+                            type = OVERLAPPING_AREA;
+                        }
+                        else if (highway == ways)
+                        {
+                            errortype = tr("Overlapping highways (with area)");
+                            type = OVERLAPPING_HIGHWAY_AREA;
+                        }
+                        else if (railway == ways)
+                        {
+                            errortype = tr("Overlapping railways (with area)");
+                            type = OVERLAPPING_RAILWAY_AREA;
+                        }
+                        else
+                        {
+                            errortype = tr("Overlapping ways (with area)");
+                            type = OVERLAPPING_WAY_AREA;
+                        }
+                    }
+                    else if (highway == ways)
+                    {
+                        errortype = tr("Overlapping highways");
+                        type = OVERLAPPING_HIGHWAY;
+                    }
+                    else if (railway == ways)
+                    {
+                        errortype = tr("Overlapping railways");
+                        type = OVERLAPPING_RAILWAY;
+                    }
+                    else
+                    {
+                        errortype = tr("Overlapping ways");
+                        type = OVERLAPPING_WAY;
+                    }
 
-					errors.add(new TestError(this, type < OVERLAPPING_HIGHWAY_AREA
-					? Severity.WARNING : Severity.OTHER, tr(errortype), type, prims, duplicated));
-					ways_seen.put(current_ways, duplicated);
-				}
-				else	/* way seen, mark highlight layer only */
-				{
-					for (WaySegment ws : duplicated)
-						highlight.add(ws);
-				}
-			}
-		}
-		nodePairs = null;
-	}
+                    errors.add(new TestError(this, type < OVERLAPPING_HIGHWAY_AREA
+                    ? Severity.WARNING : Severity.OTHER, tr(errortype), type, prims, duplicated));
+                    ways_seen.put(current_ways, duplicated);
+                }
+                else    /* way seen, mark highlight layer only */
+                {
+                    for (WaySegment ws : duplicated)
+                        highlight.add(ws);
+                }
+            }
+        }
+        nodePairs = null;
+    }
 
-	@Override
-	public void visit(Way w)
-	{
-		Node lastN = null;
-		int i = -2;
-		for (Node n : w.nodes) {
-			i++;
-			if (lastN == null) {
-				lastN = n;
-				continue;
-			}
-			nodePairs.add(Pair.sort(new Pair<Node,Node>(lastN, n)),
-				new WaySegment(w, i));
-			lastN = n;
-		}
-	}
+    @Override
+    public void visit(Way w)
+    {
+        Node lastN = null;
+        int i = -2;
+        for (Node n : w.nodes) {
+            i++;
+            if (lastN == null) {
+                lastN = n;
+                continue;
+            }
+            nodePairs.add(Pair.sort(new Pair<Node,Node>(lastN, n)),
+                new WaySegment(w, i));
+            lastN = n;
+        }
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/SelfIntersectingWay.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/SelfIntersectingWay.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/SelfIntersectingWay.java	(revision 12778)
@@ -16,26 +16,26 @@
  */
 public class SelfIntersectingWay extends Test {
-	protected static int SELF_INTERSECT = 401;
+    protected static int SELF_INTERSECT = 401;
 
-	public SelfIntersectingWay() {
-		super(tr("Self-intersecting ways"),
-			  tr("This test checks for ways " +
-				"that contain some of their nodes more than once."));
-	}
+    public SelfIntersectingWay() {
+        super(tr("Self-intersecting ways"),
+              tr("This test checks for ways " +
+                "that contain some of their nodes more than once."));
+    }
 
-	@Override public void visit(Way w) {
-		HashSet<Node> nodes = new HashSet<Node>();
+    @Override public void visit(Way w) {
+        HashSet<Node> nodes = new HashSet<Node>();
 
-		for (int i = 1; i < w.nodes.size() - 1; i++) {
-			Node n = w.nodes.get(i);
-			if (nodes.contains(n)) {
-				errors.add(new TestError(this,
-					Severity.WARNING, tr("Self-intersecting ways"), SELF_INTERSECT,
-					Arrays.asList(w), Arrays.asList(n)));
-				break;
-			} else {
-				nodes.add(n);
-			}
-		}
-	}
+        for (int i = 1; i < w.nodes.size() - 1; i++) {
+            Node n = w.nodes.get(i);
+            if (nodes.contains(n)) {
+                errors.add(new TestError(this,
+                    Severity.WARNING, tr("Self-intersecting ways"), SELF_INTERSECT,
+                    Arrays.asList(w), Arrays.asList(n)));
+                break;
+            } else {
+                nodes.add(n);
+            }
+        }
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/SimilarNamedWays.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/SimilarNamedWays.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/SimilarNamedWays.java	(revision 12778)
@@ -22,148 +22,148 @@
 public class SimilarNamedWays extends Test
 {
-	protected static int SIMILAR_NAMED = 701;
+    protected static int SIMILAR_NAMED = 701;
 
-	/** All ways, grouped by cells */
-	Map<Point2D,List<Way>> cellWays;
-	/** The already detected errors */
-	Bag<Way, Way> errorWays;
+    /** All ways, grouped by cells */
+    Map<Point2D,List<Way>> cellWays;
+    /** The already detected errors */
+    Bag<Way, Way> errorWays;
 
-	/**
-	 * Constructor
-	 */
-	public SimilarNamedWays()
-	{
-		super(tr("Similar named ways."),
-			  tr("This test checks for ways with similar names that may have been misspelled."));
-	}
+    /**
+     * Constructor
+     */
+    public SimilarNamedWays()
+    {
+        super(tr("Similar named ways."),
+              tr("This test checks for ways with similar names that may have been misspelled."));
+    }
 
-	@Override
-	public void startTest()
-	{
-		cellWays = new HashMap<Point2D,List<Way>>(1000);
-		errorWays = new Bag<Way, Way>();
-	}
+    @Override
+    public void startTest()
+    {
+        cellWays = new HashMap<Point2D,List<Way>>(1000);
+        errorWays = new Bag<Way, Way>();
+    }
 
-	@Override
-	public void endTest()
-	{
-		cellWays = null;
-		errorWays = null;
-	}
+    @Override
+    public void endTest()
+    {
+        cellWays = null;
+        errorWays = null;
+    }
 
-	@Override
-	public void visit(Way w)
-	{
-		if( w.deleted || w.incomplete )
-			return;
+    @Override
+    public void visit(Way w)
+    {
+        if( w.deleted || w.incomplete )
+            return;
 
-		String name = w.get("name");
-		if( name == null || name.length() < 6 )
-			return;
+        String name = w.get("name");
+        if( name == null || name.length() < 6 )
+            return;
 
-		List<List<Way>> theCellWays = Util.getWaysInCell(w, cellWays);
-		for( List<Way> ways : theCellWays)
-		{
-			for( Way w2 : ways)
-			{
-				if( errorWays.contains(w, w2) || errorWays.contains(w2, w) )
-					continue;
+        List<List<Way>> theCellWays = Util.getWaysInCell(w, cellWays);
+        for( List<Way> ways : theCellWays)
+        {
+            for( Way w2 : ways)
+            {
+                if( errorWays.contains(w, w2) || errorWays.contains(w2, w) )
+                    continue;
 
-				String name2 = w2.get("name");
-				if( name2 == null || name2.length() < 6 )
-					continue;
+                String name2 = w2.get("name");
+                if( name2 == null || name2.length() < 6 )
+                    continue;
 
-				int levenshteinDistance = getLevenshteinDistance(name, name2);
-				if( 0 < levenshteinDistance && levenshteinDistance <= 2 )
-				{
-					List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
-					primitives.add(w);
-					primitives.add(w2);
-					errors.add( new TestError(this, Severity.WARNING, tr("Similar named ways"), SIMILAR_NAMED, primitives) );
-					errorWays.add(w, w2);
-				}
-			}
-			ways.add(w);
-		}
-	}
+                int levenshteinDistance = getLevenshteinDistance(name, name2);
+                if( 0 < levenshteinDistance && levenshteinDistance <= 2 )
+                {
+                    List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
+                    primitives.add(w);
+                    primitives.add(w2);
+                    errors.add( new TestError(this, Severity.WARNING, tr("Similar named ways"), SIMILAR_NAMED, primitives) );
+                    errorWays.add(w, w2);
+                }
+            }
+            ways.add(w);
+        }
+    }
 
-	/**
-	 * Compute Levenshtein distance
-	 *
-	 * @param s First word
-	 * @param t Second word
-	 * @return The distance between words
-	 */
-	public int getLevenshteinDistance(String s, String t)
-	{
-		int d[][]; // matrix
-		int n; // length of s
-		int m; // length of t
-		int i; // iterates through s
-		int j; // iterates through t
-		char s_i; // ith character of s
-		char t_j; // jth character of t
-		int cost; // cost
+    /**
+     * Compute Levenshtein distance
+     *
+     * @param s First word
+     * @param t Second word
+     * @return The distance between words
+     */
+    public int getLevenshteinDistance(String s, String t)
+    {
+        int d[][]; // matrix
+        int n; // length of s
+        int m; // length of t
+        int i; // iterates through s
+        int j; // iterates through t
+        char s_i; // ith character of s
+        char t_j; // jth character of t
+        int cost; // cost
 
-		// Step 1
+        // Step 1
 
-		n = s.length();
-		m = t.length();
-		if (n == 0) return m;
-		if (m == 0) return n;
-		d = new int[n + 1][m + 1];
+        n = s.length();
+        m = t.length();
+        if (n == 0) return m;
+        if (m == 0) return n;
+        d = new int[n + 1][m + 1];
 
-		// Step 2
-		for (i = 0; i <= n; i++) d[i][0] = i;
-		for (j = 0; j <= m; j++) d[0][j] = j;
+        // Step 2
+        for (i = 0; i <= n; i++) d[i][0] = i;
+        for (j = 0; j <= m; j++) d[0][j] = j;
 
-		// Step 3
-		for (i = 1; i <= n; i++)
-		{
-			s_i = s.charAt(i - 1);
+        // Step 3
+        for (i = 1; i <= n; i++)
+        {
+            s_i = s.charAt(i - 1);
 
-			// Step 4
-			for (j = 1; j <= m; j++)
-			{
-				t_j = t.charAt(j - 1);
+            // Step 4
+            for (j = 1; j <= m; j++)
+            {
+                t_j = t.charAt(j - 1);
 
-				// Step 5
-				if (s_i == t_j)
-				{
-					cost = 0;
-				}
-				else
-				{
-					cost = 1;
-				}
+                // Step 5
+                if (s_i == t_j)
+                {
+                    cost = 0;
+                }
+                else
+                {
+                    cost = 1;
+                }
 
-				// Step 6
-				d[i][j] = Minimum(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
-			}
-		}
+                // Step 6
+                d[i][j] = Minimum(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
+            }
+        }
 
-		// Step 7
-		return d[n][m];
-	}
+        // Step 7
+        return d[n][m];
+    }
 
-	/**
-	 * Get minimum of three values
-	 * @param a First value
-	 * @param b Second value
-	 * @param c Third value
-	 * @return The minimum of the tre values
-	 */
-	private static int Minimum(int a, int b, int c)
-	{
-		int mi = a;
-		if (b < mi)
-		{
-			mi = b;
-		}
-		if (c < mi)
-		{
-			mi = c;
-		}
-		return mi;
-	}
+    /**
+     * Get minimum of three values
+     * @param a First value
+     * @param b Second value
+     * @param c Third value
+     * @return The minimum of the tre values
+     */
+    private static int Minimum(int a, int b, int c)
+    {
+        int mi = a;
+        if (b < mi)
+        {
+            mi = b;
+        }
+        if (c < mi)
+        {
+            mi = c;
+        }
+        return mi;
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java	(revision 12778)
@@ -63,767 +63,767 @@
 public class TagChecker extends Test
 {
-	/** The default data files */
-	public static final String DATA_FILE = "http://svn.openstreetmap.org/applications/editors/josm/plugins/validator/tagchecker.cfg";
-	public static final String SPELL_FILE = "http://svn.openstreetmap.org/applications/utils/planet.osm/java/speller/words.cfg";
-
-	/** The spell check key substitutions: the key should be substituted by the value */
-	protected static Map<String, String> spellCheckKeyData;
-	/** The spell check preset values */
-	protected static Bag<String, String> presetsValueData;
-	/** The TagChecker data */
-	protected static List<CheckerData> checkerData = new ArrayList<CheckerData>();
-
-	/** The preferences prefix */
-	protected static final String PREFIX = PreferenceEditor.PREFIX + "." + TagChecker.class.getSimpleName();
-
-	public static final String PREF_CHECK_VALUES = PREFIX + ".checkValues";
-	public static final String PREF_CHECK_KEYS = PREFIX + ".checkKeys";
-	public static final String PREF_CHECK_COMPLEX = PREFIX + ".checkComplex";
-	public static final String PREF_CHECK_FIXMES = PREFIX + ".checkFixmes";
-	public static final String PREF_CHECK_PAINT = PREFIX + ".paint";
-
-	public static final String PREF_SOURCES = PREFIX + ".sources";
-	public static final String PREF_USE_DATA_FILE = PREFIX + ".usedatafile";
-	public static final String PREF_USE_SPELL_FILE = PREFIX + ".usespellfile";
-
-	public static final String PREF_CHECK_KEYS_BEFORE_UPLOAD = PREF_CHECK_KEYS + "BeforeUpload";
-	public static final String PREF_CHECK_VALUES_BEFORE_UPLOAD = PREF_CHECK_VALUES + "BeforeUpload";
-	public static final String PREF_CHECK_COMPLEX_BEFORE_UPLOAD = PREF_CHECK_COMPLEX + "BeforeUpload";
-	public static final String PREF_CHECK_FIXMES_BEFORE_UPLOAD = PREF_CHECK_FIXMES + "BeforeUpload";
-	public static final String PREF_CHECK_PAINT_BEFORE_UPLOAD = PREF_CHECK_PAINT + "BeforeUpload";
-
-	protected boolean checkKeys = false;
-	protected boolean checkValues = false;
-	protected boolean checkComplex = false;
-	protected boolean checkFixmes = false;
-	protected boolean checkPaint = false;
-
-	protected JCheckBox prefCheckKeys;
-	protected JCheckBox prefCheckValues;
-	protected JCheckBox prefCheckComplex;
-	protected JCheckBox prefCheckFixmes;
-	protected JCheckBox prefCheckPaint;
-
-	protected JCheckBox prefCheckKeysBeforeUpload;
-	protected JCheckBox prefCheckValuesBeforeUpload;
-	protected JCheckBox prefCheckComplexBeforeUpload;
-	protected JCheckBox prefCheckFixmesBeforeUpload;
-	protected JCheckBox prefCheckPaintBeforeUpload;
-
-	protected JCheckBox prefUseDataFile;
-	protected JCheckBox prefUseSpellFile;
-
-	protected JButton addSrcButton;
-	protected JButton editSrcButton;
-	protected JButton deleteSrcButton;
-
-	protected static int EMPTY_VALUES      = 1200;
-	protected static int INVALID_KEY       = 1201;
-	protected static int INVALID_VALUE     = 1202;
-	protected static int FIXME             = 1203;
-	protected static int INVALID_SPACE     = 1204;
-	protected static int INVALID_KEY_SPACE = 1205;
-	protected static int INVALID_HTML      = 1206;
-	protected static int PAINT             = 1207;
-	/** 1250 and up is used by tagcheck */
-
-	/** List of sources for spellcheck data */
-	protected JList Sources;
-
-	
-	protected static Entities entities = new Entities();
-	/**
-	 * Constructor
-	 */
-	public TagChecker()
-	{
-		super(tr("Properties checker :"),
-			  tr("This plugin checks for errors in property keys and values."));
-	}
-
-	public static void initialize(OSMValidatorPlugin plugin) throws Exception
-	{
-		initializeData();
-		initializePresets();
-	}
-
-	/**
-	 * Reads the spellcheck file into a HashMap.
-	 * The data file is a list of words, beginning with +/-. If it starts with +,
-	 * the word is valid, but if it starts with -, the word should be replaced
-	 * by the nearest + word before this.
-	 *
-	 * @throws FileNotFoundException
-	 * @throws IOException
-	 */
-	private static void initializeData() throws IOException
-	{
-		spellCheckKeyData = new HashMap<String, String>();
-		String sources = Main.pref.get( PREF_SOURCES, "");
-		if(Main.pref.getBoolean(PREF_USE_DATA_FILE, true))
-		{
-			if( sources == null || sources.length() == 0)
-				sources = DATA_FILE;
-			else
-				sources = DATA_FILE + ";" + sources;
-		}
-		if(Main.pref.getBoolean(PREF_USE_SPELL_FILE, true))
-		{
-			if( sources == null || sources.length() == 0)
-				sources = SPELL_FILE;
-			else
-				sources = SPELL_FILE + ";" + sources;
-		}
-
-		String errorSources = "";
-		if(sources.length() == 0)
-			return;
-		for(String source: sources.split(";"))
-		{
-			try
-			{
-				MirroredInputStream s = new MirroredInputStream(source, Util.getPluginDir(), -1);
-				InputStreamReader r;
-				try
-				{
-					r = new InputStreamReader(s, "UTF-8");
-				}
-				catch (UnsupportedEncodingException e)
-				{
-					r = new InputStreamReader(s);
-				}
-				BufferedReader reader = new BufferedReader(r);
-
-				String okValue = null;
-				Boolean tagcheckerfile = false;
-				String line;
-				while((line = reader.readLine()) != null && (tagcheckerfile || line.length() != 0))
-				{
-					if(line.startsWith("#"))
-					{
-						if(line.startsWith("# JOSM TagChecker"))
-							tagcheckerfile = true;
-					}
-					else if(tagcheckerfile)
-					{
-						if(line.length() > 0)
-						{
-							CheckerData d = new CheckerData();
-							String err = d.getData(line);
-
-							if(err == null)
-								checkerData.add(d);
-							else
-								System.err.println(tr("Invalid tagchecker line - {0}: {1}", err, line));
-						}
-					}
-					else if(line.charAt(0) == '+')
-					{
-						okValue = line.substring(1);
-					}
-					else if(line.charAt(0) == '-' && okValue != null)
-					{
-						spellCheckKeyData.put(line.substring(1), okValue);
-					}
-					else
-					{
-						System.err.println(tr("Invalid spellcheck line: {0}", line));
-					}
-				}
-			}
-			catch (IOException e)
-			{
-				errorSources += source + "\n";
-			}
-		}
-
-		if( errorSources.length() > 0 )
-			throw new IOException( tr("Could not access data file(s):\n{0}", errorSources) );
-	}
-
-	/**
-	 * Reads the presets data.
-	 *
-	 * @throws Exception
-	 */
-	public static void initializePresets() throws Exception
-	{
-		if( !Main.pref.getBoolean(PREF_CHECK_VALUES, true) )
-			return;
-
-		Collection<TaggingPreset> presets = TaggingPresetPreference.taggingPresets;
-		if(presets != null)
-		{
-			presetsValueData = new Bag<String, String>();
-			for(TaggingPreset p : presets)
-			{
-				for(TaggingPreset.Item i : p.data)
-				{
-					if(i instanceof TaggingPreset.Combo)
-					{
-						TaggingPreset.Combo combo = (TaggingPreset.Combo) i;
-						for(String value : combo.values.split(","))
-							presetsValueData.add(combo.key, value);
-					}
-					else if(i instanceof TaggingPreset.Key)
-					{
-						TaggingPreset.Key k = (TaggingPreset.Key) i;
-						presetsValueData.add(k.key, k.value);
-					}
-				}
-			}
-		}
-	}
-
-	@Override
-	public void visit(Node n)
-	{
-		checkPrimitive(n);
-	}
-
-
-	@Override
-	public void visit(Relation n)
-	{
-		checkPrimitive(n);
-	}
-
-
-	@Override
-	public void visit(Way w)
-	{
-		checkPrimitive(w);
-	}
-
-	/**
-	 * Checks the primitive properties
-	 * @param p The primitive to check
-	 */
-	private void checkPrimitive(OsmPrimitive p)
-	{
-		// Just a collection to know if a primitive has been already marked with error
-		Bag<OsmPrimitive, String> withErrors = new Bag<OsmPrimitive, String>();
-
-		if(checkComplex)
-		{
-			for(CheckerData d : checkerData)
-			{
-				if(d.match(p))
-				{
-					errors.add( new TestError(this, d.getSeverity(), tr("Illegal tag/value combinations"),
-					d.getDescription(), d.getDescriptionOrig(), d.getCode(), p) );
-					withErrors.add(p, "TC");
-					break;
-				}
-			}
-		}
-		if(checkPaint && p.errors != null)
-		{
-			for(String s: p.errors)
-			{
-				/* passing translated text also to original string, as we already
-				translated the stuff before. Makes the ignore file language dependend. */
-				errors.add( new TestError(this, Severity.WARNING, tr("Painting problem"),
-				s, s, PAINT, p) );
-				withErrors.add(p, "P");
-			}
-		}
-
-		Map<String, String> props = (p.keys == null) ? Collections.<String, String>emptyMap() : p.keys;
-		for(Entry<String, String> prop: props.entrySet() )
-		{
-			String s = marktr("Key ''{0}'' invalid.");
-			String key = prop.getKey();
-			String value = prop.getValue();
-			if( checkValues && (value==null || value.trim().length() == 0) && !withErrors.contains(p, "EV"))
-			{
-				errors.add( new TestError(this, Severity.WARNING, tr("Tags with empty values"),
-				tr(s, key), MessageFormat.format(s, key), EMPTY_VALUES, p) );
-				withErrors.add(p, "EV");
-			}
-			if( checkKeys && spellCheckKeyData.containsKey(key) && !withErrors.contains(p, "IPK"))
-			{
-				errors.add( new TestError(this, Severity.WARNING, tr("Invalid property key"),
-				tr(s, key), MessageFormat.format(s, key), INVALID_KEY, p) );
-				withErrors.add(p, "IPK");
-			}
-			if( checkKeys && key.indexOf(" ") >= 0 && !withErrors.contains(p, "IPK"))
-			{
-				errors.add( new TestError(this, Severity.WARNING, tr("Invalid white space in property key"),
-				tr(s, key), MessageFormat.format(s, key), INVALID_KEY_SPACE, p) );
-				withErrors.add(p, "IPK");
-			}
-			if( checkValues && value != null && (value.startsWith(" ") || value.endsWith(" ")) && !withErrors.contains(p, "SPACE"))
-			{
-				errors.add( new TestError(this, Severity.OTHER, tr("Property values start or end with white space"),
-				tr(s, key), MessageFormat.format(s, key), INVALID_SPACE, p) );
-				withErrors.add(p, "SPACE");
-			}
-			if( checkValues && value != null && !value.equals(entities.unescape(value)) && !withErrors.contains(p, "HTML"))
-			{
-				errors.add( new TestError(this, Severity.OTHER, tr("Property values contain HTML entity"),
-				tr(s, key), MessageFormat.format(s, key), INVALID_HTML, p) );
-				withErrors.add(p, "HTML");
-			}
-			if( checkValues && value != null && value.length() > 0 && presetsValueData != null)
-			{
-				List<String> values = presetsValueData.get(key);
-				if( values != null && !values.contains(prop.getValue()) && !withErrors.contains(p, "UPV"))
-				{
-					String i = marktr("Key ''{0}'' unknown.");
-					errors.add( new TestError(this, Severity.OTHER, tr("Unknown property values"),
-					tr(i, key), MessageFormat.format(i, key), INVALID_VALUE, p) );
-					withErrors.add(p, "UPV");
-				}
-			}
-			if( checkFixmes && value != null && value.length() > 0 )
-			{
-				if( (value.contains("FIXME") || value.contains("check and delete") || key.contains("todo") || key.contains("fixme"))
-				&& !withErrors.contains(p, "FIXME"))
-				{
-					errors.add( new TestError(this, Severity.OTHER, tr("FIXMES"), FIXME, p) );
-					withErrors.add(p, "FIXME");
-				}
-			}
-		}
-	}
-
-	@Override
-	public void startTest()
-	{
-		checkKeys = Main.pref.getBoolean(PREF_CHECK_KEYS, true);
-		if( isBeforeUpload )
-			checkKeys = checkKeys && Main.pref.getBoolean(PREF_CHECK_KEYS_BEFORE_UPLOAD, true);
-
-		checkValues = Main.pref.getBoolean(PREF_CHECK_VALUES, true);
-		if( isBeforeUpload )
-			checkValues = checkValues && Main.pref.getBoolean(PREF_CHECK_VALUES_BEFORE_UPLOAD, true);
-
-		checkComplex = Main.pref.getBoolean(PREF_CHECK_COMPLEX, true);
-		if( isBeforeUpload )
-			checkComplex = checkValues && Main.pref.getBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, true);
-
-		checkFixmes = Main.pref.getBoolean(PREF_CHECK_FIXMES, true);
-		if( isBeforeUpload )
-			checkFixmes = checkFixmes && Main.pref.getBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, true);
-
-		checkPaint = Main.pref.getBoolean(PREF_CHECK_PAINT, true);
-		if( isBeforeUpload )
-			checkPaint = checkPaint && Main.pref.getBoolean(PREF_CHECK_PAINT_BEFORE_UPLOAD, true);
-	}
-
-	@Override
-	public void visit(Collection<OsmPrimitive> selection)
-	{
-		if( checkKeys || checkValues || checkComplex)
-			super.visit(selection);
-	}
-
-	@Override
-	public void addGui(JPanel testPanel)
-	{
-		GBC a = GBC.eol();
-		a.anchor = GBC.EAST;
-
-		testPanel.add( new JLabel(name), GBC.eol().insets(3,0,0,0) );
-
-		prefCheckKeys = new JCheckBox(tr("Check property keys."), Main.pref.getBoolean(PREF_CHECK_KEYS, true));
-		prefCheckKeys.setToolTipText(tr("Validate that property keys are valid checking against list of words."));
-		testPanel.add(prefCheckKeys, GBC.std().insets(20,0,0,0));
-
-		prefCheckKeysBeforeUpload = new JCheckBox();
-		prefCheckKeysBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_KEYS_BEFORE_UPLOAD, true));
-		testPanel.add(prefCheckKeysBeforeUpload, a);
-
-		prefCheckComplex = new JCheckBox(tr("Use complex property checker."), Main.pref.getBoolean(PREF_CHECK_COMPLEX, true));
-		prefCheckComplex.setToolTipText(tr("Validate property values and tags using complex rules."));
-		testPanel.add(prefCheckComplex, GBC.std().insets(20,0,0,0));
-
-		prefCheckComplexBeforeUpload = new JCheckBox();
-		prefCheckComplexBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, true));
-		testPanel.add(prefCheckComplexBeforeUpload, a);
-
-		Sources = new JList(new DefaultListModel());
-
-		String sources = Main.pref.get( PREF_SOURCES );
-		if(sources != null && sources.length() > 0)
-		{
-			for(String source : sources.split(";"))
-				((DefaultListModel)Sources.getModel()).addElement(source);
-		}
-
-		addSrcButton = new JButton(tr("Add"));
-		addSrcButton.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				String source = JOptionPane.showInputDialog(Main.parent, tr("TagChecker source"));
-				if (source != null)
-					((DefaultListModel)Sources.getModel()).addElement(source);
-				Sources.clearSelection();
-			}
-		});
-
-		editSrcButton = new JButton(tr("Edit"));
-		editSrcButton.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				int row = Sources.getSelectedIndex();
-				if(row == -1 && Sources.getModel().getSize() == 1)
-				{
-					Sources.setSelectedIndex(0);
-					row = 0;
-				}
-				if (row == -1)
-				{
-					if(Sources.getModel().getSize() == 0)
-					{
-						String source = JOptionPane.showInputDialog(Main.parent, tr("TagChecker source"));
-						if (source != null)
-							((DefaultListModel)Sources.getModel()).addElement(source);
-					}
-					else
-					{
-						JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit."));
-					}
-				}
-				else {
-					String source = JOptionPane.showInputDialog(Main.parent, tr("TagChecker source"), Sources.getSelectedValue());
-					if (source != null)
-						((DefaultListModel)Sources.getModel()).setElementAt(source, row);
-				}
-				Sources.clearSelection();
-			}
-		});
-
-		deleteSrcButton = new JButton(tr("Delete"));
-		deleteSrcButton.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				if (Sources.getSelectedIndex() == -1)
-					JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."));
-				else {
-					((DefaultListModel)Sources.getModel()).remove(Sources.getSelectedIndex());
-				}
-			}
-		});
-		Sources.setMinimumSize(new Dimension(300,50));
-		Sources.setVisibleRowCount(3);
-
-		Sources.setToolTipText(tr("The sources (URL or filename) of spell check (see http://wiki.openstreetmap.org/index.php/User:JLS/speller) or tag checking data files."));
-		addSrcButton.setToolTipText(tr("Add a new source to the list."));
-		editSrcButton.setToolTipText(tr("Edit the selected source."));
-		deleteSrcButton.setToolTipText(tr("Delete the selected source from the list."));
-
-		testPanel.add(new JLabel(tr("Data sources")), GBC.eol().insets(23,0,0,0));
-		testPanel.add(new JScrollPane(Sources), GBC.eol().insets(23,0,0,0).fill(GBC.HORIZONTAL));
-		final JPanel buttonPanel = new JPanel(new GridBagLayout());
-		testPanel.add(buttonPanel, GBC.eol().fill(GBC.HORIZONTAL));
-		buttonPanel.add(addSrcButton, GBC.std().insets(0,5,0,0));
-		buttonPanel.add(editSrcButton, GBC.std().insets(5,5,5,0));
-		buttonPanel.add(deleteSrcButton, GBC.std().insets(0,5,0,0));
-
-		ActionListener disableCheckActionListener = new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				handlePrefEnable();
-			}
-		};
-		prefCheckKeys.addActionListener(disableCheckActionListener);
-		prefCheckKeysBeforeUpload.addActionListener(disableCheckActionListener);
-		prefCheckComplex.addActionListener(disableCheckActionListener);
-		prefCheckComplexBeforeUpload.addActionListener(disableCheckActionListener);
-
-		handlePrefEnable();
-
-		prefCheckValues = new JCheckBox(tr("Check property values."), Main.pref.getBoolean(PREF_CHECK_VALUES, true));
-		prefCheckValues.setToolTipText(tr("Validate that property values are valid checking against presets."));
-		testPanel.add(prefCheckValues, GBC.std().insets(20,0,0,0));
-
-		prefCheckValuesBeforeUpload = new JCheckBox();
-		prefCheckValuesBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_VALUES_BEFORE_UPLOAD, true));
-		testPanel.add(prefCheckValuesBeforeUpload, a);
-
-		prefCheckFixmes = new JCheckBox(tr("Check for FIXMES."), Main.pref.getBoolean(PREF_CHECK_FIXMES, true));
-		prefCheckFixmes.setToolTipText(tr("Looks for nodes or ways with FIXME in any property value."));
-		testPanel.add(prefCheckFixmes, GBC.std().insets(20,0,0,0));
-
-		prefCheckFixmesBeforeUpload = new JCheckBox();
-		prefCheckFixmesBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, true));
-		testPanel.add(prefCheckFixmesBeforeUpload, a);
-
-		prefCheckPaint = new JCheckBox(tr("Check for paint notes."), Main.pref.getBoolean(PREF_CHECK_PAINT, true));
-		prefCheckPaint.setToolTipText(tr("Check if map paining found data errors."));
-		testPanel.add(prefCheckPaint, GBC.std().insets(20,0,0,0));
-
-		prefCheckPaintBeforeUpload = new JCheckBox();
-		prefCheckPaintBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_PAINT_BEFORE_UPLOAD, true));
-		testPanel.add(prefCheckPaintBeforeUpload, a);
-
-		prefUseDataFile = new JCheckBox(tr("Use default data file."), Main.pref.getBoolean(PREF_USE_DATA_FILE, true));
-		prefUseDataFile.setToolTipText(tr("Use the default data file (recommended)."));
-		testPanel.add(prefUseDataFile, GBC.eol().insets(20,0,0,0));
-
-		prefUseSpellFile = new JCheckBox(tr("Use default spellcheck file."), Main.pref.getBoolean(PREF_USE_SPELL_FILE, true));
-		prefUseSpellFile.setToolTipText(tr("Use the default spellcheck file (recommended)."));
-		testPanel.add(prefUseSpellFile, GBC.eol().insets(20,0,0,0));
-	}
-
-	public void handlePrefEnable()
-	{
-		boolean selected = prefCheckKeys.isSelected() || prefCheckKeysBeforeUpload.isSelected()
-		|| prefCheckComplex.isSelected() || prefCheckComplexBeforeUpload.isSelected();
-		Sources.setEnabled( selected );
-		addSrcButton.setEnabled(selected);
-		editSrcButton.setEnabled(selected);
-		deleteSrcButton.setEnabled(selected);
-	}
-
-	@Override
-	public boolean ok()
-	{
-		enabled = prefCheckKeys.isSelected() || prefCheckValues.isSelected() || prefCheckComplex.isSelected() || prefCheckFixmes.isSelected();
-		testBeforeUpload = prefCheckKeysBeforeUpload.isSelected() || prefCheckValuesBeforeUpload.isSelected()
-		|| prefCheckFixmesBeforeUpload.isSelected() || prefCheckComplexBeforeUpload.isSelected();
-
-		Main.pref.put(PREF_CHECK_VALUES, prefCheckValues.isSelected());
-		Main.pref.put(PREF_CHECK_COMPLEX, prefCheckComplex.isSelected());
-		Main.pref.put(PREF_CHECK_KEYS, prefCheckKeys.isSelected());
-		Main.pref.put(PREF_CHECK_FIXMES, prefCheckFixmes.isSelected());
-		Main.pref.put(PREF_CHECK_PAINT, prefCheckPaint.isSelected());
-		Main.pref.put(PREF_CHECK_VALUES_BEFORE_UPLOAD, prefCheckValuesBeforeUpload.isSelected());
-		Main.pref.put(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, prefCheckComplexBeforeUpload.isSelected());
-		Main.pref.put(PREF_CHECK_KEYS_BEFORE_UPLOAD, prefCheckKeysBeforeUpload.isSelected());
-		Main.pref.put(PREF_CHECK_FIXMES_BEFORE_UPLOAD, prefCheckFixmesBeforeUpload.isSelected());
-		Main.pref.put(PREF_CHECK_PAINT_BEFORE_UPLOAD, prefCheckPaintBeforeUpload.isSelected());
-		Main.pref.put(PREF_USE_DATA_FILE, prefUseDataFile.isSelected());
-		Main.pref.put(PREF_USE_SPELL_FILE, prefUseSpellFile.isSelected());
-		String sources = "";
-		if( Sources.getModel().getSize() > 0 )
-		{
-			String sb = "";
-			for (int i = 0; i < Sources.getModel().getSize(); ++i)
-				sb += ";"+Sources.getModel().getElementAt(i);
-			sources = sb.substring(1);
-		}
-		if(sources.length() == 0)
-			sources = null;
-		return Main.pref.put(PREF_SOURCES, sources);
-	}
-
-	@Override
-	public Command fixError(TestError testError)
-	{
-		List<Command> commands = new ArrayList<Command>(50);
-
-		int i = -1;
-		List<? extends OsmPrimitive> primitives = testError.getPrimitives();
-		for(OsmPrimitive p : primitives )
-		{
-			i++;
-			Map<String, String> tags = p.keys;
-			if( tags == null || tags.size() == 0 )
-				continue;
-
-			for(Entry<String, String> prop: tags.entrySet() )
-			{
-				String key = prop.getKey();
-				String value = prop.getValue();
-				if( value == null || value.trim().length() == 0 )
-					commands.add( new ChangePropertyCommand(Collections.singleton(primitives.get(i)), key, null) );
-				else if(value.startsWith(" ") || value.endsWith(" "))
-					commands.add( new ChangePropertyCommand(Collections.singleton(primitives.get(i)), key, value.trim()) );
-				else if(key.startsWith(" ") || key.endsWith(" "))
-					commands.add( new ChangePropertyKeyCommand(Collections.singleton(primitives.get(i)), key, key.trim()) );
-				else
-				{
-					String evalue = entities.unescape(value);
-					if(!evalue.equals(value))
-						commands.add( new ChangePropertyCommand(Collections.singleton(primitives.get(i)), key, evalue) );
-					else
-					{
-						String replacementKey = spellCheckKeyData.get(key);
-						if( replacementKey != null )
-						{
-							commands.add( new ChangePropertyKeyCommand(Collections.singleton(primitives.get(i)),
-							key, replacementKey) );
-						}
-					}
-				}
-			}
-		}
-
-		if( commands.size() == 0 )
-			return null;
-		else if( commands.size() == 1 )
-			return commands.get(0);
-		else
-			return new SequenceCommand(tr("Fix properties"), commands);
-	}
-
-	@Override
-	public boolean isFixable(TestError testError)
-	{
-		if( testError.getTester() instanceof TagChecker)
-		{
-			int code = testError.getCode();
-			return code == INVALID_KEY || code == EMPTY_VALUES || code == INVALID_SPACE || code == INVALID_KEY_SPACE || code == INVALID_HTML;
-		}
-
-		return false;
-	}
-
-	private static class CheckerData {
-		private String description;
-		private List<CheckerElement> data = new ArrayList<CheckerElement>();
-		private Integer type = 0;
-		private Integer code;
-		protected Severity severity;
-		protected static int NODE = 1;
-		protected static int WAY = 2;
-		protected static int RELATION = 3;
-		protected static int ALL = 4;
-		protected static int TAG_CHECK_ERROR  = 1250;
-		protected static int TAG_CHECK_WARN   = 1260;
-		protected static int TAG_CHECK_INFO   = 1270;
-
-		private class CheckerElement {
-			public Object tag;
-			public Object value;
-			public Boolean noMatch;
-			public Boolean tagAll = false;
-			public Boolean valueAll = false;
-			public Boolean valueBool = false;
-			private Pattern getPattern(String str) throws IllegalStateException, PatternSyntaxException
-			{
-				if(str.endsWith("/i"))
-					return Pattern.compile(str.substring(1,str.length()-2), Pattern.CASE_INSENSITIVE);
-				else if(str.endsWith("/"))
-					return Pattern.compile(str.substring(1,str.length()-1));
-				throw new IllegalStateException();
-			}
-			public CheckerElement(String exp) throws IllegalStateException, PatternSyntaxException
-			{
-				Matcher m = Pattern.compile("(.+)([!=]=)(.+)").matcher(exp);
-				m.matches();
-
-				String n = m.group(1).trim();
-				if(n.equals("*"))
-					tagAll = true;
-				else
-					tag = n.startsWith("/") ? getPattern(n) : n;
-				noMatch = m.group(2).equals("!=");
-				n = m.group(3).trim();
-				if(n.equals("*"))
-					valueAll = true;
-				else if(n.equals("BOOLEAN_TRUE"))
-				{
-					valueBool = true;
-					value = OsmUtils.trueval;
-				}
-				else if(n.equals("BOOLEAN_FALSE"))
-				{
-					valueBool = true;
-					value = OsmUtils.falseval;
-				}
-				else
-					value = n.startsWith("/") ? getPattern(n) : n;
-			}
-			public Boolean match(OsmPrimitive osm)
-			{
-				for(Entry<String, String> prop: osm.keys.entrySet())
-				{
-					String key = prop.getKey();
-					String val = valueBool ? OsmUtils.getNamedOsmBoolean(prop.getValue()) : prop.getValue();
-					if((tagAll || (tag instanceof Pattern ? ((Pattern)tag).matcher(key).matches() : key.equals(tag)))
-					&& (valueAll || (value instanceof Pattern ? ((Pattern)value).matcher(val).matches() : val.equals(value))))
-						return !noMatch;
-				}
-				return noMatch;
-			}
-		};
-
-		public String getData(String str)
-		{
-			Matcher m = Pattern.compile(" *# *([^#]+) *$").matcher(str);
-			str = m.replaceFirst("").trim();
-			try
-			{
-				description = m.group(1);
-				if(description != null && description.length() == 0)
-					description = null;
-			}
-			catch (IllegalStateException e)
-			{
-				description = null;
-			}
-			String[] n = str.split(" *: *", 3);
-			if(n[0].equals("way"))
-				type = WAY;
-			else if(n[0].equals("node"))
-				type = NODE;
-			else if(n[0].equals("relation"))
-				type = RELATION;
-			else if(n[0].equals("*"))
-				type = ALL;
-			if(type == 0 || n.length != 3)
-				return tr("Could not find element type");
-			if(n[1].equals("W"))
-			{
-				severity = Severity.WARNING;
-				code = TAG_CHECK_WARN;
-			}
-			else if(n[1].equals("E"))
-			{
-				severity = Severity.ERROR;
-				code = TAG_CHECK_ERROR;
-			}
-			else if(n[1].equals("I"))
-			{
-				severity = Severity.OTHER;
-				code = TAG_CHECK_INFO;
-			}
-			else
-				return tr("Could not find warning level");
-			for(String exp: n[2].split(" *&& *"))
-			{
-				try
-				{
-					data.add(new CheckerElement(exp));
-				}
-				catch(IllegalStateException e)
-				{
-					return tr("Illegal expression ''{0}''", exp);
-				}
-				catch(PatternSyntaxException e)
-				{
-					return tr("Illegal regular expression ''{0}''", exp);
-				}
-			}
-			return null;
-		}
-		public Boolean match(OsmPrimitive osm)
-		{
-			if(osm.keys == null || (type == NODE && !(osm instanceof Node))
-			|| (type == RELATION && !(osm instanceof Relation)) || (type == WAY && !(osm instanceof Way)))
-				return false;
-			for(CheckerElement ce : data)
-			{
-				if(!ce.match(osm))
-					return false;
-			}
-			return true;
-		}
-		public String getDescription()
-		{
-			return tr(description);
-		}
-		public String getDescriptionOrig()
-		{
-			return description;
-		}
-		public Severity getSeverity()
-		{
-			return severity;
-		}
-		public int getCode()
-		{
-			return code + type;
-		}
-	}
+    /** The default data files */
+    public static final String DATA_FILE = "http://svn.openstreetmap.org/applications/editors/josm/plugins/validator/tagchecker.cfg";
+    public static final String SPELL_FILE = "http://svn.openstreetmap.org/applications/utils/planet.osm/java/speller/words.cfg";
+
+    /** The spell check key substitutions: the key should be substituted by the value */
+    protected static Map<String, String> spellCheckKeyData;
+    /** The spell check preset values */
+    protected static Bag<String, String> presetsValueData;
+    /** The TagChecker data */
+    protected static List<CheckerData> checkerData = new ArrayList<CheckerData>();
+
+    /** The preferences prefix */
+    protected static final String PREFIX = PreferenceEditor.PREFIX + "." + TagChecker.class.getSimpleName();
+
+    public static final String PREF_CHECK_VALUES = PREFIX + ".checkValues";
+    public static final String PREF_CHECK_KEYS = PREFIX + ".checkKeys";
+    public static final String PREF_CHECK_COMPLEX = PREFIX + ".checkComplex";
+    public static final String PREF_CHECK_FIXMES = PREFIX + ".checkFixmes";
+    public static final String PREF_CHECK_PAINT = PREFIX + ".paint";
+
+    public static final String PREF_SOURCES = PREFIX + ".sources";
+    public static final String PREF_USE_DATA_FILE = PREFIX + ".usedatafile";
+    public static final String PREF_USE_SPELL_FILE = PREFIX + ".usespellfile";
+
+    public static final String PREF_CHECK_KEYS_BEFORE_UPLOAD = PREF_CHECK_KEYS + "BeforeUpload";
+    public static final String PREF_CHECK_VALUES_BEFORE_UPLOAD = PREF_CHECK_VALUES + "BeforeUpload";
+    public static final String PREF_CHECK_COMPLEX_BEFORE_UPLOAD = PREF_CHECK_COMPLEX + "BeforeUpload";
+    public static final String PREF_CHECK_FIXMES_BEFORE_UPLOAD = PREF_CHECK_FIXMES + "BeforeUpload";
+    public static final String PREF_CHECK_PAINT_BEFORE_UPLOAD = PREF_CHECK_PAINT + "BeforeUpload";
+
+    protected boolean checkKeys = false;
+    protected boolean checkValues = false;
+    protected boolean checkComplex = false;
+    protected boolean checkFixmes = false;
+    protected boolean checkPaint = false;
+
+    protected JCheckBox prefCheckKeys;
+    protected JCheckBox prefCheckValues;
+    protected JCheckBox prefCheckComplex;
+    protected JCheckBox prefCheckFixmes;
+    protected JCheckBox prefCheckPaint;
+
+    protected JCheckBox prefCheckKeysBeforeUpload;
+    protected JCheckBox prefCheckValuesBeforeUpload;
+    protected JCheckBox prefCheckComplexBeforeUpload;
+    protected JCheckBox prefCheckFixmesBeforeUpload;
+    protected JCheckBox prefCheckPaintBeforeUpload;
+
+    protected JCheckBox prefUseDataFile;
+    protected JCheckBox prefUseSpellFile;
+
+    protected JButton addSrcButton;
+    protected JButton editSrcButton;
+    protected JButton deleteSrcButton;
+
+    protected static int EMPTY_VALUES      = 1200;
+    protected static int INVALID_KEY       = 1201;
+    protected static int INVALID_VALUE     = 1202;
+    protected static int FIXME             = 1203;
+    protected static int INVALID_SPACE     = 1204;
+    protected static int INVALID_KEY_SPACE = 1205;
+    protected static int INVALID_HTML      = 1206;
+    protected static int PAINT             = 1207;
+    /** 1250 and up is used by tagcheck */
+
+    /** List of sources for spellcheck data */
+    protected JList Sources;
+
+
+    protected static Entities entities = new Entities();
+    /**
+     * Constructor
+     */
+    public TagChecker()
+    {
+        super(tr("Properties checker :"),
+              tr("This plugin checks for errors in property keys and values."));
+    }
+
+    public static void initialize(OSMValidatorPlugin plugin) throws Exception
+    {
+        initializeData();
+        initializePresets();
+    }
+
+    /**
+     * Reads the spellcheck file into a HashMap.
+     * The data file is a list of words, beginning with +/-. If it starts with +,
+     * the word is valid, but if it starts with -, the word should be replaced
+     * by the nearest + word before this.
+     *
+     * @throws FileNotFoundException
+     * @throws IOException
+     */
+    private static void initializeData() throws IOException
+    {
+        spellCheckKeyData = new HashMap<String, String>();
+        String sources = Main.pref.get( PREF_SOURCES, "");
+        if(Main.pref.getBoolean(PREF_USE_DATA_FILE, true))
+        {
+            if( sources == null || sources.length() == 0)
+                sources = DATA_FILE;
+            else
+                sources = DATA_FILE + ";" + sources;
+        }
+        if(Main.pref.getBoolean(PREF_USE_SPELL_FILE, true))
+        {
+            if( sources == null || sources.length() == 0)
+                sources = SPELL_FILE;
+            else
+                sources = SPELL_FILE + ";" + sources;
+        }
+
+        String errorSources = "";
+        if(sources.length() == 0)
+            return;
+        for(String source: sources.split(";"))
+        {
+            try
+            {
+                MirroredInputStream s = new MirroredInputStream(source, Util.getPluginDir(), -1);
+                InputStreamReader r;
+                try
+                {
+                    r = new InputStreamReader(s, "UTF-8");
+                }
+                catch (UnsupportedEncodingException e)
+                {
+                    r = new InputStreamReader(s);
+                }
+                BufferedReader reader = new BufferedReader(r);
+
+                String okValue = null;
+                Boolean tagcheckerfile = false;
+                String line;
+                while((line = reader.readLine()) != null && (tagcheckerfile || line.length() != 0))
+                {
+                    if(line.startsWith("#"))
+                    {
+                        if(line.startsWith("# JOSM TagChecker"))
+                            tagcheckerfile = true;
+                    }
+                    else if(tagcheckerfile)
+                    {
+                        if(line.length() > 0)
+                        {
+                            CheckerData d = new CheckerData();
+                            String err = d.getData(line);
+
+                            if(err == null)
+                                checkerData.add(d);
+                            else
+                                System.err.println(tr("Invalid tagchecker line - {0}: {1}", err, line));
+                        }
+                    }
+                    else if(line.charAt(0) == '+')
+                    {
+                        okValue = line.substring(1);
+                    }
+                    else if(line.charAt(0) == '-' && okValue != null)
+                    {
+                        spellCheckKeyData.put(line.substring(1), okValue);
+                    }
+                    else
+                    {
+                        System.err.println(tr("Invalid spellcheck line: {0}", line));
+                    }
+                }
+            }
+            catch (IOException e)
+            {
+                errorSources += source + "\n";
+            }
+        }
+
+        if( errorSources.length() > 0 )
+            throw new IOException( tr("Could not access data file(s):\n{0}", errorSources) );
+    }
+
+    /**
+     * Reads the presets data.
+     *
+     * @throws Exception
+     */
+    public static void initializePresets() throws Exception
+    {
+        if( !Main.pref.getBoolean(PREF_CHECK_VALUES, true) )
+            return;
+
+        Collection<TaggingPreset> presets = TaggingPresetPreference.taggingPresets;
+        if(presets != null)
+        {
+            presetsValueData = new Bag<String, String>();
+            for(TaggingPreset p : presets)
+            {
+                for(TaggingPreset.Item i : p.data)
+                {
+                    if(i instanceof TaggingPreset.Combo)
+                    {
+                        TaggingPreset.Combo combo = (TaggingPreset.Combo) i;
+                        for(String value : combo.values.split(","))
+                            presetsValueData.add(combo.key, value);
+                    }
+                    else if(i instanceof TaggingPreset.Key)
+                    {
+                        TaggingPreset.Key k = (TaggingPreset.Key) i;
+                        presetsValueData.add(k.key, k.value);
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public void visit(Node n)
+    {
+        checkPrimitive(n);
+    }
+
+
+    @Override
+    public void visit(Relation n)
+    {
+        checkPrimitive(n);
+    }
+
+
+    @Override
+    public void visit(Way w)
+    {
+        checkPrimitive(w);
+    }
+
+    /**
+     * Checks the primitive properties
+     * @param p The primitive to check
+     */
+    private void checkPrimitive(OsmPrimitive p)
+    {
+        // Just a collection to know if a primitive has been already marked with error
+        Bag<OsmPrimitive, String> withErrors = new Bag<OsmPrimitive, String>();
+
+        if(checkComplex)
+        {
+            for(CheckerData d : checkerData)
+            {
+                if(d.match(p))
+                {
+                    errors.add( new TestError(this, d.getSeverity(), tr("Illegal tag/value combinations"),
+                    d.getDescription(), d.getDescriptionOrig(), d.getCode(), p) );
+                    withErrors.add(p, "TC");
+                    break;
+                }
+            }
+        }
+        if(checkPaint && p.errors != null)
+        {
+            for(String s: p.errors)
+            {
+                /* passing translated text also to original string, as we already
+                translated the stuff before. Makes the ignore file language dependend. */
+                errors.add( new TestError(this, Severity.WARNING, tr("Painting problem"),
+                s, s, PAINT, p) );
+                withErrors.add(p, "P");
+            }
+        }
+
+        Map<String, String> props = (p.keys == null) ? Collections.<String, String>emptyMap() : p.keys;
+        for(Entry<String, String> prop: props.entrySet() )
+        {
+            String s = marktr("Key ''{0}'' invalid.");
+            String key = prop.getKey();
+            String value = prop.getValue();
+            if( checkValues && (value==null || value.trim().length() == 0) && !withErrors.contains(p, "EV"))
+            {
+                errors.add( new TestError(this, Severity.WARNING, tr("Tags with empty values"),
+                tr(s, key), MessageFormat.format(s, key), EMPTY_VALUES, p) );
+                withErrors.add(p, "EV");
+            }
+            if( checkKeys && spellCheckKeyData.containsKey(key) && !withErrors.contains(p, "IPK"))
+            {
+                errors.add( new TestError(this, Severity.WARNING, tr("Invalid property key"),
+                tr(s, key), MessageFormat.format(s, key), INVALID_KEY, p) );
+                withErrors.add(p, "IPK");
+            }
+            if( checkKeys && key.indexOf(" ") >= 0 && !withErrors.contains(p, "IPK"))
+            {
+                errors.add( new TestError(this, Severity.WARNING, tr("Invalid white space in property key"),
+                tr(s, key), MessageFormat.format(s, key), INVALID_KEY_SPACE, p) );
+                withErrors.add(p, "IPK");
+            }
+            if( checkValues && value != null && (value.startsWith(" ") || value.endsWith(" ")) && !withErrors.contains(p, "SPACE"))
+            {
+                errors.add( new TestError(this, Severity.OTHER, tr("Property values start or end with white space"),
+                tr(s, key), MessageFormat.format(s, key), INVALID_SPACE, p) );
+                withErrors.add(p, "SPACE");
+            }
+            if( checkValues && value != null && !value.equals(entities.unescape(value)) && !withErrors.contains(p, "HTML"))
+            {
+                errors.add( new TestError(this, Severity.OTHER, tr("Property values contain HTML entity"),
+                tr(s, key), MessageFormat.format(s, key), INVALID_HTML, p) );
+                withErrors.add(p, "HTML");
+            }
+            if( checkValues && value != null && value.length() > 0 && presetsValueData != null)
+            {
+                List<String> values = presetsValueData.get(key);
+                if( values != null && !values.contains(prop.getValue()) && !withErrors.contains(p, "UPV"))
+                {
+                    String i = marktr("Key ''{0}'' unknown.");
+                    errors.add( new TestError(this, Severity.OTHER, tr("Unknown property values"),
+                    tr(i, key), MessageFormat.format(i, key), INVALID_VALUE, p) );
+                    withErrors.add(p, "UPV");
+                }
+            }
+            if( checkFixmes && value != null && value.length() > 0 )
+            {
+                if( (value.contains("FIXME") || value.contains("check and delete") || key.contains("todo") || key.contains("fixme"))
+                && !withErrors.contains(p, "FIXME"))
+                {
+                    errors.add( new TestError(this, Severity.OTHER, tr("FIXMES"), FIXME, p) );
+                    withErrors.add(p, "FIXME");
+                }
+            }
+        }
+    }
+
+    @Override
+    public void startTest()
+    {
+        checkKeys = Main.pref.getBoolean(PREF_CHECK_KEYS, true);
+        if( isBeforeUpload )
+            checkKeys = checkKeys && Main.pref.getBoolean(PREF_CHECK_KEYS_BEFORE_UPLOAD, true);
+
+        checkValues = Main.pref.getBoolean(PREF_CHECK_VALUES, true);
+        if( isBeforeUpload )
+            checkValues = checkValues && Main.pref.getBoolean(PREF_CHECK_VALUES_BEFORE_UPLOAD, true);
+
+        checkComplex = Main.pref.getBoolean(PREF_CHECK_COMPLEX, true);
+        if( isBeforeUpload )
+            checkComplex = checkValues && Main.pref.getBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, true);
+
+        checkFixmes = Main.pref.getBoolean(PREF_CHECK_FIXMES, true);
+        if( isBeforeUpload )
+            checkFixmes = checkFixmes && Main.pref.getBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, true);
+
+        checkPaint = Main.pref.getBoolean(PREF_CHECK_PAINT, true);
+        if( isBeforeUpload )
+            checkPaint = checkPaint && Main.pref.getBoolean(PREF_CHECK_PAINT_BEFORE_UPLOAD, true);
+    }
+
+    @Override
+    public void visit(Collection<OsmPrimitive> selection)
+    {
+        if( checkKeys || checkValues || checkComplex)
+            super.visit(selection);
+    }
+
+    @Override
+    public void addGui(JPanel testPanel)
+    {
+        GBC a = GBC.eol();
+        a.anchor = GBC.EAST;
+
+        testPanel.add( new JLabel(name), GBC.eol().insets(3,0,0,0) );
+
+        prefCheckKeys = new JCheckBox(tr("Check property keys."), Main.pref.getBoolean(PREF_CHECK_KEYS, true));
+        prefCheckKeys.setToolTipText(tr("Validate that property keys are valid checking against list of words."));
+        testPanel.add(prefCheckKeys, GBC.std().insets(20,0,0,0));
+
+        prefCheckKeysBeforeUpload = new JCheckBox();
+        prefCheckKeysBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_KEYS_BEFORE_UPLOAD, true));
+        testPanel.add(prefCheckKeysBeforeUpload, a);
+
+        prefCheckComplex = new JCheckBox(tr("Use complex property checker."), Main.pref.getBoolean(PREF_CHECK_COMPLEX, true));
+        prefCheckComplex.setToolTipText(tr("Validate property values and tags using complex rules."));
+        testPanel.add(prefCheckComplex, GBC.std().insets(20,0,0,0));
+
+        prefCheckComplexBeforeUpload = new JCheckBox();
+        prefCheckComplexBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, true));
+        testPanel.add(prefCheckComplexBeforeUpload, a);
+
+        Sources = new JList(new DefaultListModel());
+
+        String sources = Main.pref.get( PREF_SOURCES );
+        if(sources != null && sources.length() > 0)
+        {
+            for(String source : sources.split(";"))
+                ((DefaultListModel)Sources.getModel()).addElement(source);
+        }
+
+        addSrcButton = new JButton(tr("Add"));
+        addSrcButton.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                String source = JOptionPane.showInputDialog(Main.parent, tr("TagChecker source"));
+                if (source != null)
+                    ((DefaultListModel)Sources.getModel()).addElement(source);
+                Sources.clearSelection();
+            }
+        });
+
+        editSrcButton = new JButton(tr("Edit"));
+        editSrcButton.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                int row = Sources.getSelectedIndex();
+                if(row == -1 && Sources.getModel().getSize() == 1)
+                {
+                    Sources.setSelectedIndex(0);
+                    row = 0;
+                }
+                if (row == -1)
+                {
+                    if(Sources.getModel().getSize() == 0)
+                    {
+                        String source = JOptionPane.showInputDialog(Main.parent, tr("TagChecker source"));
+                        if (source != null)
+                            ((DefaultListModel)Sources.getModel()).addElement(source);
+                    }
+                    else
+                    {
+                        JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to edit."));
+                    }
+                }
+                else {
+                    String source = JOptionPane.showInputDialog(Main.parent, tr("TagChecker source"), Sources.getSelectedValue());
+                    if (source != null)
+                        ((DefaultListModel)Sources.getModel()).setElementAt(source, row);
+                }
+                Sources.clearSelection();
+            }
+        });
+
+        deleteSrcButton = new JButton(tr("Delete"));
+        deleteSrcButton.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                if (Sources.getSelectedIndex() == -1)
+                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."));
+                else {
+                    ((DefaultListModel)Sources.getModel()).remove(Sources.getSelectedIndex());
+                }
+            }
+        });
+        Sources.setMinimumSize(new Dimension(300,50));
+        Sources.setVisibleRowCount(3);
+
+        Sources.setToolTipText(tr("The sources (URL or filename) of spell check (see http://wiki.openstreetmap.org/index.php/User:JLS/speller) or tag checking data files."));
+        addSrcButton.setToolTipText(tr("Add a new source to the list."));
+        editSrcButton.setToolTipText(tr("Edit the selected source."));
+        deleteSrcButton.setToolTipText(tr("Delete the selected source from the list."));
+
+        testPanel.add(new JLabel(tr("Data sources")), GBC.eol().insets(23,0,0,0));
+        testPanel.add(new JScrollPane(Sources), GBC.eol().insets(23,0,0,0).fill(GBC.HORIZONTAL));
+        final JPanel buttonPanel = new JPanel(new GridBagLayout());
+        testPanel.add(buttonPanel, GBC.eol().fill(GBC.HORIZONTAL));
+        buttonPanel.add(addSrcButton, GBC.std().insets(0,5,0,0));
+        buttonPanel.add(editSrcButton, GBC.std().insets(5,5,5,0));
+        buttonPanel.add(deleteSrcButton, GBC.std().insets(0,5,0,0));
+
+        ActionListener disableCheckActionListener = new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                handlePrefEnable();
+            }
+        };
+        prefCheckKeys.addActionListener(disableCheckActionListener);
+        prefCheckKeysBeforeUpload.addActionListener(disableCheckActionListener);
+        prefCheckComplex.addActionListener(disableCheckActionListener);
+        prefCheckComplexBeforeUpload.addActionListener(disableCheckActionListener);
+
+        handlePrefEnable();
+
+        prefCheckValues = new JCheckBox(tr("Check property values."), Main.pref.getBoolean(PREF_CHECK_VALUES, true));
+        prefCheckValues.setToolTipText(tr("Validate that property values are valid checking against presets."));
+        testPanel.add(prefCheckValues, GBC.std().insets(20,0,0,0));
+
+        prefCheckValuesBeforeUpload = new JCheckBox();
+        prefCheckValuesBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_VALUES_BEFORE_UPLOAD, true));
+        testPanel.add(prefCheckValuesBeforeUpload, a);
+
+        prefCheckFixmes = new JCheckBox(tr("Check for FIXMES."), Main.pref.getBoolean(PREF_CHECK_FIXMES, true));
+        prefCheckFixmes.setToolTipText(tr("Looks for nodes or ways with FIXME in any property value."));
+        testPanel.add(prefCheckFixmes, GBC.std().insets(20,0,0,0));
+
+        prefCheckFixmesBeforeUpload = new JCheckBox();
+        prefCheckFixmesBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_FIXMES_BEFORE_UPLOAD, true));
+        testPanel.add(prefCheckFixmesBeforeUpload, a);
+
+        prefCheckPaint = new JCheckBox(tr("Check for paint notes."), Main.pref.getBoolean(PREF_CHECK_PAINT, true));
+        prefCheckPaint.setToolTipText(tr("Check if map paining found data errors."));
+        testPanel.add(prefCheckPaint, GBC.std().insets(20,0,0,0));
+
+        prefCheckPaintBeforeUpload = new JCheckBox();
+        prefCheckPaintBeforeUpload.setSelected(Main.pref.getBoolean(PREF_CHECK_PAINT_BEFORE_UPLOAD, true));
+        testPanel.add(prefCheckPaintBeforeUpload, a);
+
+        prefUseDataFile = new JCheckBox(tr("Use default data file."), Main.pref.getBoolean(PREF_USE_DATA_FILE, true));
+        prefUseDataFile.setToolTipText(tr("Use the default data file (recommended)."));
+        testPanel.add(prefUseDataFile, GBC.eol().insets(20,0,0,0));
+
+        prefUseSpellFile = new JCheckBox(tr("Use default spellcheck file."), Main.pref.getBoolean(PREF_USE_SPELL_FILE, true));
+        prefUseSpellFile.setToolTipText(tr("Use the default spellcheck file (recommended)."));
+        testPanel.add(prefUseSpellFile, GBC.eol().insets(20,0,0,0));
+    }
+
+    public void handlePrefEnable()
+    {
+        boolean selected = prefCheckKeys.isSelected() || prefCheckKeysBeforeUpload.isSelected()
+        || prefCheckComplex.isSelected() || prefCheckComplexBeforeUpload.isSelected();
+        Sources.setEnabled( selected );
+        addSrcButton.setEnabled(selected);
+        editSrcButton.setEnabled(selected);
+        deleteSrcButton.setEnabled(selected);
+    }
+
+    @Override
+    public boolean ok()
+    {
+        enabled = prefCheckKeys.isSelected() || prefCheckValues.isSelected() || prefCheckComplex.isSelected() || prefCheckFixmes.isSelected();
+        testBeforeUpload = prefCheckKeysBeforeUpload.isSelected() || prefCheckValuesBeforeUpload.isSelected()
+        || prefCheckFixmesBeforeUpload.isSelected() || prefCheckComplexBeforeUpload.isSelected();
+
+        Main.pref.put(PREF_CHECK_VALUES, prefCheckValues.isSelected());
+        Main.pref.put(PREF_CHECK_COMPLEX, prefCheckComplex.isSelected());
+        Main.pref.put(PREF_CHECK_KEYS, prefCheckKeys.isSelected());
+        Main.pref.put(PREF_CHECK_FIXMES, prefCheckFixmes.isSelected());
+        Main.pref.put(PREF_CHECK_PAINT, prefCheckPaint.isSelected());
+        Main.pref.put(PREF_CHECK_VALUES_BEFORE_UPLOAD, prefCheckValuesBeforeUpload.isSelected());
+        Main.pref.put(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, prefCheckComplexBeforeUpload.isSelected());
+        Main.pref.put(PREF_CHECK_KEYS_BEFORE_UPLOAD, prefCheckKeysBeforeUpload.isSelected());
+        Main.pref.put(PREF_CHECK_FIXMES_BEFORE_UPLOAD, prefCheckFixmesBeforeUpload.isSelected());
+        Main.pref.put(PREF_CHECK_PAINT_BEFORE_UPLOAD, prefCheckPaintBeforeUpload.isSelected());
+        Main.pref.put(PREF_USE_DATA_FILE, prefUseDataFile.isSelected());
+        Main.pref.put(PREF_USE_SPELL_FILE, prefUseSpellFile.isSelected());
+        String sources = "";
+        if( Sources.getModel().getSize() > 0 )
+        {
+            String sb = "";
+            for (int i = 0; i < Sources.getModel().getSize(); ++i)
+                sb += ";"+Sources.getModel().getElementAt(i);
+            sources = sb.substring(1);
+        }
+        if(sources.length() == 0)
+            sources = null;
+        return Main.pref.put(PREF_SOURCES, sources);
+    }
+
+    @Override
+    public Command fixError(TestError testError)
+    {
+        List<Command> commands = new ArrayList<Command>(50);
+
+        int i = -1;
+        List<? extends OsmPrimitive> primitives = testError.getPrimitives();
+        for(OsmPrimitive p : primitives )
+        {
+            i++;
+            Map<String, String> tags = p.keys;
+            if( tags == null || tags.size() == 0 )
+                continue;
+
+            for(Entry<String, String> prop: tags.entrySet() )
+            {
+                String key = prop.getKey();
+                String value = prop.getValue();
+                if( value == null || value.trim().length() == 0 )
+                    commands.add( new ChangePropertyCommand(Collections.singleton(primitives.get(i)), key, null) );
+                else if(value.startsWith(" ") || value.endsWith(" "))
+                    commands.add( new ChangePropertyCommand(Collections.singleton(primitives.get(i)), key, value.trim()) );
+                else if(key.startsWith(" ") || key.endsWith(" "))
+                    commands.add( new ChangePropertyKeyCommand(Collections.singleton(primitives.get(i)), key, key.trim()) );
+                else
+                {
+                    String evalue = entities.unescape(value);
+                    if(!evalue.equals(value))
+                        commands.add( new ChangePropertyCommand(Collections.singleton(primitives.get(i)), key, evalue) );
+                    else
+                    {
+                        String replacementKey = spellCheckKeyData.get(key);
+                        if( replacementKey != null )
+                        {
+                            commands.add( new ChangePropertyKeyCommand(Collections.singleton(primitives.get(i)),
+                            key, replacementKey) );
+                        }
+                    }
+                }
+            }
+        }
+
+        if( commands.size() == 0 )
+            return null;
+        else if( commands.size() == 1 )
+            return commands.get(0);
+        else
+            return new SequenceCommand(tr("Fix properties"), commands);
+    }
+
+    @Override
+    public boolean isFixable(TestError testError)
+    {
+        if( testError.getTester() instanceof TagChecker)
+        {
+            int code = testError.getCode();
+            return code == INVALID_KEY || code == EMPTY_VALUES || code == INVALID_SPACE || code == INVALID_KEY_SPACE || code == INVALID_HTML;
+        }
+
+        return false;
+    }
+
+    private static class CheckerData {
+        private String description;
+        private List<CheckerElement> data = new ArrayList<CheckerElement>();
+        private Integer type = 0;
+        private Integer code;
+        protected Severity severity;
+        protected static int NODE = 1;
+        protected static int WAY = 2;
+        protected static int RELATION = 3;
+        protected static int ALL = 4;
+        protected static int TAG_CHECK_ERROR  = 1250;
+        protected static int TAG_CHECK_WARN   = 1260;
+        protected static int TAG_CHECK_INFO   = 1270;
+
+        private class CheckerElement {
+            public Object tag;
+            public Object value;
+            public Boolean noMatch;
+            public Boolean tagAll = false;
+            public Boolean valueAll = false;
+            public Boolean valueBool = false;
+            private Pattern getPattern(String str) throws IllegalStateException, PatternSyntaxException
+            {
+                if(str.endsWith("/i"))
+                    return Pattern.compile(str.substring(1,str.length()-2), Pattern.CASE_INSENSITIVE);
+                else if(str.endsWith("/"))
+                    return Pattern.compile(str.substring(1,str.length()-1));
+                throw new IllegalStateException();
+            }
+            public CheckerElement(String exp) throws IllegalStateException, PatternSyntaxException
+            {
+                Matcher m = Pattern.compile("(.+)([!=]=)(.+)").matcher(exp);
+                m.matches();
+
+                String n = m.group(1).trim();
+                if(n.equals("*"))
+                    tagAll = true;
+                else
+                    tag = n.startsWith("/") ? getPattern(n) : n;
+                noMatch = m.group(2).equals("!=");
+                n = m.group(3).trim();
+                if(n.equals("*"))
+                    valueAll = true;
+                else if(n.equals("BOOLEAN_TRUE"))
+                {
+                    valueBool = true;
+                    value = OsmUtils.trueval;
+                }
+                else if(n.equals("BOOLEAN_FALSE"))
+                {
+                    valueBool = true;
+                    value = OsmUtils.falseval;
+                }
+                else
+                    value = n.startsWith("/") ? getPattern(n) : n;
+            }
+            public Boolean match(OsmPrimitive osm)
+            {
+                for(Entry<String, String> prop: osm.keys.entrySet())
+                {
+                    String key = prop.getKey();
+                    String val = valueBool ? OsmUtils.getNamedOsmBoolean(prop.getValue()) : prop.getValue();
+                    if((tagAll || (tag instanceof Pattern ? ((Pattern)tag).matcher(key).matches() : key.equals(tag)))
+                    && (valueAll || (value instanceof Pattern ? ((Pattern)value).matcher(val).matches() : val.equals(value))))
+                        return !noMatch;
+                }
+                return noMatch;
+            }
+        };
+
+        public String getData(String str)
+        {
+            Matcher m = Pattern.compile(" *# *([^#]+) *$").matcher(str);
+            str = m.replaceFirst("").trim();
+            try
+            {
+                description = m.group(1);
+                if(description != null && description.length() == 0)
+                    description = null;
+            }
+            catch (IllegalStateException e)
+            {
+                description = null;
+            }
+            String[] n = str.split(" *: *", 3);
+            if(n[0].equals("way"))
+                type = WAY;
+            else if(n[0].equals("node"))
+                type = NODE;
+            else if(n[0].equals("relation"))
+                type = RELATION;
+            else if(n[0].equals("*"))
+                type = ALL;
+            if(type == 0 || n.length != 3)
+                return tr("Could not find element type");
+            if(n[1].equals("W"))
+            {
+                severity = Severity.WARNING;
+                code = TAG_CHECK_WARN;
+            }
+            else if(n[1].equals("E"))
+            {
+                severity = Severity.ERROR;
+                code = TAG_CHECK_ERROR;
+            }
+            else if(n[1].equals("I"))
+            {
+                severity = Severity.OTHER;
+                code = TAG_CHECK_INFO;
+            }
+            else
+                return tr("Could not find warning level");
+            for(String exp: n[2].split(" *&& *"))
+            {
+                try
+                {
+                    data.add(new CheckerElement(exp));
+                }
+                catch(IllegalStateException e)
+                {
+                    return tr("Illegal expression ''{0}''", exp);
+                }
+                catch(PatternSyntaxException e)
+                {
+                    return tr("Illegal regular expression ''{0}''", exp);
+                }
+            }
+            return null;
+        }
+        public Boolean match(OsmPrimitive osm)
+        {
+            if(osm.keys == null || (type == NODE && !(osm instanceof Node))
+            || (type == RELATION && !(osm instanceof Relation)) || (type == WAY && !(osm instanceof Way)))
+                return false;
+            for(CheckerElement ce : data)
+            {
+                if(!ce.match(osm))
+                    return false;
+            }
+            return true;
+        }
+        public String getDescription()
+        {
+            return tr(description);
+        }
+        public String getDescriptionOrig()
+        {
+            return description;
+        }
+        public Severity getSeverity()
+        {
+            return severity;
+        }
+        public int getCode()
+        {
+            return code + type;
+        }
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java	(revision 12778)
@@ -25,186 +25,186 @@
 public class UnconnectedWays extends Test
 {
-	protected static int UNCONNECTED_WAYS = 1301;
-	protected static final String PREFIX = PreferenceEditor.PREFIX + "." + UnconnectedWays.class.getSimpleName();
-
-	Set<MyWaySegment> ways;
-	Set<Node> endnodes; // nodes at end of way
-	Set<Node> endnodes_highway; // nodes at end of way
-	Set<Node> middlenodes; // nodes in middle of way
-	Set<Node> othernodes; // nodes appearing at least twice
-
-	double mindist;
-	double minmiddledist;
-	/**
-	 * Constructor
-	 */
-	public UnconnectedWays()
-	{
-		super(tr("Unconnected ways."),
-			  tr("This test checks if a way has an endpoint very near to another way."));
-	}
-
-	@Override
-	public void startTest()
-	{
-		ways = new HashSet<MyWaySegment>();
-		endnodes = new HashSet<Node>();
-		endnodes_highway = new HashSet<Node>();
-		middlenodes = new HashSet<Node>();
-		othernodes = new HashSet<Node>();
-		mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0)/6378135.0;
-		minmiddledist = Main.pref.getDouble(PREFIX + ".way_way_distance", 0.0)/6378135.0;
-	}
-
-	@Override
-	public void endTest()
-	{
-		Map<Node, Way> map = new HashMap<Node, Way>();
-		for(Node en : endnodes_highway)
-		{
-			for(MyWaySegment s : ways)
-			{
-				if(s.highway && s.nearby(en, mindist))
-					map.put(en, s.w);
-			}
-		}
-		if(map.size() > 0)
-		{
-			for(Map.Entry<Node, Way> error : map.entrySet())
-			{
-				errors.add(new TestError(this, Severity.WARNING,
-				tr("Way end node near other highway"), UNCONNECTED_WAYS,
-				Arrays.asList(error.getKey(), error.getValue())));
-			}
-		}
-		map.clear();
-		for(Node en : endnodes_highway)
-		{
-			for(MyWaySegment s : ways)
-			{
-				if(!s.highway && s.nearby(en, mindist))
-					map.put(en, s.w);
-			}
-		}
-		for(Node en : endnodes)
-		{
-			for(MyWaySegment s : ways)
-			{
-				if(s.nearby(en, mindist))
-					map.put(en, s.w);
-			}
-		}
-		if(map.size() > 0)
-		{
-			for(Map.Entry<Node, Way> error : map.entrySet())
-			{
-				errors.add(new TestError(this, Severity.WARNING,
-				tr("Way end node near other way"), UNCONNECTED_WAYS,
-				Arrays.asList(error.getKey(), error.getValue())));
-			}
-		}
-		/* the following two use a shorter distance */
-		if(minmiddledist > 0.0)
-		{
-			map.clear();
-			for(Node en : middlenodes)
-			{
-				for(MyWaySegment s : ways)
-				{
-					if(s.nearby(en, minmiddledist))
-						map.put(en, s.w);
-				}
-			}
-			if(map.size() > 0)
-			{
-				for(Map.Entry<Node, Way> error : map.entrySet())
-				{
-					errors.add(new TestError(this, Severity.OTHER,
-					tr("Way node near other way"), UNCONNECTED_WAYS,
-					Arrays.asList(error.getKey(), error.getValue())));
-				}
-			}
-			map.clear();
-			for(Node en : othernodes)
-			{
-				for(MyWaySegment s : ways)
-				{
-					if(s.nearby(en, minmiddledist))
-						map.put(en, s.w);
-				}
-			}
-			if(map.size() > 0)
-			{
-				for(Map.Entry<Node, Way> error : map.entrySet())
-				{
-					errors.add(new TestError(this, Severity.OTHER,
-					tr("Connected way end node near other way"), UNCONNECTED_WAYS,
-					Arrays.asList(error.getKey(), error.getValue())));
-				}
-			}
-		}
-		ways = null;
-		endnodes = null;
-	}
-
-	private class MyWaySegment
-	{
-		private Line2D line;
-		public Way w;
-		public Boolean highway;
-
-		public MyWaySegment(Way w, Node n1, Node n2)
-		{
-			this.w = w;
-			this.highway = w.get("highway") != null || w.get("railway") != null;
-			line = new Line2D.Double(n1.eastNorth.east(), n1.eastNorth.north(),
-			n2.eastNorth.east(), n2.eastNorth.north());
-		}
-
-		public boolean nearby(Node n, double dist)
-		{
-			return !w.nodes.contains(n)
-			&& line.ptSegDist(n.eastNorth.east(), n.eastNorth.north()) < dist;
-		}
-	}
-
-	@Override
-	public void visit(Way w)
-	{
-		if( w.deleted || w.incomplete )
-			return;
-		int size = w.nodes.size();
-		if(size < 2)
-			return;
-		for(int i = 1; i < size; ++i)
-		{
-			if(i < size-1)
-				addNode(w.nodes.get(i), middlenodes);
-			ways.add(new MyWaySegment(w, w.nodes.get(i-1), w.nodes.get(i)));
-		}
-		Set<Node> set = endnodes;
-		if(w.get("highway") != null || w.get("railway") != null)
-			set = endnodes_highway;
-		addNode(w.nodes.get(0), set);
-		addNode(w.nodes.get(size-1), set);
-	}
-	private void addNode(Node n, Set<Node> s)
-	{
-		Boolean m = middlenodes.contains(n);
-		Boolean e = endnodes.contains(n);
-		Boolean eh = endnodes_highway.contains(n);
-		Boolean o = othernodes.contains(n);
-		if(!m && !e && !o && !eh)
-			s.add(n);
-		else if(!o)
-		{
-			othernodes.add(n);
-			if(e)
-				endnodes.remove(n);
-			else if(eh)
-				endnodes_highway.remove(n);
-			else
-				middlenodes.remove(n);
-		}
-	}
+    protected static int UNCONNECTED_WAYS = 1301;
+    protected static final String PREFIX = PreferenceEditor.PREFIX + "." + UnconnectedWays.class.getSimpleName();
+
+    Set<MyWaySegment> ways;
+    Set<Node> endnodes; // nodes at end of way
+    Set<Node> endnodes_highway; // nodes at end of way
+    Set<Node> middlenodes; // nodes in middle of way
+    Set<Node> othernodes; // nodes appearing at least twice
+
+    double mindist;
+    double minmiddledist;
+    /**
+     * Constructor
+     */
+    public UnconnectedWays()
+    {
+        super(tr("Unconnected ways."),
+              tr("This test checks if a way has an endpoint very near to another way."));
+    }
+
+    @Override
+    public void startTest()
+    {
+        ways = new HashSet<MyWaySegment>();
+        endnodes = new HashSet<Node>();
+        endnodes_highway = new HashSet<Node>();
+        middlenodes = new HashSet<Node>();
+        othernodes = new HashSet<Node>();
+        mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0)/6378135.0;
+        minmiddledist = Main.pref.getDouble(PREFIX + ".way_way_distance", 0.0)/6378135.0;
+    }
+
+    @Override
+    public void endTest()
+    {
+        Map<Node, Way> map = new HashMap<Node, Way>();
+        for(Node en : endnodes_highway)
+        {
+            for(MyWaySegment s : ways)
+            {
+                if(s.highway && s.nearby(en, mindist))
+                    map.put(en, s.w);
+            }
+        }
+        if(map.size() > 0)
+        {
+            for(Map.Entry<Node, Way> error : map.entrySet())
+            {
+                errors.add(new TestError(this, Severity.WARNING,
+                tr("Way end node near other highway"), UNCONNECTED_WAYS,
+                Arrays.asList(error.getKey(), error.getValue())));
+            }
+        }
+        map.clear();
+        for(Node en : endnodes_highway)
+        {
+            for(MyWaySegment s : ways)
+            {
+                if(!s.highway && s.nearby(en, mindist))
+                    map.put(en, s.w);
+            }
+        }
+        for(Node en : endnodes)
+        {
+            for(MyWaySegment s : ways)
+            {
+                if(s.nearby(en, mindist))
+                    map.put(en, s.w);
+            }
+        }
+        if(map.size() > 0)
+        {
+            for(Map.Entry<Node, Way> error : map.entrySet())
+            {
+                errors.add(new TestError(this, Severity.WARNING,
+                tr("Way end node near other way"), UNCONNECTED_WAYS,
+                Arrays.asList(error.getKey(), error.getValue())));
+            }
+        }
+        /* the following two use a shorter distance */
+        if(minmiddledist > 0.0)
+        {
+            map.clear();
+            for(Node en : middlenodes)
+            {
+                for(MyWaySegment s : ways)
+                {
+                    if(s.nearby(en, minmiddledist))
+                        map.put(en, s.w);
+                }
+            }
+            if(map.size() > 0)
+            {
+                for(Map.Entry<Node, Way> error : map.entrySet())
+                {
+                    errors.add(new TestError(this, Severity.OTHER,
+                    tr("Way node near other way"), UNCONNECTED_WAYS,
+                    Arrays.asList(error.getKey(), error.getValue())));
+                }
+            }
+            map.clear();
+            for(Node en : othernodes)
+            {
+                for(MyWaySegment s : ways)
+                {
+                    if(s.nearby(en, minmiddledist))
+                        map.put(en, s.w);
+                }
+            }
+            if(map.size() > 0)
+            {
+                for(Map.Entry<Node, Way> error : map.entrySet())
+                {
+                    errors.add(new TestError(this, Severity.OTHER,
+                    tr("Connected way end node near other way"), UNCONNECTED_WAYS,
+                    Arrays.asList(error.getKey(), error.getValue())));
+                }
+            }
+        }
+        ways = null;
+        endnodes = null;
+    }
+
+    private class MyWaySegment
+    {
+        private Line2D line;
+        public Way w;
+        public Boolean highway;
+
+        public MyWaySegment(Way w, Node n1, Node n2)
+        {
+            this.w = w;
+            this.highway = w.get("highway") != null || w.get("railway") != null;
+            line = new Line2D.Double(n1.eastNorth.east(), n1.eastNorth.north(),
+            n2.eastNorth.east(), n2.eastNorth.north());
+        }
+
+        public boolean nearby(Node n, double dist)
+        {
+            return !w.nodes.contains(n)
+            && line.ptSegDist(n.eastNorth.east(), n.eastNorth.north()) < dist;
+        }
+    }
+
+    @Override
+    public void visit(Way w)
+    {
+        if( w.deleted || w.incomplete )
+            return;
+        int size = w.nodes.size();
+        if(size < 2)
+            return;
+        for(int i = 1; i < size; ++i)
+        {
+            if(i < size-1)
+                addNode(w.nodes.get(i), middlenodes);
+            ways.add(new MyWaySegment(w, w.nodes.get(i-1), w.nodes.get(i)));
+        }
+        Set<Node> set = endnodes;
+        if(w.get("highway") != null || w.get("railway") != null)
+            set = endnodes_highway;
+        addNode(w.nodes.get(0), set);
+        addNode(w.nodes.get(size-1), set);
+    }
+    private void addNode(Node n, Set<Node> s)
+    {
+        Boolean m = middlenodes.contains(n);
+        Boolean e = endnodes.contains(n);
+        Boolean eh = endnodes_highway.contains(n);
+        Boolean o = othernodes.contains(n);
+        if(!m && !e && !o && !eh)
+            s.add(n);
+        else if(!o)
+        {
+            othernodes.add(n);
+            if(e)
+                endnodes.remove(n);
+            else if(eh)
+                endnodes_highway.remove(n);
+            else
+                middlenodes.remove(n);
+        }
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedNode.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedNode.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedNode.java	(revision 12778)
@@ -22,83 +22,83 @@
 public class UntaggedNode extends Test
 {
-	protected static int UNTAGGED_NODE = 201;
+    protected static int UNTAGGED_NODE = 201;
 
-	/** Bag of all nodes */
-	Set<Node> emptyNodes;
+    /** Bag of all nodes */
+    Set<Node> emptyNodes;
 
-	/**
-	 * Constructor
-	 */
-	public UntaggedNode()
-	{
-		super(tr("Untagged nodes."),
-			  tr("This test checks for untagged nodes that are not part of any way."));
-	}
+    /**
+     * Constructor
+     */
+    public UntaggedNode()
+    {
+        super(tr("Untagged nodes."),
+              tr("This test checks for untagged nodes that are not part of any way."));
+    }
 
-	@Override
-	public void startTest()
-	{
-		emptyNodes = new HashSet<Node>(100);
-	}
+    @Override
+    public void startTest()
+    {
+        emptyNodes = new HashSet<Node>(100);
+    }
 
-	@Override
-	public void visit(Collection<OsmPrimitive> selection)
-	{
-		// If there is a partial selection, it may be false positives if a
-		// node is selected, but not the container way. So, in this
-		// case, we must visit all ways, selected or not.
-		if (partialSelection) {
-			for (OsmPrimitive p : selection) {
-				if (!p.deleted && !p.incomplete && p instanceof Node) {
-					p.visit(this);
-				}
-			}
-			for (Way w : Main.ds.ways) {
-				visit(w);
-			}
-		} else {
-			for (OsmPrimitive p : selection) {
-				if (!p.deleted && !p.incomplete) {
-					p.visit(this);
-				}
-			}
-		}
-	}
+    @Override
+    public void visit(Collection<OsmPrimitive> selection)
+    {
+        // If there is a partial selection, it may be false positives if a
+        // node is selected, but not the container way. So, in this
+        // case, we must visit all ways, selected or not.
+        if (partialSelection) {
+            for (OsmPrimitive p : selection) {
+                if (!p.deleted && !p.incomplete && p instanceof Node) {
+                    p.visit(this);
+                }
+            }
+            for (Way w : Main.ds.ways) {
+                visit(w);
+            }
+        } else {
+            for (OsmPrimitive p : selection) {
+                if (!p.deleted && !p.incomplete) {
+                    p.visit(this);
+                }
+            }
+        }
+    }
 
-	@Override
-	public void visit(Node n)
-	{
-		if(!n.incomplete && !n.deleted && !n.tagged)
-			emptyNodes.add(n);
-	}
+    @Override
+    public void visit(Node n)
+    {
+        if(!n.incomplete && !n.deleted && !n.tagged)
+            emptyNodes.add(n);
+    }
 
-	@Override
-	public void visit(Way w)
-	{
-		for (Node n : w.nodes) {
-			emptyNodes.remove(n);
-		}
-	}
+    @Override
+    public void visit(Way w)
+    {
+        for (Node n : w.nodes) {
+            emptyNodes.remove(n);
+        }
+    }
 
-	@Override
-	public void endTest()
-	{
-		for(Node node : emptyNodes)
-		{
-			errors.add( new TestError(this, Severity.OTHER, tr("Untagged and unconnected nodes"), UNTAGGED_NODE, node) );
-		}
-		emptyNodes = null;
-	}
+    @Override
+    public void endTest()
+    {
+        for(Node node : emptyNodes)
+        {
+            errors.add( new TestError(this, Severity.OTHER, tr("Untagged and unconnected nodes"), UNTAGGED_NODE, node) );
+        }
+        emptyNodes = null;
+    }
 
-	@Override
-	public Command fixError(TestError testError)
-	{
-		return DeleteCommand.delete(testError.getPrimitives());
-	}
+    @Override
+    public Command fixError(TestError testError)
+    {
+        return DeleteCommand.delete(testError.getPrimitives());
+    }
 
-	@Override
-	public boolean isFixable(TestError testError)
-	{
-		return (testError.getTester() instanceof UntaggedNode);
-	}
+    @Override
+    public boolean isFixable(TestError testError)
+    {
+        return (testError.getTester() instanceof UntaggedNode);
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java	(revision 12778)
@@ -21,94 +21,94 @@
 public class UntaggedWay extends Test
 {
-	/** Empty way error */
-	protected static final int EMPTY_WAY    = 301;
-	/** Untagged way error */
-	protected static final int UNTAGGED_WAY = 302;
-	/** Unnamed way error */
-	protected static final int UNNAMED_WAY  = 303;
-	/** One node way error */
-	protected static final int ONE_NODE_WAY = 304;
+    /** Empty way error */
+    protected static final int EMPTY_WAY    = 301;
+    /** Untagged way error */
+    protected static final int UNTAGGED_WAY = 302;
+    /** Unnamed way error */
+    protected static final int UNNAMED_WAY  = 303;
+    /** One node way error */
+    protected static final int ONE_NODE_WAY = 304;
 
-	/** Ways that must have a name */
-	public static final Set<String> NAMED_WAYS = new HashSet<String>();
-	static
-	{
-		NAMED_WAYS.add( "motorway" );
-		NAMED_WAYS.add( "trunk" );
-		NAMED_WAYS.add( "primary" );
-		NAMED_WAYS.add( "secondary" );
-		NAMED_WAYS.add( "tertiary" );
-		NAMED_WAYS.add( "residential" );
-		NAMED_WAYS.add( "pedestrian" ); ;
-	}
+    /** Ways that must have a name */
+    public static final Set<String> NAMED_WAYS = new HashSet<String>();
+    static
+    {
+        NAMED_WAYS.add( "motorway" );
+        NAMED_WAYS.add( "trunk" );
+        NAMED_WAYS.add( "primary" );
+        NAMED_WAYS.add( "secondary" );
+        NAMED_WAYS.add( "tertiary" );
+        NAMED_WAYS.add( "residential" );
+        NAMED_WAYS.add( "pedestrian" ); ;
+    }
 
-	/**
-	 * Constructor
-	 */
-	public UntaggedWay()
-	{
-		super(tr("Untagged, empty, and one node ways."),
-			  tr("This test checks for untagged, empty and one node ways."));
-	}
+    /**
+     * Constructor
+     */
+    public UntaggedWay()
+    {
+        super(tr("Untagged, empty, and one node ways."),
+              tr("This test checks for untagged, empty and one node ways."));
+    }
 
-	@Override
-	public void visit(Way w)
-	{
-		if (w.deleted || w.incomplete) return;
+    @Override
+    public void visit(Way w)
+    {
+        if (w.deleted || w.incomplete) return;
 
-		Map<String, String> tags = w.keys;
-		if( tags != null )
-		{
-			String highway = tags.get("highway");
-			if(highway != null && NAMED_WAYS.contains(highway))
-			{
-				if( !tags.containsKey("name") && !tags.containsKey("ref") )
-				{
-					boolean hasName = false;
-					for( String key : w.keySet())
-					{
-						hasName = key.startsWith("name:") || key.endsWith("_name") || key.endsWith("_ref");
-						if( hasName )
-							break;
-					}
+        Map<String, String> tags = w.keys;
+        if( tags != null )
+        {
+            String highway = tags.get("highway");
+            if(highway != null && NAMED_WAYS.contains(highway))
+            {
+                if( !tags.containsKey("name") && !tags.containsKey("ref") )
+                {
+                    boolean hasName = false;
+                    for( String key : w.keySet())
+                    {
+                        hasName = key.startsWith("name:") || key.endsWith("_name") || key.endsWith("_ref");
+                        if( hasName )
+                            break;
+                    }
 
-					if( !hasName)
-						errors.add( new TestError(this, Severity.WARNING, tr("Unnamed ways"), UNNAMED_WAY, w) );
-				}
-			}
-		}
+                    if( !hasName)
+                        errors.add( new TestError(this, Severity.WARNING, tr("Unnamed ways"), UNNAMED_WAY, w) );
+                }
+            }
+        }
 
-		if(!w.tagged)
-		{
-			errors.add( new TestError(this, Severity.WARNING, tr("Untagged ways"), UNTAGGED_WAY, w) );
-		}
+        if(!w.tagged)
+        {
+            errors.add( new TestError(this, Severity.WARNING, tr("Untagged ways"), UNTAGGED_WAY, w) );
+        }
 
-		if( w.nodes.size() == 0 )
-		{
-			errors.add( new TestError(this, Severity.ERROR, tr("Empty ways"), EMPTY_WAY, w) );
-		}
-		else if( w.nodes.size() == 1 )
-		{
-			errors.add( new TestError(this, Severity.ERROR, tr("One node ways"), ONE_NODE_WAY, w) );
-		}
+        if( w.nodes.size() == 0 )
+        {
+            errors.add( new TestError(this, Severity.ERROR, tr("Empty ways"), EMPTY_WAY, w) );
+        }
+        else if( w.nodes.size() == 1 )
+        {
+            errors.add( new TestError(this, Severity.ERROR, tr("One node ways"), ONE_NODE_WAY, w) );
+        }
 
-	}
+    }
 
-	@Override
-	public boolean isFixable(TestError testError)
-	{
-		if( testError.getTester() instanceof UntaggedWay )
-		{
-			return testError.getCode() == EMPTY_WAY
-				|| testError.getCode() == ONE_NODE_WAY;
-		}
+    @Override
+    public boolean isFixable(TestError testError)
+    {
+        if( testError.getTester() instanceof UntaggedWay )
+        {
+            return testError.getCode() == EMPTY_WAY
+                || testError.getCode() == ONE_NODE_WAY;
+        }
 
-		return false;
-	}
+        return false;
+    }
 
-	@Override
-	public Command fixError(TestError testError)
-	{
-		return DeleteCommand.delete(testError.getPrimitives());
-	}
+    @Override
+    public Command fixError(TestError testError)
+    {
+        return DeleteCommand.delete(testError.getPrimitives());
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/WronglyOrderedWays.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/WronglyOrderedWays.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/WronglyOrderedWays.java	(revision 12778)
@@ -19,92 +19,92 @@
  */
 public class WronglyOrderedWays extends Test  {
-	protected static int WRONGLY_ORDERED_COAST = 1001;
-	protected static int WRONGLY_ORDERED_WATER = 1002;
-	protected static int WRONGLY_ORDERED_LAND  = 1003;
+    protected static int WRONGLY_ORDERED_COAST = 1001;
+    protected static int WRONGLY_ORDERED_WATER = 1002;
+    protected static int WRONGLY_ORDERED_LAND  = 1003;
 
-	/** The already detected errors */
-	Bag<Way, Way> _errorWays;
+    /** The already detected errors */
+    Bag<Way, Way> _errorWays;
 
-	/**
-	 * Constructor
-	 */
-	public WronglyOrderedWays()
-	{
-		super(tr("Wrongly Ordered Ways."),
-			  tr("This test checks the direction of water, land and coastline ways."));
-	}
+    /**
+     * Constructor
+     */
+    public WronglyOrderedWays()
+    {
+        super(tr("Wrongly Ordered Ways."),
+              tr("This test checks the direction of water, land and coastline ways."));
+    }
 
-	@Override
-	public void startTest()
-	{
-		_errorWays = new Bag<Way, Way>();
-	}
+    @Override
+    public void startTest()
+    {
+        _errorWays = new Bag<Way, Way>();
+    }
 
-	@Override
-	public void endTest()
-	{
-		_errorWays = null;
-	}
+    @Override
+    public void endTest()
+    {
+        _errorWays = null;
+    }
 
-	@Override
-	public void visit(Way w)
-	{
-		String errortype = "";
-		int type;
+    @Override
+    public void visit(Way w)
+    {
+        String errortype = "";
+        int type;
 
-		if( w.deleted || w.incomplete )
-			return;
+        if( w.deleted || w.incomplete )
+            return;
 
-		String natural = w.get("natural");
-		if( natural == null)
-			return;
+        String natural = w.get("natural");
+        if( natural == null)
+            return;
 
-		if( natural.equals("coastline") )
-		{
-			errortype = tr("Reversed coastline: land not on left side");
-			type= WRONGLY_ORDERED_COAST;
-		}
-		else if(natural.equals("water") )
-		{
-			errortype = tr("Reversed water: land not on left side");
-			type= WRONGLY_ORDERED_WATER;
-		}
-		else if( natural.equals("land") )
-		{
-			errortype = tr("Reversed land: land not on left side");
-			type= WRONGLY_ORDERED_LAND;
-		}
-		else
-			return;
+        if( natural.equals("coastline") )
+        {
+            errortype = tr("Reversed coastline: land not on left side");
+            type= WRONGLY_ORDERED_COAST;
+        }
+        else if(natural.equals("water") )
+        {
+            errortype = tr("Reversed water: land not on left side");
+            type= WRONGLY_ORDERED_WATER;
+        }
+        else if( natural.equals("land") )
+        {
+            errortype = tr("Reversed land: land not on left side");
+            type= WRONGLY_ORDERED_LAND;
+        }
+        else
+            return;
 
 
-		/**
-		 * Test the directionality of the way
-		 *
-		 * Assuming a closed non-looping way, compute twice the area
-		 * of the polygon using the formula 2*a = sum (Xn * Yn+1 - Xn+1 * Yn)
-		 * If the area is negative the way is ordered in a clockwise direction
-		 *
-		 */
+        /**
+         * Test the directionality of the way
+         *
+         * Assuming a closed non-looping way, compute twice the area
+         * of the polygon using the formula 2*a = sum (Xn * Yn+1 - Xn+1 * Yn)
+         * If the area is negative the way is ordered in a clockwise direction
+         *
+         */
 
-		if(w.nodes.get(0) == w.nodes.get(w.nodes.size()-1))
-		{
-			double area2 = 0;
+        if(w.nodes.get(0) == w.nodes.get(w.nodes.size()-1))
+        {
+            double area2 = 0;
 
-			for (int node = 1; node < w.nodes.size(); node++)
-			{
-				area2 += (w.nodes.get(node-1).coor.lon() * w.nodes.get(node).coor.lat()
-				- w.nodes.get(node).coor.lon() * w.nodes.get(node-1).coor.lat());
-			}
+            for (int node = 1; node < w.nodes.size(); node++)
+            {
+                area2 += (w.nodes.get(node-1).coor.lon() * w.nodes.get(node).coor.lat()
+                - w.nodes.get(node).coor.lon() * w.nodes.get(node-1).coor.lat());
+            }
 
-			if(((natural.equals("coastline") || natural.equals("land")) && area2 < 0.)
-			|| (natural.equals("water") && area2 > 0.))
-			{
-				List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
-				primitives.add(w);
-				errors.add( new TestError(this, Severity.WARNING, errortype, type, primitives) );
-				_errorWays.add(w,w);
-			}
-		}
-	}
+            if(((natural.equals("coastline") || natural.equals("land")) && area2 < 0.)
+            || (natural.equals("water") && area2 > 0.))
+            {
+                List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
+                primitives.add(w);
+                errors.add( new TestError(this, Severity.WARNING, errortype, type, primitives) );
+                _errorWays.add(w,w);
+            }
+        }
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/AgregatePrimitivesVisitor.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/AgregatePrimitivesVisitor.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/AgregatePrimitivesVisitor.java	(revision 12778)
@@ -12,58 +12,58 @@
  * <p>
  * The primitives are sorted according to their type: first nodes, then ways.
- * 
+ *
  * @author frsantos
  */
 public class AgregatePrimitivesVisitor implements Visitor
 {
-	/** Aggregated data */
-	Collection<OsmPrimitive> aggregatedData;
+    /** Aggregated data */
+    Collection<OsmPrimitive> aggregatedData;
 
-	/**
-	 * Constructor
-	 */
-	public AgregatePrimitivesVisitor() 
-	{
-		aggregatedData = new LinkedList<OsmPrimitive>();
-	}
+    /**
+     * Constructor
+     */
+    public AgregatePrimitivesVisitor()
+    {
+        aggregatedData = new LinkedList<OsmPrimitive>();
+    }
 
-	/**
-	 * Visits a collection of primitives 
-	 * @param data The collection of primitives 
-	 * @return The aggregated primitives
-	 */
-	public Collection<OsmPrimitive> visit(Collection<OsmPrimitive> data) 
-	{
-		for (OsmPrimitive osm : data) 
-		{
-			osm.visit(this);
-		}
-		
-		return aggregatedData;
-	}
+    /**
+     * Visits a collection of primitives
+     * @param data The collection of primitives
+     * @return The aggregated primitives
+     */
+    public Collection<OsmPrimitive> visit(Collection<OsmPrimitive> data)
+    {
+        for (OsmPrimitive osm : data)
+        {
+            osm.visit(this);
+        }
 
-	public void visit(Node n) 
-	{
-		if(!aggregatedData.contains(n))
-			aggregatedData.add(n);
-	}
+        return aggregatedData;
+    }
 
-	public void visit(Way w) 
-	{
-		if(!aggregatedData.contains(w))
-		{
-			aggregatedData.add(w);
-			for (Node n : w.nodes)
-				visit(n);
-		}
-	}
+    public void visit(Node n)
+    {
+        if(!aggregatedData.contains(n))
+            aggregatedData.add(n);
+    }
 
-	public void visit(Relation r) {
-		if (!aggregatedData.contains(r)) {
-			aggregatedData.add(r);
-			for (RelationMember m : r.members) {
-				m.member.visit(this);
-			}
-		}
-	}
+    public void visit(Way w)
+    {
+        if(!aggregatedData.contains(w))
+        {
+            aggregatedData.add(w);
+            for (Node n : w.nodes)
+                visit(n);
+        }
+    }
+
+    public void visit(Relation r) {
+        if (!aggregatedData.contains(r)) {
+            aggregatedData.add(r);
+            for (RelationMember m : r.members) {
+                m.member.visit(this);
+            }
+        }
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Bag.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Bag.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Bag.java	(revision 12778)
@@ -6,9 +6,9 @@
 
 /**
- * 
+ *
  * A very simple bag to store multiple occurences of a same key.
  * <p>
  * The bag will keep, for each key, a list of values.
- * 
+ *
  * @author frsantos
  *
@@ -16,5 +16,5 @@
  * @param <V> The value class
  */
-public class Bag<K,V> extends HashMap<K, List<V>> 
+public class Bag<K,V> extends HashMap<K, List<V>>
 {
     /** Serializable ID */
@@ -22,57 +22,57 @@
 
     /**
-	 * Returns the list of elements with the same key
-	 * @param key The key to obtain the elements
-	 * @return the list of elements with the same key
-	 */
-	public List<V> get(K key) 
-	{
-		return super.get(key);
-	}
+     * Returns the list of elements with the same key
+     * @param key The key to obtain the elements
+     * @return the list of elements with the same key
+     */
+    public List<V> get(K key)
+    {
+        return super.get(key);
+    }
 
-	/**
-	 * Adds an element to the bag
-	 * @param key The key of the element
-	 * @param value The element to add
-	 */
-	public void add(K key, V value) 
-	{
-		List<V> values = get(key);
-		if( values == null )
-		{
-			values = new ArrayList<V>();
-			put(key, values);
-		}
-		values.add(value);
-	}
+    /**
+     * Adds an element to the bag
+     * @param key The key of the element
+     * @param value The element to add
+     */
+    public void add(K key, V value)
+    {
+        List<V> values = get(key);
+        if( values == null )
+        {
+            values = new ArrayList<V>();
+            put(key, values);
+        }
+        values.add(value);
+    }
 
-	/**
-	 * Constructor
-	 */
-	public Bag() 
-	{
-		super();
-	}
+    /**
+     * Constructor
+     */
+    public Bag()
+    {
+        super();
+    }
 
-	/**
-	 * Constructor
-	 * 
-	 * @param initialCapacity The initial capacity
-	 */
-	public Bag(int initialCapacity) 
-	{
-		super(initialCapacity);
-	}
+    /**
+     * Constructor
+     *
+     * @param initialCapacity The initial capacity
+     */
+    public Bag(int initialCapacity)
+    {
+        super(initialCapacity);
+    }
 
-	/**
-	 * Returns true if the bag contains a value for a key
-	 * @param key The key
-	 * @param value The value
-	 * @return true if the key contains the value
-	 */
-	public boolean contains(K key, V value)
-	{
-		List<V> values = get(key);
-		return (values == null) ? false : values.contains(value);
-	}
+    /**
+     * Returns true if the bag contains a value for a key
+     * @param key The key
+     * @param value The value
+     * @return true if the key contains the value
+     */
+    public boolean contains(K key, V value)
+    {
+        List<V> values = get(key);
+        return (values == null) ? false : values.contains(value);
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Entities.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Entities.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Entities.java	(revision 12778)
@@ -6,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/MultipleNameVisitor.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/MultipleNameVisitor.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/MultipleNameVisitor.java	(revision 12778)
@@ -15,92 +15,92 @@
 /**
  * Able to create a name and an icon for a collection of elements.
- * 
+ *
  * @author frsantos
  */
-public class MultipleNameVisitor extends NameVisitor 
+public class MultipleNameVisitor extends NameVisitor
 {
-	/** The class name of the combined primitives */
-	String multipleClassname;
-	/* name to be displayed */
-	String displayName;
-	/** Size of the collection */
-	int size;
-	
-	/**
-	 * Visits a collection of primitives 
-	 * @param data The collection of primitives 
-	 */
-	public void visit(Collection<? extends OsmPrimitive> data) 
-	{
-		String multipleName = null;
-		String multiplePluralClassname = null;
-		String firstName = null;
-		boolean initializedname = false;
-		size = data.size();
+    /** The class name of the combined primitives */
+    String multipleClassname;
+    /* name to be displayed */
+    String displayName;
+    /** Size of the collection */
+    int size;
 
-		multipleClassname = null;
-		for (OsmPrimitive osm : data) 
-		{
-			String name = osm.get("name");
-			if(name == null) name = osm.get("ref");
-			if(!initializedname)
-			{
-				multipleName = name; initializedname = true;
-			}
-			else if(multipleName != null && (name == null  || !name.equals(multipleName)))
-			{
-				multipleName = null;
-			}
+    /**
+     * Visits a collection of primitives
+     * @param data The collection of primitives
+     */
+    public void visit(Collection<? extends OsmPrimitive> data)
+    {
+        String multipleName = null;
+        String multiplePluralClassname = null;
+        String firstName = null;
+        boolean initializedname = false;
+        size = data.size();
 
-			if(firstName == null && name != null)
-				firstName = name;
-			osm.visit(this);
-			if (multipleClassname == null)
-			{
-				multipleClassname = className;
-				multiplePluralClassname = classNamePlural;
-			}
-			else if (!multipleClassname.equals(className))
-			{
-				multipleClassname = "object";
-				multiplePluralClassname = trn("object", "objects", 2);
-			}
-		}
+        multipleClassname = null;
+        for (OsmPrimitive osm : data)
+        {
+            String name = osm.get("name");
+            if(name == null) name = osm.get("ref");
+            if(!initializedname)
+            {
+                multipleName = name; initializedname = true;
+            }
+            else if(multipleName != null && (name == null  || !name.equals(multipleName)))
+            {
+                multipleName = null;
+            }
 
-		if( size == 1 )
-			displayName = name;
-		else if(multipleName != null)
-			displayName = size + " " + trn(multipleClassname, multiplePluralClassname, size) + ": " + multipleName;
-		else if(firstName != null)
-			displayName = size + " " + trn(multipleClassname, multiplePluralClassname, size) + ": " + tr("{0}, ...", firstName);
-		else
-			displayName = size + " " + trn(multipleClassname, multiplePluralClassname, size);
-	}
+            if(firstName == null && name != null)
+                firstName = name;
+            osm.visit(this);
+            if (multipleClassname == null)
+            {
+                multipleClassname = className;
+                multiplePluralClassname = classNamePlural;
+            }
+            else if (!multipleClassname.equals(className))
+            {
+                multipleClassname = "object";
+                multiplePluralClassname = trn("object", "objects", 2);
+            }
+        }
 
-	@Override
-	public JLabel toLabel()
-	{
-		return new JLabel(getText(), getIcon(), JLabel.HORIZONTAL);
-	}
+        if( size == 1 )
+            displayName = name;
+        else if(multipleName != null)
+            displayName = size + " " + trn(multipleClassname, multiplePluralClassname, size) + ": " + multipleName;
+        else if(firstName != null)
+            displayName = size + " " + trn(multipleClassname, multiplePluralClassname, size) + ": " + tr("{0}, ...", firstName);
+        else
+            displayName = size + " " + trn(multipleClassname, multiplePluralClassname, size);
+    }
 
-	/**
-	 * Gets the name of the items
-	 * @return the name of the items
-	 */
-	public String getText()
-	{
-		return displayName;
-	}
+    @Override
+    public JLabel toLabel()
+    {
+        return new JLabel(getText(), getIcon(), JLabel.HORIZONTAL);
+    }
 
-	/**
-	 * Gets the icon of the items
-	 * @return the icon of the items
-	 */
-	public Icon getIcon()
-	{
-		if( size == 1 )
-			return icon;
-		else
-			return ImageProvider.get("data", multipleClassname);
-	}
+    /**
+     * Gets the name of the items
+     * @return the name of the items
+     */
+    public String getText()
+    {
+        return displayName;
+    }
+
+    /**
+     * Gets the icon of the items
+     * @return the icon of the items
+     */
+    public Icon getIcon()
+    {
+        if( size == 1 )
+            return icon;
+        else
+            return ImageProvider.get("data", multipleClassname);
+    }
 }
Index: /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Util.java
===================================================================
--- /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Util.java	(revision 12777)
+++ /applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Util.java	(revision 12778)
@@ -22,192 +22,192 @@
 public class Util
 {
-	/**
-	 * Returns the plugin's directory of the plugin
-	 *
-	 * @return The directory of the plugin
-	 */
-	public static String getPluginDir()
-	{
-		return Main.pref.getPreferencesDir() + "plugins/validator/";
-	}
-
-	/**
-	 * Returns the version
-	 * @return The version of the application
-	 */
-	public static Version getVersion()
-	{
-		PluginInformation info = PluginInformation.getLoaded("validator");
-		if( info == null )
-			return null;
-
-		return new Version(info.version, info.attr.get("Plugin-Date"));
-	}
-
-	/**
-	 * Utility class for displaying versions
-	 *
-	 * @author frsantos
-	 */
-	public static class Version
-	{
-		/** The revision */
-		public String revision;
-		/** The build time */
-		public String time;
-
-		/**
-		 * Constructor
-		 * @param revision
-		 * @param time
-		 */
-		public Version(String revision, String time)
-		{
-			this.revision = revision;
-			this.time = time;
-		}
-	}
-
-	/**
-	 * Returns the start and end cells of a way.
-	 * @param w The way
-	 * @param cellWays The map with all cells
-	 * @return A list with all the cells the way starts or ends
-	 */
-	public static List<List<Way>> getWaysInCell(Way w, Map<Point2D,List<Way>> cellWays)
-	{
-		if (w.nodes.size() == 0)
-			return Collections.emptyList();
-
-		Node n1 = w.nodes.get(0);
-		Node n2 = w.nodes.get(w.nodes.size() - 1);
-
-		List<List<Way>> cells = new ArrayList<List<Way>>(2);
-		Set<Point2D> cellNodes = new HashSet<Point2D>();
-		Point2D cell;
-
-		// First, round coordinates
-		long x0 = Math.round(n1.eastNorth.east()  * OSMValidatorPlugin.griddetail);
-		long y0 = Math.round(n1.eastNorth.north() * OSMValidatorPlugin.griddetail);
-		long x1 = Math.round(n2.eastNorth.east()  * OSMValidatorPlugin.griddetail);
-		long y1 = Math.round(n2.eastNorth.north() * OSMValidatorPlugin.griddetail);
-
-		// Start of the way
-		cell = new Point2D.Double(x0, y0);
-		cellNodes.add(cell);
-		List<Way> ways = cellWays.get( cell );
-		if( ways == null )
-		{
-			ways = new ArrayList<Way>();
-			cellWays.put(cell, ways);
-		}
-		cells.add(ways);
-
-		// End of the way
-		cell = new Point2D.Double(x1, y1);
-		if( !cellNodes.contains(cell) )
-		{
-			cellNodes.add(cell);
-			ways = cellWays.get( cell );
-			if( ways == null )
-			{
-				ways = new ArrayList<Way>();
-				cellWays.put(cell, ways);
-			}
-			cells.add(ways);
-		}
-
-		// Then floor coordinates, in case the way is in the border of the cell.
-		x0 = (long)Math.floor(n1.eastNorth.east()  * OSMValidatorPlugin.griddetail);
-		y0 = (long)Math.floor(n1.eastNorth.north() * OSMValidatorPlugin.griddetail);
-		x1 = (long)Math.floor(n2.eastNorth.east()  * OSMValidatorPlugin.griddetail);
-		y1 = (long)Math.floor(n2.eastNorth.north() * OSMValidatorPlugin.griddetail);
-
-		// Start of the way
-		cell = new Point2D.Double(x0, y0);
-		if( !cellNodes.contains(cell) )
-		{
-			cellNodes.add(cell);
-			ways = cellWays.get( cell );
-			if( ways == null )
-			{
-				ways = new ArrayList<Way>();
-				cellWays.put(cell, ways);
-			}
-			cells.add(ways);
-		}
-
-		// End of the way
-		cell = new Point2D.Double(x1, y1);
-		if( !cellNodes.contains(cell) )
-		{
-			cellNodes.add(cell);
-			ways = cellWays.get( cell );
-			if( ways == null )
-			{
-				ways = new ArrayList<Way>();
-				cellWays.put(cell, ways);
-			}
-			cells.add(ways);
-		}
-
-		return cells;
-	}
-
-	/**
-	 * Returns the coordinates of all cells in a grid that a line between 2
-	 * nodes intersects with.
-	 *
-	 * @param n1 The first node.
-	 * @param n2 The second node.
-	 * @param gridDetail The detail of the grid. Bigger values give smaller
-	 * cells, but a bigger number of them.
-	 * @return A list with the coordinates of all cells
-	 */
-	public static List<Point2D> getSegmentCells(Node n1, Node n2, double gridDetail)
-	{
-		List<Point2D> cells = new ArrayList<Point2D>();
-		double x0 = n1.eastNorth.east() * gridDetail;
-		double x1 = n2.eastNorth.east() * gridDetail;
-		double y0 = n1.eastNorth.north() * gridDetail + 1;
-		double y1 = n2.eastNorth.north() * gridDetail + 1;
-
-		if( x0 > x1 )
-		{
-			// Move to 1st-4th cuadrants
-			double aux;
-			aux = x0; x0 = x1; x1 = aux;
-			aux = y0; y0 = y1; y1 = aux;
-		}
-
-		double dx  = x1 - x0;
-		double dy  = y1 - y0;
-		long stepY = y0 <= y1 ? 1 : -1;
-		long gridX0 = (long)Math.floor(x0);
-		long gridX1 = (long)Math.floor(x1);
-		long gridY0 = (long)Math.floor(y0);
-		long gridY1 = (long)Math.floor(y1);
-
-		long maxSteps = (gridX1 - gridX0) + Math.abs(gridY1 - gridY0) + 1;
-		while( (gridX0 <= gridX1 && (gridY0 - gridY1)*stepY <= 0) && maxSteps-- > 0)
-		{
-			cells.add( new Point2D.Double(gridX0, gridY0) );
-
-			// Is the cross between the segment and next vertical line nearer than the cross with next horizontal line?
-			// Note: segment line formula: y=dy/dx(x-x1)+y1
-			// Note: if dy < 0, must use *bottom* line. If dy > 0, must use upper line
-			double scanY = dy/dx * (gridX0 + 1 - x1) + y1 + (dy < 0 ? -1 : 0);
-			double scanX = dx/dy * (gridY0 + (dy < 0 ? 0 : 1)*stepY - y1) + x1;
-
-			double distX = Math.pow(gridX0 + 1 - x0, 2) + Math.pow(scanY - y0, 2);
-			double distY = Math.pow(scanX - x0, 2) + Math.pow(gridY0 + stepY - y0, 2);
-
-			if( distX < distY)
-				gridX0 += 1;
-			else
-				gridY0 += stepY;
-		}
-
-		return cells;
-	}
+    /**
+     * Returns the plugin's directory of the plugin
+     *
+     * @return The directory of the plugin
+     */
+    public static String getPluginDir()
+    {
+        return Main.pref.getPreferencesDir() + "plugins/validator/";
+    }
+
+    /**
+     * Returns the version
+     * @return The version of the application
+     */
+    public static Version getVersion()
+    {
+        PluginInformation info = PluginInformation.getLoaded("validator");
+        if( info == null )
+            return null;
+
+        return new Version(info.version, info.attr.get("Plugin-Date"));
+    }
+
+    /**
+     * Utility class for displaying versions
+     *
+     * @author frsantos
+     */
+    public static class Version
+    {
+        /** The revision */
+        public String revision;
+        /** The build time */
+        public String time;
+
+        /**
+         * Constructor
+         * @param revision
+         * @param time
+         */
+        public Version(String revision, String time)
+        {
+            this.revision = revision;
+            this.time = time;
+        }
+    }
+
+    /**
+     * Returns the start and end cells of a way.
+     * @param w The way
+     * @param cellWays The map with all cells
+     * @return A list with all the cells the way starts or ends
+     */
+    public static List<List<Way>> getWaysInCell(Way w, Map<Point2D,List<Way>> cellWays)
+    {
+        if (w.nodes.size() == 0)
+            return Collections.emptyList();
+
+        Node n1 = w.nodes.get(0);
+        Node n2 = w.nodes.get(w.nodes.size() - 1);
+
+        List<List<Way>> cells = new ArrayList<List<Way>>(2);
+        Set<Point2D> cellNodes = new HashSet<Point2D>();
+        Point2D cell;
+
+        // First, round coordinates
+        long x0 = Math.round(n1.eastNorth.east()  * OSMValidatorPlugin.griddetail);
+        long y0 = Math.round(n1.eastNorth.north() * OSMValidatorPlugin.griddetail);
+        long x1 = Math.round(n2.eastNorth.east()  * OSMValidatorPlugin.griddetail);
+        long y1 = Math.round(n2.eastNorth.north() * OSMValidatorPlugin.griddetail);
+
+        // Start of the way
+        cell = new Point2D.Double(x0, y0);
+        cellNodes.add(cell);
+        List<Way> ways = cellWays.get( cell );
+        if( ways == null )
+        {
+            ways = new ArrayList<Way>();
+            cellWays.put(cell, ways);
+        }
+        cells.add(ways);
+
+        // End of the way
+        cell = new Point2D.Double(x1, y1);
+        if( !cellNodes.contains(cell) )
+        {
+            cellNodes.add(cell);
+            ways = cellWays.get( cell );
+            if( ways == null )
+            {
+                ways = new ArrayList<Way>();
+                cellWays.put(cell, ways);
+            }
+            cells.add(ways);
+        }
+
+        // Then floor coordinates, in case the way is in the border of the cell.
+        x0 = (long)Math.floor(n1.eastNorth.east()  * OSMValidatorPlugin.griddetail);
+        y0 = (long)Math.floor(n1.eastNorth.north() * OSMValidatorPlugin.griddetail);
+        x1 = (long)Math.floor(n2.eastNorth.east()  * OSMValidatorPlugin.griddetail);
+        y1 = (long)Math.floor(n2.eastNorth.north() * OSMValidatorPlugin.griddetail);
+
+        // Start of the way
+        cell = new Point2D.Double(x0, y0);
+        if( !cellNodes.contains(cell) )
+        {
+            cellNodes.add(cell);
+            ways = cellWays.get( cell );
+            if( ways == null )
+            {
+                ways = new ArrayList<Way>();
+                cellWays.put(cell, ways);
+            }
+            cells.add(ways);
+        }
+
+        // End of the way
+        cell = new Point2D.Double(x1, y1);
+        if( !cellNodes.contains(cell) )
+        {
+            cellNodes.add(cell);
+            ways = cellWays.get( cell );
+            if( ways == null )
+            {
+                ways = new ArrayList<Way>();
+                cellWays.put(cell, ways);
+            }
+            cells.add(ways);
+        }
+
+        return cells;
+    }
+
+    /**
+     * Returns the coordinates of all cells in a grid that a line between 2
+     * nodes intersects with.
+     *
+     * @param n1 The first node.
+     * @param n2 The second node.
+     * @param gridDetail The detail of the grid. Bigger values give smaller
+     * cells, but a bigger number of them.
+     * @return A list with the coordinates of all cells
+     */
+    public static List<Point2D> getSegmentCells(Node n1, Node n2, double gridDetail)
+    {
+        List<Point2D> cells = new ArrayList<Point2D>();
+        double x0 = n1.eastNorth.east() * gridDetail;
+        double x1 = n2.eastNorth.east() * gridDetail;
+        double y0 = n1.eastNorth.north() * gridDetail + 1;
+        double y1 = n2.eastNorth.north() * gridDetail + 1;
+
+        if( x0 > x1 )
+        {
+            // Move to 1st-4th cuadrants
+            double aux;
+            aux = x0; x0 = x1; x1 = aux;
+            aux = y0; y0 = y1; y1 = aux;
+        }
+
+        double dx  = x1 - x0;
+        double dy  = y1 - y0;
+        long stepY = y0 <= y1 ? 1 : -1;
+        long gridX0 = (long)Math.floor(x0);
+        long gridX1 = (long)Math.floor(x1);
+        long gridY0 = (long)Math.floor(y0);
+        long gridY1 = (long)Math.floor(y1);
+
+        long maxSteps = (gridX1 - gridX0) + Math.abs(gridY1 - gridY0) + 1;
+        while( (gridX0 <= gridX1 && (gridY0 - gridY1)*stepY <= 0) && maxSteps-- > 0)
+        {
+            cells.add( new Point2D.Double(gridX0, gridY0) );
+
+            // Is the cross between the segment and next vertical line nearer than the cross with next horizontal line?
+            // Note: segment line formula: y=dy/dx(x-x1)+y1
+            // Note: if dy < 0, must use *bottom* line. If dy > 0, must use upper line
+            double scanY = dy/dx * (gridX0 + 1 - x1) + y1 + (dy < 0 ? -1 : 0);
+            double scanX = dx/dy * (gridY0 + (dy < 0 ? 0 : 1)*stepY - y1) + x1;
+
+            double distX = Math.pow(gridX0 + 1 - x0, 2) + Math.pow(scanY - y0, 2);
+            double distY = Math.pow(scanX - x0, 2) + Math.pow(gridY0 + stepY - y0, 2);
+
+            if( distX < distY)
+                gridX0 += 1;
+            else
+                gridY0 += stepY;
+        }
+
+        return cells;
+    }
 }
Index: /applications/editors/josm/plugins/waypoints/src/WaypointOpenAction.java
===================================================================
--- /applications/editors/josm/plugins/waypoints/src/WaypointOpenAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/waypoints/src/WaypointOpenAction.java	(revision 12778)
@@ -29,46 +29,46 @@
  */
 public class WaypointOpenAction extends DiskAccessAction {
-	
-	/**
-	 * Create an open action. The name is "Open a file".
-	 */
-	public WaypointOpenAction() {
-		super(tr("Open waypoints file"), "open", tr("Open a waypoints file."),
-		Shortcut.registerShortcut("tools:waypoints", tr("Menu: {0}",
-		tr("Open waypoints file")), KeyEvent.VK_W, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT));
-	}
+    
+    /**
+     * Create an open action. The name is "Open a file".
+     */
+    public WaypointOpenAction() {
+        super(tr("Open waypoints file"), "open", tr("Open a waypoints file."),
+        Shortcut.registerShortcut("tools:waypoints", tr("Menu: {0}",
+        tr("Open waypoints file")), KeyEvent.VK_W, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT));
+    }
 
-	public void actionPerformed(ActionEvent e) {
-		JFileChooser fc = createAndOpenFileChooser(true, true, null);
-		if (fc == null)
-			return;
-		File[] files = fc.getSelectedFiles();
-		for (int i = files.length; i > 0; --i)
-			openFile(files[i-1]);
-	}
+    public void actionPerformed(ActionEvent e) {
+        JFileChooser fc = createAndOpenFileChooser(true, true, null);
+        if (fc == null)
+            return;
+        File[] files = fc.getSelectedFiles();
+        for (int i = files.length; i > 0; --i)
+            openFile(files[i-1]);
+    }
 
-	/**
-	 * Open the given file.
-	 */
-	public void openFile(File file) {
-		String fn = file.getName();
-		try {
-				DataSet dataSet = 
-						WaypointReader.parse(new FileInputStream(file));
-				Main.main.addLayer(new OsmDataLayer(dataSet, file.getName(), 
-										file));
-		} catch (SAXException x) {
-			x.printStackTrace();
-			JOptionPane.showMessageDialog(Main.parent, 
-					tr("Error while parsing {0}",fn)+": "+x.getMessage());
-		} catch (ParserConfigurationException x) {
-			x.printStackTrace(); // broken SAXException chaining
-			JOptionPane.showMessageDialog(Main.parent, 
-					tr("Error while parsing {0}",fn)+": "+x.getMessage());
-		} catch (IOException x) {
-			x.printStackTrace();
-			JOptionPane.showMessageDialog(Main.parent, 
-					tr("Could not read \"{0}\"",fn)+"\n"+x.getMessage());
-		}
-	}
+    /**
+     * Open the given file.
+     */
+    public void openFile(File file) {
+        String fn = file.getName();
+        try {
+                DataSet dataSet = 
+                        WaypointReader.parse(new FileInputStream(file));
+                Main.main.addLayer(new OsmDataLayer(dataSet, file.getName(), 
+                                        file));
+        } catch (SAXException x) {
+            x.printStackTrace();
+            JOptionPane.showMessageDialog(Main.parent, 
+                    tr("Error while parsing {0}",fn)+": "+x.getMessage());
+        } catch (ParserConfigurationException x) {
+            x.printStackTrace(); // broken SAXException chaining
+            JOptionPane.showMessageDialog(Main.parent, 
+                    tr("Error while parsing {0}",fn)+": "+x.getMessage());
+        } catch (IOException x) {
+            x.printStackTrace();
+            JOptionPane.showMessageDialog(Main.parent, 
+                    tr("Could not read \"{0}\"",fn)+"\n"+x.getMessage());
+        }
+    }
 }
Index: /applications/editors/josm/plugins/waypoints/src/WaypointPlugin.java
===================================================================
--- /applications/editors/josm/plugins/waypoints/src/WaypointPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/waypoints/src/WaypointPlugin.java	(revision 12778)
@@ -11,19 +11,19 @@
 
 
-	public WaypointPlugin() {
-		JMenuItem waypointItem = new JMenuItem(new WaypointOpenAction());
-		int index = findFirstSeparator();
-		Main.main.menu.fileMenu.add(waypointItem,index<0 ? 0: index);
-	}
+    public WaypointPlugin() {
+        JMenuItem waypointItem = new JMenuItem(new WaypointOpenAction());
+        int index = findFirstSeparator();
+        Main.main.menu.fileMenu.add(waypointItem,index<0 ? 0: index);
+    }
 
-	private int findFirstSeparator()
-	{
-		Component[] components = Main.main.menu.fileMenu.getMenuComponents();
-		for(int count=0; count<components.length; count++)
-		{
-			if(components[count] instanceof JSeparator)
-				return count;
-		}
-		return -1;
-	}
+    private int findFirstSeparator()
+    {
+        Component[] components = Main.main.menu.fileMenu.getMenuComponents();
+        for(int count=0; count<components.length; count++)
+        {
+            if(components[count] instanceof JSeparator)
+                return count;
+        }
+        return -1;
+    }
 }
Index: /applications/editors/josm/plugins/waypoints/src/WaypointReader.java
===================================================================
--- /applications/editors/josm/plugins/waypoints/src/WaypointReader.java	(revision 12777)
+++ /applications/editors/josm/plugins/waypoints/src/WaypointReader.java	(revision 12778)
@@ -1,3 +1,3 @@
-package waypoints; 
+package waypoints;
 
 import static org.openstreetmap.josm.tools.I18n.tr;
@@ -23,86 +23,86 @@
 public class WaypointReader {
 
-	private static class Parser extends DefaultHandler {
-		/**
-		 * Current track to be read. The last entry is the current trkpt.
-		 * If in wpt-mode, it contain only one GpsPoint.
-		 */
-	    private DataSet dataSet;
-		private LatLon currentLatLon;
-		private String curWptName;
-		private  boolean inName = false;
+    private static class Parser extends DefaultHandler {
+        /**
+         * Current track to be read. The last entry is the current trkpt.
+         * If in wpt-mode, it contain only one GpsPoint.
+         */
+        private DataSet dataSet;
+        private LatLon currentLatLon;
+        private String curWptName;
+        private  boolean inName = false;
 
-		// NW start	
-		// data now has two components: the GPS points and an OsmDataLayer.
-		// This is to allow us to convert waypoints straight to nodes.
-		// The way this works is that waypoints with a name not beginning
-		// with 0 - i.e. waypoints specially named - will be loaded in as
-		// nodes, in addition to going into the gpx layer. Other waypoints will
-		// only go into the gpx layer.
-		public Parser()
-		{
-			dataSet = new DataSet();
-		}
-		// NW end
+        // NW start
+        // data now has two components: the GPS points and an OsmDataLayer.
+        // This is to allow us to convert waypoints straight to nodes.
+        // The way this works is that waypoints with a name not beginning
+        // with 0 - i.e. waypoints specially named - will be loaded in as
+        // nodes, in addition to going into the gpx layer. Other waypoints will
+        // only go into the gpx layer.
+        public Parser()
+        {
+            dataSet = new DataSet();
+        }
+        // NW end
 
-		@Override public void startElement(String namespaceURI, 
-				String localName, String qName, Attributes atts) 
-					throws SAXException {
-			if (qName.equals("wpt")) {
-				try {
-	                double lat = Double.parseDouble(atts.getValue("lat"));
-	                double lon = Double.parseDouble(atts.getValue("lon"));
-	        		if (Math.abs(lat) > 90)
-	        			throw new SAXException
-						(tr("Data error: lat value \"{0}\" is out of bound.", 
-							lat));
-	        		if (Math.abs(lon) > 180)
-	        			throw new SAXException
-						(tr("Data error: lon value \"{0}\" is out of bound.", 
-							lon));
-	                currentLatLon = new LatLon(lat, lon);
+        @Override public void startElement(String namespaceURI,
+                String localName, String qName, Attributes atts)
+                    throws SAXException {
+            if (qName.equals("wpt")) {
+                try {
+                    double lat = Double.parseDouble(atts.getValue("lat"));
+                    double lon = Double.parseDouble(atts.getValue("lon"));
+                    if (Math.abs(lat) > 90)
+                        throw new SAXException
+                        (tr("Data error: lat value \"{0}\" is out of bound.",
+                            lat));
+                    if (Math.abs(lon) > 180)
+                        throw new SAXException
+                        (tr("Data error: lon value \"{0}\" is out of bound.",
+                            lon));
+                    currentLatLon = new LatLon(lat, lon);
                 } catch (NumberFormatException e) {
-                	e.printStackTrace();
-	                throw new SAXException(e);
+                    e.printStackTrace();
+                    throw new SAXException(e);
                 }
-			}
-			else if (qName.equals("name")) {
-				inName = true;
-				curWptName = "";	
-			}	
-		}
+            }
+            else if (qName.equals("name")) {
+                inName = true;
+                curWptName = "";
+            }
+        }
 
-		@Override public void characters(char[] ch, int start, int length) {
-			// NW start
-			if (inName) {
-				curWptName = new String (ch,start,length);
-			}
-			// NW end
-		}
+        @Override public void characters(char[] ch, int start, int length) {
+            // NW start
+            if (inName) {
+                curWptName = new String (ch,start,length);
+            }
+            // NW end
+        }
 
-		@Override public void endElement(String namespaceURI, String localName,
-					   					String qName) {
-			if (qName.equals("wpt") && curWptName!="") { 
-				// create a new node from the latitude and longitude
-				System.out.println("Found a waypoint to convert to a node: " 
-										+ curWptName);
-				Node node = new Node(currentLatLon);
-				node.put("name",curWptName);
-				dataSet.nodes.add(node);
-			}
-			else if (qName.equals("name")) {
-				inName = false;
-			}
+        @Override public void endElement(String namespaceURI, String localName,
+                                        String qName) {
+            if (qName.equals("wpt") && curWptName!="") {
+                // create a new node from the latitude and longitude
+                System.out.println("Found a waypoint to convert to a node: "
+                                        + curWptName);
+                Node node = new Node(currentLatLon);
+                node.put("name",curWptName);
+                dataSet.nodes.add(node);
+            }
+            else if (qName.equals("name")) {
+                inName = false;
+            }
         }
-	}
+    }
 
-	/**
-	 * Parse and return the read data
-	 */
-	public static DataSet parse(InputStream source) 
-			throws SAXException, IOException, ParserConfigurationException {
-		Parser parser = new Parser();
-		SAXParserFactory.newInstance().newSAXParser().parse(new InputSource(new InputStreamReader(source, "UTF-8")), parser);
-		return parser.dataSet;
-	}
+    /**
+     * Parse and return the read data
+     */
+    public static DataSet parse(InputStream source)
+            throws SAXException, IOException, ParserConfigurationException {
+        Parser parser = new Parser();
+        SAXParserFactory.newInstance().newSAXParser().parse(new InputSource(new InputStreamReader(source, "UTF-8")), parser);
+        return parser.dataSet;
+    }
 }
Index: /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/LatLng.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/LatLng.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/LatLng.java	(revision 12778)
@@ -3,9 +3,9 @@
 /**
  * Class to represent a latitude/longitude pair.
- * 
+ *
  * (c) 2006 Jonathan Stott
- * 
+ *
  * Created on 11-02-2006
- * 
+ *
  * @author Jonathan Stott
  * @version 1.0
@@ -27,5 +27,5 @@
   /**
    * Create a new LatLng object to represent a latitude/longitude pair.
-   * 
+   *
    * @param lat
    *          the latitude in degrees
@@ -42,5 +42,5 @@
   /**
    * Get a String representation of this LatLng object.
-   * 
+   *
    * @return a String representation of this LatLng object.
    * @since 1.0
@@ -54,5 +54,5 @@
    * Convert this latitude and longitude into an OSGB (Ordnance Survey of Great
    * Britain) grid reference.
-   * 
+   *
    * @return the converted OSGB grid reference
    * @since 1.0
@@ -124,5 +124,5 @@
   /**
    * Convert this latitude and longitude to a UTM reference.
-   * 
+   *
    * @return the converted UTM reference
    * @since 1.0
@@ -212,5 +212,5 @@
    * Convert this LatLng from the OSGB36 datum to the WGS84 datum using an
    * approximate Helmert transformation.
-   * 
+   *
    * @since 1.0
    */
@@ -260,5 +260,5 @@
    * Convert this LatLng from the WGS84 datum to the OSGB36 datum using an
    * approximate Helmert transformation.
-   * 
+   *
    * @since 1.0
    */
@@ -310,5 +310,5 @@
    * Calculate the surface distance in kilometres from the this LatLng to the
    * given LatLng.
-   * 
+   *
    * @param ll
    * @return the surface distance in km
@@ -334,5 +334,5 @@
   /**
    * Return the latitude in degrees.
-   * 
+   *
    * @return the latitude in degrees
    * @since 1.0
@@ -345,5 +345,5 @@
   /**
    * Return the longitude in degrees.
-   * 
+   *
    * @return the longitude in degrees
    * @since 1.0
Index: /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/OSRef.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/OSRef.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/OSRef.java	(revision 12778)
@@ -3,9 +3,9 @@
 /**
  * Class to represent an Ordnance Survey grid reference
- * 
+ *
  * (c) 2006 Jonathan Stott
- * 
+ *
  * Created on 11-02-2006
- * 
+ *
  * @author Jonathan Stott
  * @version 1.0
@@ -27,5 +27,5 @@
   /**
    * Create a new Ordnance Survey grid reference.
-   * 
+   *
    * @param easting
    *          the easting in metres
@@ -45,5 +45,5 @@
    * first character must be H, N, S, O or T. The second character can be any
    * uppercase character from A through Z excluding I.
-   * 
+   *
    * @param ref
    *          a String representing a six-figure Ordnance Survey grid reference
@@ -83,5 +83,5 @@
    * Return a String representation of this OSGB grid reference showing the
    * easting and northing.
-   * 
+   *
    * @return a String represenation of this OSGB grid reference
    * @since 1.0
@@ -95,5 +95,5 @@
    * Return a String representation of this OSGB grid reference using the
    * six-figure notation in the form XY123456
-   * 
+   *
    * @return a String representing this OSGB grid reference in six-figure
    *         notation
@@ -147,5 +147,5 @@
    * OSGB36 datum. Note that, the LatLng object may need to be converted to the
    * WGS84 datum depending on the application.
-   * 
+   *
    * @return a LatLng object representing this OSGB grid reference using the
    *         OSGB36 datum
@@ -225,5 +225,5 @@
   /**
    * Get the easting.
-   * 
+   *
    * @return the easting in metres
    * @since 1.0
@@ -236,5 +236,5 @@
   /**
    * Get the northing.
-   * 
+   *
    * @return the northing in metres
    * @since 1.0
Index: /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/RefEll.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/RefEll.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/RefEll.java	(revision 12778)
@@ -4,9 +4,9 @@
  * Class to represent a reference ellipsoid. Also provides a number of
  * pre-determined reference ellipsoids as constants.
- * 
+ *
  * (c) 2006 Jonathan Stott
- * 
+ *
  * Created on 11-Feb-2006
- * 
+ *
  * @author Jonathan Stott
  * @version 1.0
@@ -43,5 +43,5 @@
   /**
    * Create a new reference ellipsoid
-   * 
+   *
    * @param maj
    *          semi-major axis
@@ -59,5 +59,5 @@
   /**
    * Return the semi-major axis.
-   * 
+   *
    * @return the semi-major axis
    * @since 1.0
@@ -70,5 +70,5 @@
   /**
    * Return the semi-minor axis
-   * 
+   *
    * @return the semi-minor axis
    * @since 1.0
@@ -81,5 +81,5 @@
   /**
    * Return the eccentricity.
-   * 
+   *
    * @return the eccentricity
    * @since 1.0
Index: /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/Test.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/Test.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/Test.java	(revision 12778)
@@ -4,9 +4,9 @@
  * Class to illustrate the use of the various functions of the classes in the
  * Jcoord package.
- * 
+ *
  * (c) 2006 Jonathan Stott
- * 
+ *
  * Created on 11-Feb-2006
- * 
+ *
  * @author Jonathan Stott
  * @version 1.0
@@ -17,5 +17,5 @@
   /**
    * Main method
-   * 
+   *
    * @param args
    *          not used
@@ -26,5 +26,5 @@
     /*
      * Calculate Surface Distance between two Latitudes/Longitudes
-     * 
+     *
      * The distance() function takes a reference to a LatLng object as a
      * parameter and calculates the surface distance between the the given
@@ -45,5 +45,5 @@
     /*
      * Convert OS Grid Reference to Latitude/Longitude
-     * 
+     *
      * Note that the OSGB-Latitude/Longitude conversions use the OSGB36 datum by
      * default. The majority of applications use the WGS84 datum, for which the
@@ -76,5 +76,5 @@
     /*
      * Convert Latitude/Longitude to OS Grid Reference
-     * 
+     *
      * Note that the OSGB-Latitude/Longitude conversions use the OSGB36 datum by
      * default. The majority of applications use the WGS84 datum, for which the
@@ -107,5 +107,5 @@
     /*
      * Convert Six-Figure OS Grid Reference String to an OSRef Object
-     * 
+     *
      * To convert a string representing a six-figure OSGB grid reference:
      */
Index: /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/UTMRef.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/UTMRef.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/UTMRef.java	(revision 12778)
@@ -3,9 +3,9 @@
 /**
  * Class to represent a UTM reference
- * 
+ *
  * (c) 2006 Jonathan Stott
- * 
+ *
  * Created on 11-Feb-2006
- * 
+ *
  * @author Jonathan Stott
  * @version 1.0
@@ -37,5 +37,5 @@
   /**
    * Create a new UTM reference object.
-   * 
+   *
    * @param easting
    *          the easting
@@ -58,5 +58,5 @@
   /**
    * Convert this UTM reference to a latitude and longitude.
-   * 
+   *
    * @return the converted latitude and longitude
    * @since 1.0
@@ -130,5 +130,5 @@
   /**
    * Work out the UTM latitude zone from the latitude.
-   * 
+   *
    * @param latitude
    *          the latitude to find the UTM latitude zone for
@@ -184,5 +184,5 @@
   /**
    * Convert this UTM reference to a String representation for printing out.
-   * 
+   *
    * @return a String representation of this UTM reference
    * @since 1.0
@@ -196,5 +196,5 @@
   /**
    * Get the easting.
-   * 
+   *
    * @return the easting
    * @since 1.0
@@ -207,5 +207,5 @@
   /**
    * Get the northing.
-   * 
+   *
    * @return the northing
    * @since 1.0
@@ -218,5 +218,5 @@
   /**
    * Get the latitude zone character.
-   * 
+   *
    * @return the latitude zone character
    * @since 1.0
@@ -229,5 +229,5 @@
   /**
    * Get the longitude zone number.
-   * 
+   *
    * @return the longitude zone number
    * @since 1.0
Index: /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/Util.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/Util.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/uk/me/jstott/jcoord/Util.java	(revision 12778)
@@ -3,9 +3,9 @@
 /**
  * Some utility functions used by classes in the uk.me.jstott.jcoord package.
- * 
+ *
  * (c) 2006 Jonathan Stott
- * 
+ *
  * Created on 11-Feb-2006
- * 
+ *
  * @author Jonathan Stott
  * @version 1.0
@@ -16,5 +16,5 @@
   /**
    * Calculate sin^2(x).
-   * 
+   *
    * @param x
    *          x
@@ -29,5 +29,5 @@
   /**
    * Calculate cos^2(x).
-   * 
+   *
    * @param x
    *          x
@@ -42,5 +42,5 @@
   /**
    * Calculate tan^2(x).
-   * 
+   *
    * @param x
    *          x
@@ -55,5 +55,5 @@
   /**
    * Calculate sec(x).
-   * 
+   *
    * @param x
    *          x
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java	(revision 12778)
@@ -15,59 +15,59 @@
 
 public class GeorefImage implements Serializable {
-	public BufferedImage image = null;
-	public EastNorth min, max;
-	public boolean downloadingStarted;
+    public BufferedImage image = null;
+    public EastNorth min, max;
+    public boolean downloadingStarted;
 
-	public GeorefImage(boolean downloadingStarted) {
-		this.downloadingStarted = downloadingStarted;
-	}
+    public GeorefImage(boolean downloadingStarted) {
+        this.downloadingStarted = downloadingStarted;
+    }
 
-	public boolean contains(EastNorth en, double dx, double dy) {
-		return min.east()+dx <= en.east() && en.east() <= max.east()+dx
-			&& min.north()+dy <= en.north() && en.north() <= max.north()+dy;
-	}
+    public boolean contains(EastNorth en, double dx, double dy) {
+        return min.east()+dx <= en.east() && en.east() <= max.east()+dx
+            && min.north()+dy <= en.north() && en.north() <= max.north()+dy;
+    }
 
-	/* this does not take dx and dy offset into account! */
-	public boolean isVisible(NavigatableComponent nc) {
-		Point minPt = nc.getPoint(min), maxPt = nc.getPoint(max);
-		Graphics g = nc.getGraphics();
+    /* this does not take dx and dy offset into account! */
+    public boolean isVisible(NavigatableComponent nc) {
+        Point minPt = nc.getPoint(min), maxPt = nc.getPoint(max);
+        Graphics g = nc.getGraphics();
 
-		return (g.hitClip(minPt.x, maxPt.y,
-				maxPt.x - minPt.x, minPt.y - maxPt.y));
-	}
+        return (g.hitClip(minPt.x, maxPt.y,
+                maxPt.x - minPt.x, minPt.y - maxPt.y));
+    }
 
-	public boolean paint(Graphics g, NavigatableComponent nc, double dx, double dy) {
-		if (image == null || min == null || max == null) return false;
+    public boolean paint(Graphics g, NavigatableComponent nc, double dx, double dy) {
+        if (image == null || min == null || max == null) return false;
 
-		EastNorth mi = new EastNorth(min.east()+dx, min.north()+dy);
-		EastNorth ma = new EastNorth(max.east()+dx, max.north()+dy);
-		Point minPt = nc.getPoint(mi), maxPt = nc.getPoint(ma);
+        EastNorth mi = new EastNorth(min.east()+dx, min.north()+dy);
+        EastNorth ma = new EastNorth(max.east()+dx, max.north()+dy);
+        Point minPt = nc.getPoint(mi), maxPt = nc.getPoint(ma);
 
-		/* this is isVisible() but taking dx, dy into account */
-		if(!(g.hitClip(minPt.x, maxPt.y,
-				maxPt.x - minPt.x, minPt.y - maxPt.y)))
-			return false;
+        /* this is isVisible() but taking dx, dy into account */
+        if(!(g.hitClip(minPt.x, maxPt.y,
+                maxPt.x - minPt.x, minPt.y - maxPt.y)))
+            return false;
 
-		g.drawImage(image,
-			minPt.x, maxPt.y, maxPt.x, minPt.y, // dest
-			0, 0, image.getWidth(), image.getHeight(), // src
-			null);
+        g.drawImage(image,
+            minPt.x, maxPt.y, maxPt.x, minPt.y, // dest
+            0, 0, image.getWidth(), image.getHeight(), // src
+            null);
 
-		return true;
-	}
+        return true;
+    }
 
-	private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
-		max = (EastNorth) in.readObject();
-		min = (EastNorth) in.readObject();
-		image = (BufferedImage) ImageIO.read(ImageIO.createImageInputStream(in));
-	}
-	
-	private void writeObject(ObjectOutputStream out) throws IOException {
-		out.writeObject(max);
-		out.writeObject(min);
-		if(image == null)
-			out.writeObject(null);
-		else
-			ImageIO.write(image, "png", ImageIO.createImageOutputStream(out));
-	}
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        max = (EastNorth) in.readObject();
+        min = (EastNorth) in.readObject();
+        image = (BufferedImage) ImageIO.read(ImageIO.createImageInputStream(in));
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        out.writeObject(max);
+        out.writeObject(min);
+        if(image == null)
+            out.writeObject(null);
+        else
+            ImageIO.write(image, "png", ImageIO.createImageOutputStream(out));
+    }
 }
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Grabber.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Grabber.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Grabber.java	(revision 12778)
@@ -14,64 +14,64 @@
 
 abstract public class Grabber implements Runnable {
-	protected Bounds b;
-	protected Projection proj;
-	protected double pixelPerDegree;
-	protected MapView mv;
-	protected WMSLayer layer;
-	protected GeorefImage image;
+    protected Bounds b;
+    protected Projection proj;
+    protected double pixelPerDegree;
+    protected MapView mv;
+    protected WMSLayer layer;
+    protected GeorefImage image;
 
-	Grabber(Bounds b, Projection proj,
-			double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer) {
-		this.b = b;
-		this.proj = proj;
-		this.pixelPerDegree = pixelPerDegree;
-		this.image = image;
-		this.mv = mv;
-		this.layer = layer;
-	}
+    Grabber(Bounds b, Projection proj,
+            double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer) {
+        this.b = b;
+        this.proj = proj;
+        this.pixelPerDegree = pixelPerDegree;
+        this.image = image;
+        this.mv = mv;
+        this.layer = layer;
+    }
 
-	abstract void fetch() throws Exception; // the image fetch code
+    abstract void fetch() throws Exception; // the image fetch code
 
-	int width(){
-		return (int) ((b.max.lon() - b.min.lon()) * pixelPerDegree);
-	}
-	int height(){
-		return (int) ((b.max.lat() - b.min.lat()) * pixelPerDegree);
-	}
+    int width(){
+        return (int) ((b.max.lon() - b.min.lon()) * pixelPerDegree);
+    }
+    int height(){
+        return (int) ((b.max.lat() - b.min.lat()) * pixelPerDegree);
+    }
 
-	protected void grabError(Exception e){ // report error when grabing image
-		e.printStackTrace();
-		
-		BufferedImage img = new BufferedImage(width(), height(), BufferedImage.TYPE_INT_ARGB);
-		Graphics g = img.getGraphics();
-		g.setColor(Color.RED);
-		g.fillRect(0, 0, width(), height());
-		Font font = g.getFont();
-		Font tempFont = font.deriveFont(Font.PLAIN).deriveFont(36.0f);
-		g.setFont(tempFont);
-		g.setColor(Color.BLACK);
-		g.drawString(tr("Exception occurred"), 10, height()/2);
-		image.image = img;
-		g.setFont(font);
-	}
+    protected void grabError(Exception e){ // report error when grabing image
+        e.printStackTrace();
 
-	protected void attempt(){ // try to fetch the image
-		int maxTries = 5; // n tries for every image
-		for (int i = 1; i <= maxTries; i++) {
-			try {
-				fetch();
-				break; // break out of the retry loop
-			} catch (Exception e) {
-				try { // sleep some time and then ask the server again
-					Thread.sleep(random(1000, 2000));
-				} catch (InterruptedException e1) {}
+        BufferedImage img = new BufferedImage(width(), height(), BufferedImage.TYPE_INT_ARGB);
+        Graphics g = img.getGraphics();
+        g.setColor(Color.RED);
+        g.fillRect(0, 0, width(), height());
+        Font font = g.getFont();
+        Font tempFont = font.deriveFont(Font.PLAIN).deriveFont(36.0f);
+        g.setFont(tempFont);
+        g.setColor(Color.BLACK);
+        g.drawString(tr("Exception occurred"), 10, height()/2);
+        image.image = img;
+        g.setFont(font);
+    }
 
-				if(i == maxTries) grabError(e);
-			}
-		}
-	}
+    protected void attempt(){ // try to fetch the image
+        int maxTries = 5; // n tries for every image
+        for (int i = 1; i <= maxTries; i++) {
+            try {
+                fetch();
+                break; // break out of the retry loop
+            } catch (Exception e) {
+                try { // sleep some time and then ask the server again
+                    Thread.sleep(random(1000, 2000));
+                } catch (InterruptedException e1) {}
 
-	public static int random(int min, int max) {
-	    return (int)(Math.random() * ((max+1)-min) ) + min;
-	}
+                if(i == maxTries) grabError(e);
+            }
+        }
+    }
+
+    public static int random(int min, int max) {
+        return (int)(Math.random() * ((max+1)-min) ) + min;
+    }
 }
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Help_WMSmenuAction.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Help_WMSmenuAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Help_WMSmenuAction.java	(revision 12778)
@@ -11,51 +11,51 @@
 public class Help_WMSmenuAction extends JosmAction {
 
-	/**
-	 * 
-	 */
-	
+    /**
+     * 
+     */
+    
 
-	public Help_WMSmenuAction() {
-		//super("Help / About");
-		super(tr("help"), "help", tr("Help / About"), null, false);
-		
-	}
-	
-	public void actionPerformed(ActionEvent e) {
-		//todo - put this into a txt file? 
-		  String helptext = 
-			tr("You can add, edit and delete WMS entries in the WMSplugin Preference Tab - "  +
-			"these will then show up in the WMS menu.\n\n"+
-			
-			"You can also do this manually in the Advanced Preferences, using the following schema:\n"+
-			"wmsplugin.url.1.name=Landsat\n"+
-			"wmsplugin.url.1.url=http://onearth.jpl.nasa.gov....\n"+
-			"wmsplugin.url.2.name=NPE Maps... etc\n\n"+
-					
-			"Full WMS URL input format example (landsat)\n"+
-			"http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&\n"+
-			"layers=global_mosaic&styles=&srs=EPSG:4326&\n"+
-			"format=image/jpeg \n\n"+
-			
-			"For Metacarta's Map Rectifier http://labs.metacarta.com/rectifier/ , you only need to input the relevant 'id'.\n" +
-			"To add a Metacarta Map Rectifier menu item, manually create the URL like in this example," +
-			"replacing 73 with your image id: \n" +
-			"http://labs.metacarta.com/rectifier/wms.cgi?id=73\n" +
-			"&srs=EPSG:4326&Service=WMS&Version=1.1.0&Request=GetMap&format=image/png\n" +
-			" \n" +
-			"Note: Make sure the image is suitable, copyright-wise, if in doubt, don't use.");
-		
-		JTextPane tp = new JTextPane();
-		  JScrollPane js = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
-				  JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
-		 
-		  
-		  js.getViewport().add(tp);
-		  JFrame jf = new JFrame(tr("WMS Plugin Help"));
-		  jf.getContentPane().add(js);
-		  jf.pack();
-		  jf.setSize(400,500);
-		  jf.setVisible(true); 
-		  tp.setText(helptext);
-	}
+    public Help_WMSmenuAction() {
+        //super("Help / About");
+        super(tr("help"), "help", tr("Help / About"), null, false);
+        
+    }
+    
+    public void actionPerformed(ActionEvent e) {
+        //todo - put this into a txt file? 
+          String helptext = 
+            tr("You can add, edit and delete WMS entries in the WMSplugin Preference Tab - "  +
+            "these will then show up in the WMS menu.\n\n"+
+            
+            "You can also do this manually in the Advanced Preferences, using the following schema:\n"+
+            "wmsplugin.url.1.name=Landsat\n"+
+            "wmsplugin.url.1.url=http://onearth.jpl.nasa.gov....\n"+
+            "wmsplugin.url.2.name=NPE Maps... etc\n\n"+
+                    
+            "Full WMS URL input format example (landsat)\n"+
+            "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&\n"+
+            "layers=global_mosaic&styles=&srs=EPSG:4326&\n"+
+            "format=image/jpeg \n\n"+
+            
+            "For Metacarta's Map Rectifier http://labs.metacarta.com/rectifier/ , you only need to input the relevant 'id'.\n" +
+            "To add a Metacarta Map Rectifier menu item, manually create the URL like in this example," +
+            "replacing 73 with your image id: \n" +
+            "http://labs.metacarta.com/rectifier/wms.cgi?id=73\n" +
+            "&srs=EPSG:4326&Service=WMS&Version=1.1.0&Request=GetMap&format=image/png\n" +
+            " \n" +
+            "Note: Make sure the image is suitable, copyright-wise, if in doubt, don't use.");
+        
+        JTextPane tp = new JTextPane();
+          JScrollPane js = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+                  JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+         
+          
+          js.getViewport().add(tp);
+          JFrame jf = new JFrame(tr("WMS Plugin Help"));
+          jf.getContentPane().add(js);
+          jf.pack();
+          jf.setSize(400,500);
+          jf.setVisible(true); 
+          tp.setText(helptext);
+    }
 }
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Map_Rectifier_WMSmenuAction.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Map_Rectifier_WMSmenuAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Map_Rectifier_WMSmenuAction.java	(revision 12778)
@@ -12,25 +12,25 @@
 public class Map_Rectifier_WMSmenuAction extends JosmAction {
 
-	/**
-	 * tim waters "chippy"
-	 */
-	private static final long serialVersionUID = 1L;
+    /**
+     * tim waters "chippy"
+     */
+    private static final long serialVersionUID = 1L;
 
-	public Map_Rectifier_WMSmenuAction() {
-		super(tr("Rectified Image ..."), "OLmarker", tr("Download Rectified Image from Metacarta's Map Rectifier WMS"), null, false);
-	}
+    public Map_Rectifier_WMSmenuAction() {
+        super(tr("Rectified Image ..."), "OLmarker", tr("Download Rectified Image from Metacarta's Map Rectifier WMS"), null, false);
+    }
 
-	public void actionPerformed(ActionEvent e) {
-		String newid = JOptionPane.showInputDialog(Main.parent, tr("Metacarta Map Rectifier image id"),
-		Main.pref.get("wmsplugin.rectifier_id"));
+    public void actionPerformed(ActionEvent e) {
+        String newid = JOptionPane.showInputDialog(Main.parent, tr("Metacarta Map Rectifier image id"),
+        Main.pref.get("wmsplugin.rectifier_id"));
 
-		if (newid != null && !newid.equals("")) {
-			String newURL = "http://labs.metacarta.com/rectifier/wms.cgi?id="+newid+
-			"&srs=EPSG:4326&Service=WMS&Version=1.1.0&Request=GetMap&format=image/png";
+        if (newid != null && !newid.equals("")) {
+            String newURL = "http://labs.metacarta.com/rectifier/wms.cgi?id="+newid+
+            "&srs=EPSG:4326&Service=WMS&Version=1.1.0&Request=GetMap&format=image/png";
 
-			Main.pref.put("wmsplugin.rectifier_id", newid);
-			WMSLayer wmsLayer = new WMSLayer(tr("rectifier id={0}",newid), newURL);
-			Main.main.addLayer(wmsLayer);
-		}
-	}
+            Main.pref.put("wmsplugin.rectifier_id", newid);
+            WMSLayer wmsLayer = new WMSLayer(tr("rectifier id={0}",newid), newURL);
+            Main.main.addLayer(wmsLayer);
+        }
+    }
 }
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/OSGBGrabber.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/OSGBGrabber.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/OSGBGrabber.java	(revision 12778)
@@ -15,50 +15,50 @@
 // FIXME: Remove this hack when we have proper projection support.
 public class OSGBGrabber extends WMSGrabber {
-	public OSGBGrabber(String baseURL) {
-		super(baseURL);
-	}
+    public OSGBGrabber(String baseURL) {
+        super(baseURL);
+    }
 
-	private Epsg4326 latlonProj = new Epsg4326();
+    private Epsg4326 latlonProj = new Epsg4326();
 
-	@Override public GeorefImage grab(Bounds b, Projection proj,
-			double pixelPerDegree) throws IOException {
-		Bounds bnew = toOSGB(b);
-		double pixelPerDegreeNew =
-			pixelPerDegree / (bnew.max.lon() - bnew.min.lon())
-				* (b.max.lon() - b.min.lon());
+    @Override public GeorefImage grab(Bounds b, Projection proj,
+            double pixelPerDegree) throws IOException {
+        Bounds bnew = toOSGB(b);
+        double pixelPerDegreeNew =
+            pixelPerDegree / (bnew.max.lon() - bnew.min.lon())
+                * (b.max.lon() - b.min.lon());
 
-		GeorefImage img = super.grab(bnew, latlonProj, pixelPerDegreeNew);
+        GeorefImage img = super.grab(bnew, latlonProj, pixelPerDegreeNew);
 
-		img.min = proj.latlon2eastNorth(fromOSGB(img.min));
-		img.max = proj.latlon2eastNorth(fromOSGB(img.max));
+        img.min = proj.latlon2eastNorth(fromOSGB(img.min));
+        img.max = proj.latlon2eastNorth(fromOSGB(img.max));
 
-		return img;
-	}
+        return img;
+    }
 
-	protected static Bounds toOSGB(Bounds b) {
-		LatLng[] lls = new LatLng[] {
-			new LatLng(b.min.lat(), b.min.lon()),
-			new LatLng(b.min.lat(), b.max.lon()),
-			new LatLng(b.max.lat(), b.min.lon()),
-			new LatLng(b.max.lat(), b.max.lon()) };
+    protected static Bounds toOSGB(Bounds b) {
+        LatLng[] lls = new LatLng[] {
+            new LatLng(b.min.lat(), b.min.lon()),
+            new LatLng(b.min.lat(), b.max.lon()),
+            new LatLng(b.max.lat(), b.min.lon()),
+            new LatLng(b.max.lat(), b.max.lon()) };
 
-		for (LatLng ll : lls) ll.toOSGB36();
+        for (LatLng ll : lls) ll.toOSGB36();
 
-		OSRef[] grs = new OSRef[lls.length];
-		for (int i = 0; i < lls.length; i++) grs[i] = lls[i].toOSRef();
+        OSRef[] grs = new OSRef[lls.length];
+        for (int i = 0; i < lls.length; i++) grs[i] = lls[i].toOSRef();
 
-		LatLon latlon = new LatLon(grs[0].getNorthing(), grs[0].getEasting());
-		Bounds bnew = new Bounds(latlon, latlon);
-		for (int i = 1; i < grs.length; i++)
-			bnew.extend(new LatLon(grs[i].getNorthing(), grs[i].getEasting()));
+        LatLon latlon = new LatLon(grs[0].getNorthing(), grs[0].getEasting());
+        Bounds bnew = new Bounds(latlon, latlon);
+        for (int i = 1; i < grs.length; i++)
+            bnew.extend(new LatLon(grs[i].getNorthing(), grs[i].getEasting()));
 
-		return bnew;
-	}
+        return bnew;
+    }
 
-	protected static LatLon fromOSGB(EastNorth en) {
-		LatLng ll = new OSRef(en.east(), en.north()).toLatLng();
-		ll.toWGS84();
-		return new LatLon(ll.getLat(), ll.getLng());
-	}
+    protected static LatLon fromOSGB(EastNorth en) {
+        LatLng ll = new OSRef(en.east(), en.north()).toLatLng();
+        ll.toWGS84();
+        return new LatLon(ll.getLat(), ll.getLng());
+    }
 }
 */
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSAdjustAction.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSAdjustAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSAdjustAction.java	(revision 12778)
@@ -17,78 +17,78 @@
 
 public class WMSAdjustAction extends MapMode implements
-		MouseListener, MouseMotionListener{
+        MouseListener, MouseMotionListener{
 
-	GeorefImage selectedImage;
-	WMSLayer selectedLayer;
-	boolean mouseDown;
-	EastNorth prevEastNorth;
+    GeorefImage selectedImage;
+    WMSLayer selectedLayer;
+    boolean mouseDown;
+    EastNorth prevEastNorth;
 
-	public WMSAdjustAction(MapFrame mapFrame) {
-		super(tr("Adjust WMS"), "adjustwms", 
-						tr("Adjust the position of the WMS layer"), mapFrame, 
-						ImageProvider.getCursor("normal", "move"));
-	}
+    public WMSAdjustAction(MapFrame mapFrame) {
+        super(tr("Adjust WMS"), "adjustwms", 
+                        tr("Adjust the position of the WMS layer"), mapFrame, 
+                        ImageProvider.getCursor("normal", "move"));
+    }
 
-	@Override public void enterMode() {
-		super.enterMode();
-		Main.map.mapView.addMouseListener(this);
-		Main.map.mapView.addMouseMotionListener(this);
-	}
+    @Override public void enterMode() {
+        super.enterMode();
+        Main.map.mapView.addMouseListener(this);
+        Main.map.mapView.addMouseMotionListener(this);
+    }
 
-	@Override public void exitMode() {
-		super.exitMode();
-		Main.map.mapView.removeMouseListener(this);
-		Main.map.mapView.removeMouseMotionListener(this);
-	}
+    @Override public void exitMode() {
+        super.exitMode();
+        Main.map.mapView.removeMouseListener(this);
+        Main.map.mapView.removeMouseMotionListener(this);
+    }
 
-	@Override public void mousePressed(MouseEvent e) {
-		if (e.getButton() != MouseEvent.BUTTON1)
-			return;
+    @Override public void mousePressed(MouseEvent e) {
+        if (e.getButton() != MouseEvent.BUTTON1)
+            return;
 
-		 for(Layer layer:Main.map.mapView.getAllLayers()) {
-			if (layer.visible && layer instanceof WMSLayer) {
-				prevEastNorth=Main.map.mapView.getEastNorth(e.getX(),e.getY());
-				selectedLayer = ((WMSLayer)layer);
-				selectedImage = selectedLayer.findImage(prevEastNorth);
-				if(selectedImage!=null){
-					Main.map.mapView.setCursor
-						(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
-				}
-			}
-		}
-	}
+         for(Layer layer:Main.map.mapView.getAllLayers()) {
+            if (layer.visible && layer instanceof WMSLayer) {
+                prevEastNorth=Main.map.mapView.getEastNorth(e.getX(),e.getY());
+                selectedLayer = ((WMSLayer)layer);
+                selectedImage = selectedLayer.findImage(prevEastNorth);
+                if(selectedImage!=null){
+                    Main.map.mapView.setCursor
+                        (Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
+                }
+            }
+        }
+    }
 
-	@Override public void mouseDragged(MouseEvent e) {
-			/*
-		if (e.getButton() != MouseEvent.BUTTON1)
-			return;
-			*/
+    @Override public void mouseDragged(MouseEvent e) {
+            /*
+        if (e.getButton() != MouseEvent.BUTTON1)
+            return;
+            */
 
-		if(selectedImage!=null) {
-			EastNorth eastNorth=
-					Main.map.mapView.getEastNorth(e.getX(),e.getY());
-		        selectedLayer.displace(eastNorth.east()-prevEastNorth.east(), 
-				eastNorth.north()-prevEastNorth.north());
-			prevEastNorth = eastNorth;
-			Main.map.mapView.repaint();
-		}
-	}
+        if(selectedImage!=null) {
+            EastNorth eastNorth=
+                    Main.map.mapView.getEastNorth(e.getX(),e.getY());
+                selectedLayer.displace(eastNorth.east()-prevEastNorth.east(), 
+                eastNorth.north()-prevEastNorth.north());
+            prevEastNorth = eastNorth;
+            Main.map.mapView.repaint();
+        }
+    }
 
-	@Override public void mouseReleased(MouseEvent e) {
-		Main.map.mapView.repaint();
-		Main.map.mapView.setCursor(Cursor.getDefaultCursor());
-		selectedImage = null;	
-		prevEastNorth = null;
-		selectedLayer = null;
-	}
+    @Override public void mouseReleased(MouseEvent e) {
+        Main.map.mapView.repaint();
+        Main.map.mapView.setCursor(Cursor.getDefaultCursor());
+        selectedImage = null;   
+        prevEastNorth = null;
+        selectedLayer = null;
+    }
 
-	public void mouseEntered(MouseEvent e) {
-	}
-	public void mouseExited(MouseEvent e) {
-	}
-	public void mouseMoved(MouseEvent e) {
-	}
+    public void mouseEntered(MouseEvent e) {
+    }
+    public void mouseExited(MouseEvent e) {
+    }
+    public void mouseMoved(MouseEvent e) {
+    }
 
-	@Override public void mouseClicked(MouseEvent e) {
-	}
+    @Override public void mouseClicked(MouseEvent e) {
+    }
 }
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSDownloadAction.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSDownloadAction.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSDownloadAction.java	(revision 12778)
@@ -13,23 +13,23 @@
 public class WMSDownloadAction extends JosmAction {
 
-	private WMSInfo info;
-	
-	public WMSDownloadAction(WMSInfo info) {
-		super(info.name, "wmsmenu", tr("Download WMS tile from {0}",info.name), null, false);
-		this.info = info;
-	}
-	
-	public void actionPerformed(ActionEvent e) {
-		System.out.println(info.url);
-		
-		WMSLayer wmsLayer = new WMSLayer(info.name, info.url);
-		Main.main.addLayer(wmsLayer);
-	}
+    private WMSInfo info;
 
-	public static WMSLayer getLayer(WMSInfo info) {
-		// FIXME: move this to WMSPlugin/WMSInfo/preferences.
-		WMSLayer wmsLayer = new WMSLayer(info.name, info.url);
-		Main.main.addLayer(wmsLayer);
-		return wmsLayer;
-	}
+    public WMSDownloadAction(WMSInfo info) {
+        super(info.name, "wmsmenu", tr("Download WMS tile from {0}",info.name), null, false);
+        this.info = info;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        System.out.println(info.url);
+
+        WMSLayer wmsLayer = new WMSLayer(info.name, info.url);
+        Main.main.addLayer(wmsLayer);
+    }
+
+    public static WMSLayer getLayer(WMSInfo info) {
+        // FIXME: move this to WMSPlugin/WMSInfo/preferences.
+        WMSLayer wmsLayer = new WMSLayer(info.name, info.url);
+        Main.main.addLayer(wmsLayer);
+        return wmsLayer;
+    }
 };
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java	(revision 12778)
@@ -25,80 +25,80 @@
 
 public class WMSGrabber extends Grabber {
-	protected String baseURL;
+    protected String baseURL;
 
-	WMSGrabber(String baseURL, Bounds b, Projection proj,
-			double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer) {
-		super(b, proj, pixelPerDegree, image, mv, layer);
-		this.baseURL = baseURL;
-	}
+    WMSGrabber(String baseURL, Bounds b, Projection proj,
+            double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer) {
+        super(b, proj, pixelPerDegree, image, mv, layer);
+        this.baseURL = baseURL;
+    }
 
-	public void run() {
-		attempt();
-		mv.repaint();
-	}
+    public void run() {
+        attempt();
+        mv.repaint();
+    }
 
-	void fetch() throws Exception{
-		URL url = null;
-		try {
-			url = getURL(
-				b.min.lon(), b.min.lat(),
-				b.max.lon(), b.max.lat(),
-				width(), height());
-			
-			image.min = proj.latlon2eastNorth(b.min);
-			image.max = proj.latlon2eastNorth(b.max);
+    void fetch() throws Exception{
+        URL url = null;
+        try {
+            url = getURL(
+                b.min.lon(), b.min.lat(),
+                b.max.lon(), b.max.lat(),
+                width(), height());
 
-			if(image.isVisible(mv)) //don't download, if the image isn't visible already
-				image.image = grab(url);
-			image.downloadingStarted = false;
-		} catch(Exception e) {
-			throw new Exception(e.getMessage() + "\nImage couldn't be fetched: " + (url != null ? url.toString() : ""));
-		}
-	}
+            image.min = proj.latlon2eastNorth(b.min);
+            image.max = proj.latlon2eastNorth(b.max);
 
-	public static final NumberFormat
-		latLonFormat = new DecimalFormat("###0.0000000",
-			new DecimalFormatSymbols(Locale.US));
+            if(image.isVisible(mv)) //don't download, if the image isn't visible already
+                image.image = grab(url);
+            image.downloadingStarted = false;
+        } catch(Exception e) {
+            throw new Exception(e.getMessage() + "\nImage couldn't be fetched: " + (url != null ? url.toString() : ""));
+        }
+    }
 
-	protected URL getURL(double w, double s,double e,double n,
-			int wi, int ht) throws MalformedURLException {
-		String str = baseURL;
-		if(!str.endsWith("?"))
-			str += "&";
-		str += "bbox="
-			+ latLonFormat.format(w) + ","
-			+ latLonFormat.format(s) + ","
-			+ latLonFormat.format(e) + ","
-			+ latLonFormat.format(n)
-			+ "&width=" + wi + "&height=" + ht;
-		return new URL(str.replace(" ", "%20"));
-	}
+    public static final NumberFormat
+        latLonFormat = new DecimalFormat("###0.0000000",
+            new DecimalFormatSymbols(Locale.US));
 
-	protected BufferedImage grab(URL url) throws IOException {
-		HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-		
-		String contentType = conn.getHeaderField("Content-Type");
-		if( conn.getResponseCode() != 200 
-				|| contentType != null && !contentType.startsWith("image") ) {
-			throw new IOException(readException(conn));
-		}
-		
-		InputStream is = new ProgressInputStream(conn, null);
-		BufferedImage img = ImageIO.read(is);
-		is.close();
-		return img;
-	}
+    protected URL getURL(double w, double s,double e,double n,
+            int wi, int ht) throws MalformedURLException {
+        String str = baseURL;
+        if(!str.endsWith("?"))
+            str += "&";
+        str += "bbox="
+            + latLonFormat.format(w) + ","
+            + latLonFormat.format(s) + ","
+            + latLonFormat.format(e) + ","
+            + latLonFormat.format(n)
+            + "&width=" + wi + "&height=" + ht;
+        return new URL(str.replace(" ", "%20"));
+    }
 
-	protected String readException(URLConnection conn) throws IOException {
-		StringBuilder exception = new StringBuilder();
-		InputStream in = conn.getInputStream();
-		BufferedReader br = new BufferedReader(new InputStreamReader(in));
-		
-		String line = null;
-		while( (line = br.readLine()) != null) {
-			exception.append(line);
-			exception.append('\n');
-		}
-		return exception.toString();
-	}
+    protected BufferedImage grab(URL url) throws IOException {
+        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+
+        String contentType = conn.getHeaderField("Content-Type");
+        if( conn.getResponseCode() != 200
+                || contentType != null && !contentType.startsWith("image") ) {
+            throw new IOException(readException(conn));
+        }
+
+        InputStream is = new ProgressInputStream(conn, null);
+        BufferedImage img = ImageIO.read(is);
+        is.close();
+        return img;
+    }
+
+    protected String readException(URLConnection conn) throws IOException {
+        StringBuilder exception = new StringBuilder();
+        InputStream in = conn.getInputStream();
+        BufferedReader br = new BufferedReader(new InputStreamReader(in));
+
+        String line = null;
+        while( (line = br.readLine()) != null) {
+            exception.append(line);
+            exception.append('\n');
+        }
+        return exception.toString();
+    }
 }
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSInfo.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSInfo.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSInfo.java	(revision 12778)
@@ -5,35 +5,35 @@
 /**
  * Class that stores info about a WMS server.
- * 
+ *
  * @author Frederik Ramm <frederik@remote.org>
  */
 public class WMSInfo implements Comparable {
-	
-	String name;
-	String url;
-	int prefid;
-	
-	public WMSInfo(String name, String url, int prefid) {
-		this.name=name; this.url=url; this.prefid=prefid;
-	}
 
-	
-	public void save() {
-		Main.pref.put("wmsplugin.url." + prefid + ".name", name);
-		Main.pref.put("wmsplugin.url." + prefid + ".url", url);
-	}
-	public int compareTo(Object c)
-	{
-		Integer i = 0;
-		if(c instanceof WMSInfo)
-		{
-			WMSInfo in = (WMSInfo)c;
-			i = name.compareTo(in.name);
-			if(i == 0)
-				i = url.compareTo(in.url);
-			if(i == 0)
-				i = prefid-in.prefid;
-		}
-		return i;
-	}
+    String name;
+    String url;
+    int prefid;
+
+    public WMSInfo(String name, String url, int prefid) {
+        this.name=name; this.url=url; this.prefid=prefid;
+    }
+
+
+    public void save() {
+        Main.pref.put("wmsplugin.url." + prefid + ".name", name);
+        Main.pref.put("wmsplugin.url." + prefid + ".url", url);
+    }
+    public int compareTo(Object c)
+    {
+        Integer i = 0;
+        if(c instanceof WMSInfo)
+        {
+            WMSInfo in = (WMSInfo)c;
+            i = name.compareTo(in.name);
+            if(i == 0)
+                i = url.compareTo(in.url);
+            if(i == 0)
+                i = prefid-in.prefid;
+        }
+        return i;
+    }
 }
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java	(revision 12778)
@@ -45,310 +45,310 @@
 public class WMSLayer extends Layer {
 
-	protected static final Icon icon =
-		new ImageIcon(Toolkit.getDefaultToolkit().createImage(WMSPlugin.class.getResource("/images/wms_small.png")));
-
-	public int messageNum = 5; //limit for messages per layer
-	protected MapView mv;
-	protected String resolution;
-	protected boolean stopAfterPaint = false;
-	protected int ImageSize = 500;
-	protected int dax = 10;
-	protected int day = 10;
-	protected int minZoom = 3;
-	protected double dx = 0.0;
-	protected double dy = 0.0;
-	protected double pixelPerDegree;
-	protected GeorefImage[][] images = new GeorefImage[dax][day];
-	JCheckBoxMenuItem startstop = new JCheckBoxMenuItem(tr("Automatic downloading"), true);
-
-	protected String baseURL;
-	protected final int serializeFormatVersion = 4;
-	
-	private ExecutorService executor;
-
-	public WMSLayer() {
-		this(tr("Blank Layer"), null);
-		initializeImages();
-		mv = Main.map.mapView;
-	}
-
-	public WMSLayer(String name, String baseURL) {
-		super(name);
-		background = true; /* set global background variable */
-		initializeImages();
-		this.baseURL = baseURL;
-		mv = Main.map.mapView;
-		getPPD();
-		
-		executor = Executors.newFixedThreadPool(3);
-	}
-
-	public void getPPD(){
-		pixelPerDegree = mv.getWidth() / (bounds().max.lon() - bounds().min.lon());
-	}
-
-	public void initializeImages() {
-		images = new GeorefImage[dax][day];
-		for(int x = 0; x<dax; ++x)
-			for(int y = 0; y<day; ++y)
-				images[x][y]= new GeorefImage(false);
-	}
-
-	@Override public Icon getIcon() {
-		return icon;
-	}
-
-	public String scale(){
-		LatLon ll1 = mv.getLatLon(0,0);
-		LatLon ll2 = mv.getLatLon(100,0);
-		double dist = ll1.greatCircleDistance(ll2);
-		return dist > 1000 ? (Math.round(dist/100)/10.0)+" km" : Math.round(dist*10)/10+" m";
-	}
-
-	@Override public String getToolTipText() {
-		if(startstop.isSelected())
-			return tr("WMS layer ({0}), automatically downloading in zoom {1}", name, resolution);
-		else
-			return tr("WMS layer ({0}), downloading in zoom {1}", name, resolution);
-	}
-
-	@Override public boolean isMergable(Layer other) {
-		return false;
-	}
-
-	@Override public void mergeFrom(Layer from) {
-	}
-
-	private Bounds XYtoBounds (int x, int y) {
-		return new Bounds( 
-			new LatLon( x * ImageSize / pixelPerDegree,
-				         y * ImageSize / pixelPerDegree),
-			new LatLon((x + 1) *  ImageSize / pixelPerDegree,
-			           (y + 1) * ImageSize / pixelPerDegree));
-	}
-
-	private int modulo (int a, int b) {
-	  if(a%b>=0)return a%b;
-	  else return a%b+b;
-	}	  
-
-	protected Bounds bounds(){
-		return new Bounds(
-			mv.getLatLon(0, mv.getHeight()),
-			mv.getLatLon(mv.getWidth(), 0));
-	}
-
-	@Override public void paint(Graphics g, final MapView mv) {
-		if(baseURL == null) return;
-
-		if( !startstop.isSelected() || (pixelPerDegree / (mv.getWidth() / (bounds().max.lon() - bounds().min.lon())) > minZoom) ){ //don't download when it's too outzoomed
-			for(int x = 0; x<dax; ++x)
-				for(int y = 0; y<day; ++y)
-					images[modulo(x,dax)][modulo(y,day)].paint(g, mv, dx, dy);
-		} else
-			downloadAndPaintVisible(g, mv);
-	}
-
-	public void displace(double dx, double dy) {
-		this.dx += dx;
-		this.dy += dy;
-	}
-
-	protected void downloadAndPaintVisible(Graphics g, final MapView mv){
-		int bminx= (int)Math.floor ((bounds().min.lat() * pixelPerDegree ) / ImageSize );
-		int bminy= (int)Math.floor ((bounds().min.lon() * pixelPerDegree ) / ImageSize );
-		int bmaxx= (int)Math.ceil  ((bounds().max.lat() * pixelPerDegree ) / ImageSize );
-		int bmaxy= (int)Math.ceil  ((bounds().max.lon() * pixelPerDegree ) / ImageSize );
-
-		if((bmaxx - bminx > dax) || (bmaxy - bminy > day)){
-			JOptionPane.showMessageDialog(Main.parent, tr("The requested area is too big. Please zoom in a little, or change resolution"));
-			return;
-		}
-
-		for(int x = bminx; x<bmaxx; ++x)
-			for(int y = bminy; y<bmaxy; ++y){
-				GeorefImage img = images[modulo(x,dax)][modulo(y,day)];
-				if(!img.paint(g, mv, dx, dy) && !img.downloadingStarted){
-					img.downloadingStarted = true;
-					img.image = null;
-					Grabber gr = WMSPlugin.getGrabber(baseURL, XYtoBounds(x,y), Main.main.proj, pixelPerDegree, img, mv, this);
-					executor.submit(gr);
-			}
-		}
-	}
-
-	@Override public void visitBoundingBox(BoundingXYVisitor v) {
-		for(int x = 0; x<dax; ++x)
-			for(int y = 0; y<day; ++y)
-				if(images[x][y].image!=null){
-					v.visit(images[x][y].min);
-					v.visit(images[x][y].max);
-				}
-	}
-
-	@Override public Object getInfoComponent() {
-		return getToolTipText();
-	}
-
-	@Override public Component[] getMenuEntries() {
-		return new Component[]{
-				new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
-				new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),				
-				new JSeparator(),
-				new JMenuItem(new LoadWmsAction()),
-				new JMenuItem(new SaveWmsAction()),
-				new JSeparator(),
-				startstop,
-				new JMenuItem(new changeResolutionAction()),
-				new JMenuItem(new downloadAction()),
-				new JSeparator(),
-				new JMenuItem(new LayerListPopup.InfoAction(this))
-		};
-	}
-
-	public GeorefImage findImage(EastNorth eastNorth) {
-		for(int x = 0; x<dax; ++x)
-			for(int y = 0; y<day; ++y)
-					if(images[x][y].image!=null && images[x][y].min!=null && images[x][y].max!=null)
-						if(images[x][y].contains(eastNorth, dx, dy))
-							return images[x][y];
-		return null;
-	}
-
-	public class downloadAction extends AbstractAction {
-		public downloadAction() {
-			super(tr("Download visible tiles"));
-		}
-		public void actionPerformed(ActionEvent ev) {
-			downloadAndPaintVisible(mv.getGraphics(), mv);
-		}
-	}
-
-	public class changeResolutionAction extends AbstractAction {
-		public changeResolutionAction() {
-			super(tr("Change resolution"));
-		}
-		public void actionPerformed(ActionEvent ev) {
-			initializeImages();
-			resolution = scale();
-			getPPD();
-			mv.repaint();
-		}
-	}
-
-	public class SaveWmsAction extends AbstractAction {
-		public SaveWmsAction() {
-			super(tr("Save WMS layer to file"), ImageProvider.get("save"));
-		}
-		public void actionPerformed(ActionEvent ev) {
-			File f = openFileDialog(false);
-			try
-			{
-				FileOutputStream fos = new FileOutputStream(f);
-				ObjectOutputStream oos = new ObjectOutputStream(fos);
-				oos.writeInt(serializeFormatVersion);
-				oos.writeInt(dax);
-				oos.writeInt(day);
-				oos.writeInt(ImageSize);
-				oos.writeDouble(pixelPerDegree);
-				oos.writeObject(name);
-				oos.writeObject(baseURL);
-				oos.writeObject(images);
-				oos.close();
-				fos.close();
-			}
-			catch (Exception ex) {
-				ex.printStackTrace(System.out);
-			}
-		}
-	}
-
-	public class LoadWmsAction extends AbstractAction {
-		public LoadWmsAction() {
-			super(tr("Load WMS layer from file"), ImageProvider.get("load"));
-		}
-		public void actionPerformed(ActionEvent ev) {
-			File f = openFileDialog(true);
-			if (f == null) return;
-			try
-			{
-				FileInputStream fis = new FileInputStream(f);
-				ObjectInputStream ois = new ObjectInputStream(fis);
-				int sfv = ois.readInt();
-				if (sfv != serializeFormatVersion) {
-					JOptionPane.showMessageDialog(Main.parent,
-						tr("Unsupported WMS file version; found {0}, expected {1}", sfv, serializeFormatVersion),
-						tr("File Format Error"),
-						JOptionPane.ERROR_MESSAGE);
-					return;
-				}
-				startstop.setSelected(false);
-				dax = ois.readInt();
-				day = ois.readInt();
-				ImageSize = ois.readInt();
-				pixelPerDegree = ois.readDouble();
-				name = (String) ois.readObject();
-				baseURL = (String) ois.readObject();
-				images = (GeorefImage[][])ois.readObject();
-				ois.close();
-				fis.close();
-				mv.repaint();
-			}
-			catch (Exception ex) {
-				// FIXME be more specific
-				ex.printStackTrace(System.out);
-				JOptionPane.showMessageDialog(Main.parent,
-					tr("Error loading file"),
-					tr("Error"),
-					JOptionPane.ERROR_MESSAGE);
-				return;
-			}
-		}
-	}
-
-	protected static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple) {
-		String curDir = Main.pref.get("lastDirectory");
-		if (curDir.equals(""))
-			curDir = ".";
-		JFileChooser fc = new JFileChooser(new File(curDir));
-		fc.setMultiSelectionEnabled(multiple);
-		for (int i = 0; i < ExtensionFileFilter.filters.length; ++i)
-			fc.addChoosableFileFilter(ExtensionFileFilter.filters[i]);
-		fc.setAcceptAllFileFilterUsed(true);
-
-		int answer = open ? fc.showOpenDialog(Main.parent) : fc.showSaveDialog(Main.parent);
-		if (answer != JFileChooser.APPROVE_OPTION)
-			return null;
-
-		if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir))
-			Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());
-
-		if (!open) {
-			File file = fc.getSelectedFile();
-			if (file == null || (file.exists() && JOptionPane.YES_OPTION !=
-				JOptionPane.showConfirmDialog(Main.parent, tr("File exists. Overwrite?"), tr("Overwrite"), JOptionPane.YES_NO_OPTION)))
-				return null;
-		}
-
-		return fc;
-	}
-
-	public static File openFileDialog(boolean open) {
-		JFileChooser fc = createAndOpenFileChooser(open, false);
-		if (fc == null)
-			return null;
-
-		File file = fc.getSelectedFile();
-
-		String fn = file.getPath();
-		if (fn.indexOf('.') == -1) {
-			FileFilter ff = fc.getFileFilter();
-			if (ff instanceof ExtensionFileFilter)
-				fn = "." + ((ExtensionFileFilter)ff).defaultExtension;
-			else
-				fn += ".osm";
-			file = new File(fn);
-		}
-		return file;
-	}
+    protected static final Icon icon =
+        new ImageIcon(Toolkit.getDefaultToolkit().createImage(WMSPlugin.class.getResource("/images/wms_small.png")));
+
+    public int messageNum = 5; //limit for messages per layer
+    protected MapView mv;
+    protected String resolution;
+    protected boolean stopAfterPaint = false;
+    protected int ImageSize = 500;
+    protected int dax = 10;
+    protected int day = 10;
+    protected int minZoom = 3;
+    protected double dx = 0.0;
+    protected double dy = 0.0;
+    protected double pixelPerDegree;
+    protected GeorefImage[][] images = new GeorefImage[dax][day];
+    JCheckBoxMenuItem startstop = new JCheckBoxMenuItem(tr("Automatic downloading"), true);
+
+    protected String baseURL;
+    protected final int serializeFormatVersion = 4;
+
+    private ExecutorService executor;
+
+    public WMSLayer() {
+        this(tr("Blank Layer"), null);
+        initializeImages();
+        mv = Main.map.mapView;
+    }
+
+    public WMSLayer(String name, String baseURL) {
+        super(name);
+        background = true; /* set global background variable */
+        initializeImages();
+        this.baseURL = baseURL;
+        mv = Main.map.mapView;
+        getPPD();
+
+        executor = Executors.newFixedThreadPool(3);
+    }
+
+    public void getPPD(){
+        pixelPerDegree = mv.getWidth() / (bounds().max.lon() - bounds().min.lon());
+    }
+
+    public void initializeImages() {
+        images = new GeorefImage[dax][day];
+        for(int x = 0; x<dax; ++x)
+            for(int y = 0; y<day; ++y)
+                images[x][y]= new GeorefImage(false);
+    }
+
+    @Override public Icon getIcon() {
+        return icon;
+    }
+
+    public String scale(){
+        LatLon ll1 = mv.getLatLon(0,0);
+        LatLon ll2 = mv.getLatLon(100,0);
+        double dist = ll1.greatCircleDistance(ll2);
+        return dist > 1000 ? (Math.round(dist/100)/10.0)+" km" : Math.round(dist*10)/10+" m";
+    }
+
+    @Override public String getToolTipText() {
+        if(startstop.isSelected())
+            return tr("WMS layer ({0}), automatically downloading in zoom {1}", name, resolution);
+        else
+            return tr("WMS layer ({0}), downloading in zoom {1}", name, resolution);
+    }
+
+    @Override public boolean isMergable(Layer other) {
+        return false;
+    }
+
+    @Override public void mergeFrom(Layer from) {
+    }
+
+    private Bounds XYtoBounds (int x, int y) {
+        return new Bounds(
+            new LatLon( x * ImageSize / pixelPerDegree,
+                         y * ImageSize / pixelPerDegree),
+            new LatLon((x + 1) *  ImageSize / pixelPerDegree,
+                       (y + 1) * ImageSize / pixelPerDegree));
+    }
+
+    private int modulo (int a, int b) {
+      if(a%b>=0)return a%b;
+      else return a%b+b;
+    }
+
+    protected Bounds bounds(){
+        return new Bounds(
+            mv.getLatLon(0, mv.getHeight()),
+            mv.getLatLon(mv.getWidth(), 0));
+    }
+
+    @Override public void paint(Graphics g, final MapView mv) {
+        if(baseURL == null) return;
+
+        if( !startstop.isSelected() || (pixelPerDegree / (mv.getWidth() / (bounds().max.lon() - bounds().min.lon())) > minZoom) ){ //don't download when it's too outzoomed
+            for(int x = 0; x<dax; ++x)
+                for(int y = 0; y<day; ++y)
+                    images[modulo(x,dax)][modulo(y,day)].paint(g, mv, dx, dy);
+        } else
+            downloadAndPaintVisible(g, mv);
+    }
+
+    public void displace(double dx, double dy) {
+        this.dx += dx;
+        this.dy += dy;
+    }
+
+    protected void downloadAndPaintVisible(Graphics g, final MapView mv){
+        int bminx= (int)Math.floor ((bounds().min.lat() * pixelPerDegree ) / ImageSize );
+        int bminy= (int)Math.floor ((bounds().min.lon() * pixelPerDegree ) / ImageSize );
+        int bmaxx= (int)Math.ceil  ((bounds().max.lat() * pixelPerDegree ) / ImageSize );
+        int bmaxy= (int)Math.ceil  ((bounds().max.lon() * pixelPerDegree ) / ImageSize );
+
+        if((bmaxx - bminx > dax) || (bmaxy - bminy > day)){
+            JOptionPane.showMessageDialog(Main.parent, tr("The requested area is too big. Please zoom in a little, or change resolution"));
+            return;
+        }
+
+        for(int x = bminx; x<bmaxx; ++x)
+            for(int y = bminy; y<bmaxy; ++y){
+                GeorefImage img = images[modulo(x,dax)][modulo(y,day)];
+                if(!img.paint(g, mv, dx, dy) && !img.downloadingStarted){
+                    img.downloadingStarted = true;
+                    img.image = null;
+                    Grabber gr = WMSPlugin.getGrabber(baseURL, XYtoBounds(x,y), Main.main.proj, pixelPerDegree, img, mv, this);
+                    executor.submit(gr);
+            }
+        }
+    }
+
+    @Override public void visitBoundingBox(BoundingXYVisitor v) {
+        for(int x = 0; x<dax; ++x)
+            for(int y = 0; y<day; ++y)
+                if(images[x][y].image!=null){
+                    v.visit(images[x][y].min);
+                    v.visit(images[x][y].max);
+                }
+    }
+
+    @Override public Object getInfoComponent() {
+        return getToolTipText();
+    }
+
+    @Override public Component[] getMenuEntries() {
+        return new Component[]{
+                new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
+                new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
+                new JSeparator(),
+                new JMenuItem(new LoadWmsAction()),
+                new JMenuItem(new SaveWmsAction()),
+                new JSeparator(),
+                startstop,
+                new JMenuItem(new changeResolutionAction()),
+                new JMenuItem(new downloadAction()),
+                new JSeparator(),
+                new JMenuItem(new LayerListPopup.InfoAction(this))
+        };
+    }
+
+    public GeorefImage findImage(EastNorth eastNorth) {
+        for(int x = 0; x<dax; ++x)
+            for(int y = 0; y<day; ++y)
+                    if(images[x][y].image!=null && images[x][y].min!=null && images[x][y].max!=null)
+                        if(images[x][y].contains(eastNorth, dx, dy))
+                            return images[x][y];
+        return null;
+    }
+
+    public class downloadAction extends AbstractAction {
+        public downloadAction() {
+            super(tr("Download visible tiles"));
+        }
+        public void actionPerformed(ActionEvent ev) {
+            downloadAndPaintVisible(mv.getGraphics(), mv);
+        }
+    }
+
+    public class changeResolutionAction extends AbstractAction {
+        public changeResolutionAction() {
+            super(tr("Change resolution"));
+        }
+        public void actionPerformed(ActionEvent ev) {
+            initializeImages();
+            resolution = scale();
+            getPPD();
+            mv.repaint();
+        }
+    }
+
+    public class SaveWmsAction extends AbstractAction {
+        public SaveWmsAction() {
+            super(tr("Save WMS layer to file"), ImageProvider.get("save"));
+        }
+        public void actionPerformed(ActionEvent ev) {
+            File f = openFileDialog(false);
+            try
+            {
+                FileOutputStream fos = new FileOutputStream(f);
+                ObjectOutputStream oos = new ObjectOutputStream(fos);
+                oos.writeInt(serializeFormatVersion);
+                oos.writeInt(dax);
+                oos.writeInt(day);
+                oos.writeInt(ImageSize);
+                oos.writeDouble(pixelPerDegree);
+                oos.writeObject(name);
+                oos.writeObject(baseURL);
+                oos.writeObject(images);
+                oos.close();
+                fos.close();
+            }
+            catch (Exception ex) {
+                ex.printStackTrace(System.out);
+            }
+        }
+    }
+
+    public class LoadWmsAction extends AbstractAction {
+        public LoadWmsAction() {
+            super(tr("Load WMS layer from file"), ImageProvider.get("load"));
+        }
+        public void actionPerformed(ActionEvent ev) {
+            File f = openFileDialog(true);
+            if (f == null) return;
+            try
+            {
+                FileInputStream fis = new FileInputStream(f);
+                ObjectInputStream ois = new ObjectInputStream(fis);
+                int sfv = ois.readInt();
+                if (sfv != serializeFormatVersion) {
+                    JOptionPane.showMessageDialog(Main.parent,
+                        tr("Unsupported WMS file version; found {0}, expected {1}", sfv, serializeFormatVersion),
+                        tr("File Format Error"),
+                        JOptionPane.ERROR_MESSAGE);
+                    return;
+                }
+                startstop.setSelected(false);
+                dax = ois.readInt();
+                day = ois.readInt();
+                ImageSize = ois.readInt();
+                pixelPerDegree = ois.readDouble();
+                name = (String) ois.readObject();
+                baseURL = (String) ois.readObject();
+                images = (GeorefImage[][])ois.readObject();
+                ois.close();
+                fis.close();
+                mv.repaint();
+            }
+            catch (Exception ex) {
+                // FIXME be more specific
+                ex.printStackTrace(System.out);
+                JOptionPane.showMessageDialog(Main.parent,
+                    tr("Error loading file"),
+                    tr("Error"),
+                    JOptionPane.ERROR_MESSAGE);
+                return;
+            }
+        }
+    }
+
+    protected static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple) {
+        String curDir = Main.pref.get("lastDirectory");
+        if (curDir.equals(""))
+            curDir = ".";
+        JFileChooser fc = new JFileChooser(new File(curDir));
+        fc.setMultiSelectionEnabled(multiple);
+        for (int i = 0; i < ExtensionFileFilter.filters.length; ++i)
+            fc.addChoosableFileFilter(ExtensionFileFilter.filters[i]);
+        fc.setAcceptAllFileFilterUsed(true);
+
+        int answer = open ? fc.showOpenDialog(Main.parent) : fc.showSaveDialog(Main.parent);
+        if (answer != JFileChooser.APPROVE_OPTION)
+            return null;
+
+        if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir))
+            Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());
+
+        if (!open) {
+            File file = fc.getSelectedFile();
+            if (file == null || (file.exists() && JOptionPane.YES_OPTION !=
+                JOptionPane.showConfirmDialog(Main.parent, tr("File exists. Overwrite?"), tr("Overwrite"), JOptionPane.YES_NO_OPTION)))
+                return null;
+        }
+
+        return fc;
+    }
+
+    public static File openFileDialog(boolean open) {
+        JFileChooser fc = createAndOpenFileChooser(open, false);
+        if (fc == null)
+            return null;
+
+        File file = fc.getSelectedFile();
+
+        String fn = file.getPath();
+        if (fn.indexOf('.') == -1) {
+            FileFilter ff = fc.getFileFilter();
+            if (ff instanceof ExtensionFileFilter)
+                fn = "." + ((ExtensionFileFilter)ff).defaultExtension;
+            else
+                fn += ".osm";
+            file = new File(fn);
+        }
+        return file;
+    }
 }
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java	(revision 12778)
@@ -39,186 +39,186 @@
 public class WMSPlugin extends Plugin {
 
-	WMSLayer wmsLayer;
-	static JMenu wmsJMenu;
-
-	static ArrayList<WMSInfo> wmsList = new ArrayList<WMSInfo>();
-	static TreeMap<String,String> wmsListDefault = new TreeMap<String,String>();
-
-	// remember state of menu item to restore on changed preferences
-	static private boolean menuEnabled = false;
-	
-	public WMSPlugin() {
-		try
-		{
-			copy("/resources/ymap.html", "ymap.html");
-		}
-		catch(IOException e) {
-			e.printStackTrace();
-		}
-		refreshMenu();
-	}
-
-	// this parses the preferences settings. preferences for the wms plugin have to
-	// look like this:
-	// wmsplugin.1.name=Landsat
-	// wmsplugin.1.url=http://and.so.on/
-	
-	public void copy(String from, String to) throws FileNotFoundException, IOException
-	{
-		File pluginDir = new File(Main.pref.getPreferencesDir() + "plugins/wmsplugin/");
-		if (!pluginDir.exists())
-			pluginDir.mkdirs();
-		FileOutputStream out = new FileOutputStream(Main.pref.getPreferencesDir() + "plugins/wmsplugin/" + to);
-		InputStream in = WMSPlugin.class.getResourceAsStream(from);
-		byte[] buffer = new byte[8192];
-		for(int len = in.read(buffer); len > 0; len = in.read(buffer))
-			out.write(buffer, 0, len);
-		in.close();
-		out.close();
-	}
-
-	
-	public static void refreshMenu() {
-		wmsList.clear();
-		Map<String,String> prefs = Main.pref.getAllPrefix("wmsplugin.url.");
-		
-		TreeSet<String> keys = new TreeSet<String>(prefs.keySet());
-		int prefid = 0;
-		String name = null;
-		String url = null;
-		int lastid = -1;
-		for (String key : keys) {
-			String[] elements = key.split("\\.");
-			if (elements.length != 4) continue;
-			try {
-				prefid = Integer.parseInt(elements[2]);
-			} catch(NumberFormatException e) {
-				continue;
-			}
-			if (prefid != lastid) {
-				name = url = null; lastid = prefid;
-			}
-			if (elements[3].equals("name"))
-				name = prefs.get(key);
-			else if (elements[3].equals("url"))
-				url = prefs.get(key);
-			if (name != null && url != null)
-				wmsList.add(new WMSInfo(name, url, prefid));
-		}
-		String source = "http://svn.openstreetmap.org/applications/editors/josm/plugins/wmsplugin/sources.cfg";
-		try
-		{
-			MirroredInputStream s = new MirroredInputStream(source,
-			Main.pref.getPreferencesDir() + "plugins/wmsplugin/", -1);
-			InputStreamReader r;
-			try
-			{
-				r = new InputStreamReader(s, "UTF-8");
-			}
-			catch (UnsupportedEncodingException e)
-			{
-				r = new InputStreamReader(s);
-			}
-			BufferedReader reader = new BufferedReader(r);
-			String line;
-			while((line = reader.readLine()) != null)
-			{
-				String val[] = line.split(";");
-				if(!line.startsWith("#") && val.length == 3)
-					setDefault("true".equals(val[0]), tr(val[1]), val[2]);
-			}
-		}
-		catch (IOException e)
-		{
-		}
-
-		Collections.sort(wmsList);
-		MainMenu menu = Main.main.menu;
-
-		if (wmsJMenu == null) {
-			wmsJMenu = new JMenu(tr("WMS"));
-			menu.add(wmsJMenu, KeyEvent.VK_W, "wms");
-			menu.add(wmsJMenu, 5);
-		} else {
-			wmsJMenu.removeAll();
-		}
-		
-		// for each configured WMSInfo, add a menu entry.
-		for (final WMSInfo u : wmsList) {
-			wmsJMenu.add(new JMenuItem(new WMSDownloadAction(u)));
-		}
-		wmsJMenu.addSeparator();
-		wmsJMenu.add(new JMenuItem(new Map_Rectifier_WMSmenuAction()));
-		
-		wmsJMenu.addSeparator();
-		wmsJMenu.add(new JMenuItem(new 
-				JosmAction(tr("Blank Layer"), "blankmenu", tr("Open a blank WMS layer to load data from a file"), null, false) {
-			public void actionPerformed(ActionEvent ev) {
-				Main.main.addLayer(new WMSLayer());
-			}
-		}));
-		wmsJMenu.addSeparator();
-		wmsJMenu.add(new JMenuItem(new Help_WMSmenuAction()));
-		setEnabledAll(menuEnabled);
-	}
-
-	/* add a default entry in case the URL does not yet exist */
-	private static void setDefault(Boolean force, String name, String url)
-	{
-		String testurl = url.replaceAll("=", "_");
-		wmsListDefault.put(name, url);
-
-		if(force && !Main.pref.getBoolean("wmsplugin.default."+testurl))
-		{
-			Main.pref.put("wmsplugin.default."+testurl, true);
-			int id = -1;
-			for(WMSInfo i : wmsList)
-			{
-				if(url.equals(i.url))
-					return;
-				if(i.prefid > id)
-					id = i.prefid;
-			}
-			WMSInfo newinfo = new WMSInfo(name, url, id+1);
-			newinfo.save();
-			wmsList.add(newinfo);
-		}
-	}
-
-	public static Grabber getGrabber(String _baseURL, Bounds _b, Projection _proj,
-			         double _pixelPerDegree, GeorefImage _image, MapView _mv, WMSLayer _layer){
-		if(_baseURL.startsWith("yahoo://"))
-			return new YAHOOGrabber(_baseURL, _b, _proj, _pixelPerDegree, _image, _mv, _layer);
-		else 
-			return new WMSGrabber(_baseURL, _b, _proj, _pixelPerDegree, _image, _mv, _layer);
-		// OSBGrabber should be rewrite for thread support first
-		//if (wmsurl.matches("(?i).*layers=npeoocmap.*") || wmsurl.matches("(?i).*layers=npe.*") ){
-		//	return new OSGBGrabber(_b, _proj, _pixelPerDegree,  _images, _mv, _layer);
-		//} else {
-		//	return new WMSGrabber(_b, _proj, _pixelPerDegree,  _images, _mv, _layer);
-		//}
-	}
-	
-	private static void setEnabledAll(boolean isEnabled) {
-		for(int i=0; i < wmsJMenu.getItemCount(); i++) {
-			JMenuItem item = wmsJMenu.getItem(i);
-			
-			if(item != null) item.setEnabled(isEnabled);
-		}
+    WMSLayer wmsLayer;
+    static JMenu wmsJMenu;
+
+    static ArrayList<WMSInfo> wmsList = new ArrayList<WMSInfo>();
+    static TreeMap<String,String> wmsListDefault = new TreeMap<String,String>();
+
+    // remember state of menu item to restore on changed preferences
+    static private boolean menuEnabled = false;
+
+    public WMSPlugin() {
+        try
+        {
+            copy("/resources/ymap.html", "ymap.html");
+        }
+        catch(IOException e) {
+            e.printStackTrace();
+        }
+        refreshMenu();
+    }
+
+    // this parses the preferences settings. preferences for the wms plugin have to
+    // look like this:
+    // wmsplugin.1.name=Landsat
+    // wmsplugin.1.url=http://and.so.on/
+
+    public void copy(String from, String to) throws FileNotFoundException, IOException
+    {
+        File pluginDir = new File(Main.pref.getPreferencesDir() + "plugins/wmsplugin/");
+        if (!pluginDir.exists())
+            pluginDir.mkdirs();
+        FileOutputStream out = new FileOutputStream(Main.pref.getPreferencesDir() + "plugins/wmsplugin/" + to);
+        InputStream in = WMSPlugin.class.getResourceAsStream(from);
+        byte[] buffer = new byte[8192];
+        for(int len = in.read(buffer); len > 0; len = in.read(buffer))
+            out.write(buffer, 0, len);
+        in.close();
+        out.close();
+    }
+
+
+    public static void refreshMenu() {
+        wmsList.clear();
+        Map<String,String> prefs = Main.pref.getAllPrefix("wmsplugin.url.");
+
+        TreeSet<String> keys = new TreeSet<String>(prefs.keySet());
+        int prefid = 0;
+        String name = null;
+        String url = null;
+        int lastid = -1;
+        for (String key : keys) {
+            String[] elements = key.split("\\.");
+            if (elements.length != 4) continue;
+            try {
+                prefid = Integer.parseInt(elements[2]);
+            } catch(NumberFormatException e) {
+                continue;
+            }
+            if (prefid != lastid) {
+                name = url = null; lastid = prefid;
+            }
+            if (elements[3].equals("name"))
+                name = prefs.get(key);
+            else if (elements[3].equals("url"))
+                url = prefs.get(key);
+            if (name != null && url != null)
+                wmsList.add(new WMSInfo(name, url, prefid));
+        }
+        String source = "http://svn.openstreetmap.org/applications/editors/josm/plugins/wmsplugin/sources.cfg";
+        try
+        {
+            MirroredInputStream s = new MirroredInputStream(source,
+            Main.pref.getPreferencesDir() + "plugins/wmsplugin/", -1);
+            InputStreamReader r;
+            try
+            {
+                r = new InputStreamReader(s, "UTF-8");
+            }
+            catch (UnsupportedEncodingException e)
+            {
+                r = new InputStreamReader(s);
+            }
+            BufferedReader reader = new BufferedReader(r);
+            String line;
+            while((line = reader.readLine()) != null)
+            {
+                String val[] = line.split(";");
+                if(!line.startsWith("#") && val.length == 3)
+                    setDefault("true".equals(val[0]), tr(val[1]), val[2]);
+            }
+        }
+        catch (IOException e)
+        {
+        }
+
+        Collections.sort(wmsList);
+        MainMenu menu = Main.main.menu;
+
+        if (wmsJMenu == null) {
+            wmsJMenu = new JMenu(tr("WMS"));
+            menu.add(wmsJMenu, KeyEvent.VK_W, "wms");
+            menu.add(wmsJMenu, 5);
+        } else {
+            wmsJMenu.removeAll();
+        }
+
+        // for each configured WMSInfo, add a menu entry.
+        for (final WMSInfo u : wmsList) {
+            wmsJMenu.add(new JMenuItem(new WMSDownloadAction(u)));
+        }
+        wmsJMenu.addSeparator();
+        wmsJMenu.add(new JMenuItem(new Map_Rectifier_WMSmenuAction()));
+
+        wmsJMenu.addSeparator();
+        wmsJMenu.add(new JMenuItem(new
+                JosmAction(tr("Blank Layer"), "blankmenu", tr("Open a blank WMS layer to load data from a file"), null, false) {
+            public void actionPerformed(ActionEvent ev) {
+                Main.main.addLayer(new WMSLayer());
+            }
+        }));
+        wmsJMenu.addSeparator();
+        wmsJMenu.add(new JMenuItem(new Help_WMSmenuAction()));
+        setEnabledAll(menuEnabled);
+    }
+
+    /* add a default entry in case the URL does not yet exist */
+    private static void setDefault(Boolean force, String name, String url)
+    {
+        String testurl = url.replaceAll("=", "_");
+        wmsListDefault.put(name, url);
+
+        if(force && !Main.pref.getBoolean("wmsplugin.default."+testurl))
+        {
+            Main.pref.put("wmsplugin.default."+testurl, true);
+            int id = -1;
+            for(WMSInfo i : wmsList)
+            {
+                if(url.equals(i.url))
+                    return;
+                if(i.prefid > id)
+                    id = i.prefid;
+            }
+            WMSInfo newinfo = new WMSInfo(name, url, id+1);
+            newinfo.save();
+            wmsList.add(newinfo);
+        }
+    }
+
+    public static Grabber getGrabber(String _baseURL, Bounds _b, Projection _proj,
+                     double _pixelPerDegree, GeorefImage _image, MapView _mv, WMSLayer _layer){
+        if(_baseURL.startsWith("yahoo://"))
+            return new YAHOOGrabber(_baseURL, _b, _proj, _pixelPerDegree, _image, _mv, _layer);
+        else
+            return new WMSGrabber(_baseURL, _b, _proj, _pixelPerDegree, _image, _mv, _layer);
+        // OSBGrabber should be rewrite for thread support first
+        //if (wmsurl.matches("(?i).*layers=npeoocmap.*") || wmsurl.matches("(?i).*layers=npe.*") ){
+        //  return new OSGBGrabber(_b, _proj, _pixelPerDegree,  _images, _mv, _layer);
+        //} else {
+        //  return new WMSGrabber(_b, _proj, _pixelPerDegree,  _images, _mv, _layer);
+        //}
+    }
+
+    private static void setEnabledAll(boolean isEnabled) {
+        for(int i=0; i < wmsJMenu.getItemCount(); i++) {
+            JMenuItem item = wmsJMenu.getItem(i);
+
+            if(item != null) item.setEnabled(isEnabled);
+        }
                menuEnabled = isEnabled;
-	}
-	
-	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-		if (oldFrame==null && newFrame!=null) { 
-			setEnabledAll(true);
-			Main.map.addMapMode(new IconToggleButton
-						(new WMSAdjustAction(Main.map)));
-		} else if (oldFrame!=null && newFrame==null ) {
-			setEnabledAll(false);
-		}
-	}
-	
-	public PreferenceSetting getPreferenceSetting() {
-		return new WMSPreferenceEditor();
-	}
+    }
+
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+        if (oldFrame==null && newFrame!=null) {
+            setEnabledAll(true);
+            Main.map.addMapMode(new IconToggleButton
+                        (new WMSAdjustAction(Main.map)));
+        } else if (oldFrame!=null && newFrame==null ) {
+            setEnabledAll(false);
+        }
+    }
+
+    public PreferenceSetting getPreferenceSetting() {
+        return new WMSPreferenceEditor();
+    }
 }
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java	(revision 12778)
@@ -27,128 +27,128 @@
 
 public class WMSPreferenceEditor implements PreferenceSetting {
-	
-	private Map<String,String> orig;
-	private DefaultTableModel model;
-	private HashMap<Integer, WMSInfo> oldValues = new HashMap<Integer, WMSInfo>();
 
-	public void addGui(final PreferenceDialog gui) {
-		JPanel p = gui.createPreferenceTab("wms", tr("WMS Plugin Preferences"), tr("Modify list of WMS servers displayed in the WMS plugin menu"));
-		
-		model = new DefaultTableModel(new String[]{tr("Menu Name"), tr("WMS URL")}, 0);
-		final JTable list = new JTable(model);
-		JScrollPane scroll = new JScrollPane(list);
-		p.add(scroll, GBC.eol().fill(GBC.BOTH));
-		scroll.setPreferredSize(new Dimension(200,200));
-		
-		for (WMSInfo i : WMSPlugin.wmsList) {
-			oldValues.put(i.prefid, i);
-			model.addRow(new String[]{i.name, i.url});
-		}
+    private Map<String,String> orig;
+    private DefaultTableModel model;
+    private HashMap<Integer, WMSInfo> oldValues = new HashMap<Integer, WMSInfo>();
 
-		final DefaultTableModel modeldef = new DefaultTableModel(
-		new String[]{tr("Menu Name (Default)"), tr("WMS URL (Default)")}, 0);
-		final JTable listdef = new JTable(modeldef){
-			public boolean isCellEditable(int row,int column){return false;}
-		};;
-		JScrollPane scrolldef = new JScrollPane(listdef);
-		p.add(scrolldef, GBC.eol().insets(0,5,0,0).fill(GBC.BOTH));
-		scrolldef.setPreferredSize(new Dimension(200,200));
+    public void addGui(final PreferenceDialog gui) {
+        JPanel p = gui.createPreferenceTab("wms", tr("WMS Plugin Preferences"), tr("Modify list of WMS servers displayed in the WMS plugin menu"));
 
-		for (Map.Entry<String,String> i : WMSPlugin.wmsListDefault.entrySet()) {
-			modeldef.addRow(new String[]{i.getKey(), i.getValue()});
-		}
+        model = new DefaultTableModel(new String[]{tr("Menu Name"), tr("WMS URL")}, 0);
+        final JTable list = new JTable(model);
+        JScrollPane scroll = new JScrollPane(list);
+        p.add(scroll, GBC.eol().fill(GBC.BOTH));
+        scroll.setPreferredSize(new Dimension(200,200));
 
-		JButton add = new JButton(tr("Add"));
-		p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
-		p.add(add, GBC.std().insets(0,5,0,0));
-		add.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				JPanel p = new JPanel(new GridBagLayout());
-				p.add(new JLabel(tr("Menu Name")), GBC.std().insets(0,0,5,0));
-				JTextField key = new JTextField(10);
-				JTextField value = new JTextField(10);
-				p.add(key, GBC.eop().insets(5,0,0,0).fill(GBC.HORIZONTAL));
-				p.add(new JLabel(tr("WMS URL")), GBC.std().insets(0,0,5,0));
-				p.add(value, GBC.eol().insets(5,0,0,0).fill(GBC.HORIZONTAL));
-				int answer = JOptionPane.showConfirmDialog(gui, p, tr("Enter a menu name and WMS URL"), JOptionPane.OK_CANCEL_OPTION);
-				if (answer == JOptionPane.OK_OPTION) {
-					model.addRow(new String[]{key.getText(), value.getText()});
-				}
-			}
-		});
+        for (WMSInfo i : WMSPlugin.wmsList) {
+            oldValues.put(i.prefid, i);
+            model.addRow(new String[]{i.name, i.url});
+        }
 
-		JButton delete = new JButton(tr("Delete"));
-		p.add(delete, GBC.std().insets(0,5,0,0));
-		delete.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				if (list.getSelectedRow() == -1)
-					JOptionPane.showMessageDialog(gui, tr("Please select the row to delete."));
-				else
-				{
-					Integer i;
-					while ((i = list.getSelectedRow()) != -1)
-						model.removeRow(i);
-				}
-			}
-		});
-		
-		JButton copy = new JButton(tr("Copy Default"));
-		p.add(copy, GBC.std().insets(0,5,0,0));
-		copy.addActionListener(new ActionListener(){
-			public void actionPerformed(ActionEvent e) {
-				Integer line = listdef.getSelectedRow();
-				if (line == -1)
-					JOptionPane.showMessageDialog(gui, tr("Please select the row to copy."));
-				else
-				{
-					model.addRow(new String[]{modeldef.getValueAt(line, 0).toString(),
-					modeldef.getValueAt(line, 1).toString()});
-				}
-			}
-		});
-	}
-	
-	public boolean ok() {
-		boolean change = false;
-		for (int i = 0; i < model.getRowCount(); ++i) {
-			String name = model.getValueAt(i,0).toString();
-			String url = model.getValueAt(i,1).toString();
+        final DefaultTableModel modeldef = new DefaultTableModel(
+        new String[]{tr("Menu Name (Default)"), tr("WMS URL (Default)")}, 0);
+        final JTable listdef = new JTable(modeldef){
+            public boolean isCellEditable(int row,int column){return false;}
+        };;
+        JScrollPane scrolldef = new JScrollPane(listdef);
+        p.add(scrolldef, GBC.eol().insets(0,5,0,0).fill(GBC.BOTH));
+        scrolldef.setPreferredSize(new Dimension(200,200));
 
-			WMSInfo origValue = oldValues.get(i);
-			if (origValue == null)
-			{
-				new WMSInfo(name, url, i).save();
-				change = true;
-			}
-			else
-			{
-				if (!origValue.name.equals(name) || !origValue.url.equals(url))
-				{
-					origValue.name = name; 
-					origValue.url = url;
-					origValue.save();
-					change = true;
-				}
-				oldValues.remove(i);
-			}
-		}
-		
-		// using null values instead of empty string really deletes
-		// the preferences entry
-		for (WMSInfo i : oldValues.values())
-		{
-			i.url = null;
-			i.name = null;
-			i.save();
-			change = true;
-		}
+        for (Map.Entry<String,String> i : WMSPlugin.wmsListDefault.entrySet()) {
+            modeldef.addRow(new String[]{i.getKey(), i.getValue()});
+        }
 
-		if (change) WMSPlugin.refreshMenu();
-		return false;
-	}
-	
+        JButton add = new JButton(tr("Add"));
+        p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
+        p.add(add, GBC.std().insets(0,5,0,0));
+        add.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                JPanel p = new JPanel(new GridBagLayout());
+                p.add(new JLabel(tr("Menu Name")), GBC.std().insets(0,0,5,0));
+                JTextField key = new JTextField(10);
+                JTextField value = new JTextField(10);
+                p.add(key, GBC.eop().insets(5,0,0,0).fill(GBC.HORIZONTAL));
+                p.add(new JLabel(tr("WMS URL")), GBC.std().insets(0,0,5,0));
+                p.add(value, GBC.eol().insets(5,0,0,0).fill(GBC.HORIZONTAL));
+                int answer = JOptionPane.showConfirmDialog(gui, p, tr("Enter a menu name and WMS URL"), JOptionPane.OK_CANCEL_OPTION);
+                if (answer == JOptionPane.OK_OPTION) {
+                    model.addRow(new String[]{key.getText(), value.getText()});
+                }
+            }
+        });
+
+        JButton delete = new JButton(tr("Delete"));
+        p.add(delete, GBC.std().insets(0,5,0,0));
+        delete.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                if (list.getSelectedRow() == -1)
+                    JOptionPane.showMessageDialog(gui, tr("Please select the row to delete."));
+                else
+                {
+                    Integer i;
+                    while ((i = list.getSelectedRow()) != -1)
+                        model.removeRow(i);
+                }
+            }
+        });
+
+        JButton copy = new JButton(tr("Copy Default"));
+        p.add(copy, GBC.std().insets(0,5,0,0));
+        copy.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                Integer line = listdef.getSelectedRow();
+                if (line == -1)
+                    JOptionPane.showMessageDialog(gui, tr("Please select the row to copy."));
+                else
+                {
+                    model.addRow(new String[]{modeldef.getValueAt(line, 0).toString(),
+                    modeldef.getValueAt(line, 1).toString()});
+                }
+            }
+        });
+    }
+
+    public boolean ok() {
+        boolean change = false;
+        for (int i = 0; i < model.getRowCount(); ++i) {
+            String name = model.getValueAt(i,0).toString();
+            String url = model.getValueAt(i,1).toString();
+
+            WMSInfo origValue = oldValues.get(i);
+            if (origValue == null)
+            {
+                new WMSInfo(name, url, i).save();
+                change = true;
+            }
+            else
+            {
+                if (!origValue.name.equals(name) || !origValue.url.equals(url))
+                {
+                    origValue.name = name;
+                    origValue.url = url;
+                    origValue.save();
+                    change = true;
+                }
+                oldValues.remove(i);
+            }
+        }
+
+        // using null values instead of empty string really deletes
+        // the preferences entry
+        for (WMSInfo i : oldValues.values())
+        {
+            i.url = null;
+            i.name = null;
+            i.save();
+            change = true;
+        }
+
+        if (change) WMSPlugin.refreshMenu();
+        return false;
+    }
+
     /**
      * Updates a server URL in the preferences dialog. Used by other plugins.
-     * 
+     *
      * @param server The server name
      * @param url The server URL
@@ -156,5 +156,5 @@
     public void setServerUrl(String server, String url)
     {
-        for (int i = 0; i < model.getRowCount(); i++) 
+        for (int i = 0; i < model.getRowCount(); i++)
         {
             if( server.equals(model.getValueAt(i,0).toString()) )
@@ -175,5 +175,5 @@
     public String getServerUrl(String server)
     {
-        for (int i = 0; i < model.getRowCount(); i++) 
+        for (int i = 0; i < model.getRowCount(); i++)
         {
             if( server.equals(model.getValueAt(i,0).toString()) )
Index: /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/YAHOOGrabber.java
===================================================================
--- /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/YAHOOGrabber.java	(revision 12777)
+++ /applications/editors/josm/plugins/wmsplugin/src/wmsplugin/YAHOOGrabber.java	(revision 12778)
@@ -20,35 +20,35 @@
 
 public class YAHOOGrabber extends WMSGrabber{
-	protected String browserCmd;
+    protected String browserCmd;
 
-	YAHOOGrabber(String baseURL, Bounds b, Projection proj,
-			double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer) {
-		super("file:///" + Main.pref.getPreferencesDir() + "plugins/wmsplugin/ymap.html?"
+    YAHOOGrabber(String baseURL, Bounds b, Projection proj,
+            double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer) {
+        super("file:///" + Main.pref.getPreferencesDir() + "plugins/wmsplugin/ymap.html?"
 //                + "request=getmap&format=image/jpeg"
-		, b, proj, pixelPerDegree, image, mv, layer);
-		this.browserCmd = baseURL.replaceFirst("yahoo://", "");
-	}
+        , b, proj, pixelPerDegree, image, mv, layer);
+        this.browserCmd = baseURL.replaceFirst("yahoo://", "");
+    }
 
-	protected BufferedImage grab(URL url) throws IOException {
-		ArrayList<String> cmdParams = new ArrayList<String>();
-		String urlstring = url.toExternalForm();
-		// work around a problem in URL removing 2 slashes
-		if(!urlstring.startsWith("file:///"))
-			urlstring = urlstring.replaceFirst("file:", "file://");
-		StringTokenizer st = new StringTokenizer(MessageFormat.format(browserCmd, urlstring));
-		while( st.hasMoreTokens() )
-			cmdParams.add(st.nextToken());
+    protected BufferedImage grab(URL url) throws IOException {
+        ArrayList<String> cmdParams = new ArrayList<String>();
+        String urlstring = url.toExternalForm();
+        // work around a problem in URL removing 2 slashes
+        if(!urlstring.startsWith("file:///"))
+            urlstring = urlstring.replaceFirst("file:", "file://");
+        StringTokenizer st = new StringTokenizer(MessageFormat.format(browserCmd, urlstring));
+        while( st.hasMoreTokens() )
+            cmdParams.add(st.nextToken());
 
-		System.out.println("WMS::Browsing YAHOO: " + cmdParams);
-		ProcessBuilder builder = new ProcessBuilder( cmdParams);
+        System.out.println("WMS::Browsing YAHOO: " + cmdParams);
+        ProcessBuilder builder = new ProcessBuilder( cmdParams);
 
-		Process browser;
-		try {
-			browser = builder.start();
-		} catch(IOException ioe) {
-			throw new IOException( "Could not start browser. Please check that the executable path is correct.\n" + ioe.getMessage() );
-		}
+        Process browser;
+        try {
+            browser = builder.start();
+        } catch(IOException ioe) {
+            throw new IOException( "Could not start browser. Please check that the executable path is correct.\n" + ioe.getMessage() );
+        }
 
-		return ImageIO.read(browser.getInputStream());
-	}
+        return ImageIO.read(browser.getInputStream());
+    }
 }
