Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkConstants.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkConstants.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkConstants.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -23,21 +23,32 @@
 public interface Tag2LinkConstants {
 
-	/**
-	 * XML Schema
-	 */
-	public static final String XML_LOCATION = "/resources/tag2link_sources.xml";
-	
-	/**
-	 * File encoding.
-	 */
-	public static final String UTF8_ENCODING = "UTF-8";
-	
-	/**
-	 * Plugin icons.
-	 */
-	public static String ICON_16 = "tag2linkv2_16x16.png";
-	public static String ICON_24 = "tag2linkv2_24x24.png";
+    /**
+     * XML Schema
+     */
+    public static final String XML_LOCATION = "/resources/tag2link_sources.xml";
+    
+    /**
+     * File encoding.
+     */
+    public static final String UTF8_ENCODING = "UTF-8";
+    
+    /**
+     * Plugin icon, 16x16 pixels.
+     */
+    public static String ICON_16 = "tag2linkv2_16x16.png";
+    
+    /**
+     * Plugin icon, 24x24 pixels.
+     */
+    public static String ICON_24 = "tag2linkv2_24x24.png";
+
+    /**
+     * Plugin icon, 48x48 pixels.
+     */
     public static String ICON_48 = "tag2linkv2_48x48.png";
     
+    /**
+     * Mail icon, 24x24 pixels.
+     */
     public static String MAIL_ICON_24 = "tag2mailv3_24x24.png";
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPlugin.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPlugin.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPlugin.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -17,5 +17,4 @@
 
 import org.openstreetmap.josm.gui.MapFrame;
-import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
 import org.openstreetmap.josm.plugins.Plugin;
 import org.openstreetmap.josm.plugins.PluginInformation;
@@ -29,4 +28,5 @@
  * @author Don-vip
  * History:
+ * 0.3d 15-Aug-2012 Add ref:(FR:)?FINESS and osm.fr link for ref:(FR:)?INSEE (josm#7961)
  * 0.3c 22-Dec-2011 Add contact namespace for website
  * 0.3b 29-Oct-2011 Add UAI support
@@ -44,13 +44,13 @@
     // private Tag2LinkPreferenceSetting preferenceSetting; TODO
 
-	/**
-	 * Initializes the plugin.
-	 * @param info
-	 */
-	public Tag2LinkPlugin(PluginInformation info) {
-		super(info);
-		// this.preferenceSetting = new Tag2LinkPreferenceSetting();
-		Tag2LinkRuleChecker.init();
-	}
+    /**
+     * Initializes the plugin.
+     * @param info The plugin info provided by JOSM
+     */
+    public Tag2LinkPlugin(PluginInformation info) {
+        super(info);
+        // this.preferenceSetting = new Tag2LinkPreferenceSetting();
+        Tag2LinkRuleChecker.init();
+    }
 
     /* (non-Javadoc)
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPreferenceSetting.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPreferenceSetting.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkPreferenceSetting.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -21,6 +21,14 @@
 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
 
+/**
+ * Preferences of tag2link plugin. Currently not implemented.
+ * @author Don-vip
+ *
+ */
 public class Tag2LinkPreferenceSetting extends DefaultTabPreferenceSetting implements Tag2LinkConstants {
 
+    /**
+     * Constructs a new {@code Tag2LinkPreferenceSetting}.
+     */
     public Tag2LinkPreferenceSetting() {
         super(ICON_48, tr("Tag2Link Preferences"), tr("Tag2Link Preferences"));
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkRuleChecker.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkRuleChecker.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/Tag2LinkRuleChecker.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -37,4 +37,9 @@
 import org.openstreetmap.josm.plugins.tag2link.io.SourcesReader;
 
+/**
+ * Class matching rules against a specified OSM primitive in order to get its relevant links. 
+ * @author Don-vip
+ *
+ */
 public class Tag2LinkRuleChecker implements Tag2LinkConstants {
 
@@ -42,5 +47,8 @@
     
     private static boolean initialized = false;
-        
+    
+    /**
+     * Initializes the matching rules mechanism.
+     */
     public static void init() {
         if (!initialized) {
@@ -51,115 +59,120 @@
     
     private static String findValue(String arg, Collection<MatchingTag> matchingTags) {
-		for (MatchingTag tag : matchingTags) {
-			if (tag.params.containsKey(arg)) {
-				return tag.params.get(arg);
-			}
-		}
-		return null;
+        for (MatchingTag tag : matchingTags) {
+            if (tag.params.containsKey(arg)) {
+                return tag.params.get(arg);
+            }
+        }
+        return null;
     }
     
     private static String replaceParams(String s, EvalResult eval) {
-    	String result = s;
-		Matcher m = Pattern.compile("%([^%]*)%").matcher(s);
-		while (m.find()) {
-			String arg = m.group(1);
-			
-			// Search for a standard value
-			String val = findValue(arg, eval.matchingTags);
-			
-			// No standard value found: test lang() function
-			if (val == null) {
-				Matcher lm = Pattern.compile(".*lang(?:\\((\\p{Lower}{2,})(?:,(\\p{Lower}{2,}))*\\))?.*").matcher(arg);
-				if (lm.matches()) {
-					String josmLang = Main.pref.get("language");
-					String jvmLang = (josmLang.isEmpty() ? Locale.getDefault().getLanguage() : josmLang).split("_")[0];
-					if (lm.groupCount() == 0) {
-						val = jvmLang;
-					} else {
-						for (int i = 1; i<=lm.groupCount() && val == null; i++) {
-							if (jvmLang.equals(lm.group(i))) {
-								val = jvmLang;
-							}
-						}
-					}
-				}
-			}
-			
-			// Find a default value if set after ":"
-			if (val == null && arg.contains(":")) {
-				String[] vars = arg.split(":");
-				for (int i = 0; val == null && i < vars.length-1; i++) {
-					val = findValue(vars[i], eval.matchingTags);
-				}
-				if (val == null) {
-					// Default value
-					val = vars[vars.length-1];
-				}
-			}
-			
-			// Has a value been found ?
-			if (val != null) {
-				try {
-					// Special hack for Wikipedia that prevents spaces being replaced by "+" characters, but by "_"
-					if (s.contains("wikipedia.")) {
-						val = val.replaceAll(" ", "_");
-					}
-					// Encode param to be included in the URL, except if it is the URL itself !
-					if (!m.group().equals(s)) {
-						val = URLEncoder.encode(val, UTF8_ENCODING);
-					}
-					// Finally replace parameter
-					result = result.replaceFirst(Pattern.quote(m.group()), val);
-				} catch (UnsupportedEncodingException e) {
-					e.printStackTrace();
-				}
-			} else {
-				System.err.println("Invalid argument: "+arg);
-			}
-		}
-    	return result;
+        String result = s;
+        Matcher m = Pattern.compile("%([^%]*)%").matcher(s);
+        while (m.find()) {
+            String arg = m.group(1);
+            
+            // Search for a standard value
+            String val = findValue(arg, eval.matchingTags);
+            
+            // No standard value found: test lang() function
+            if (val == null) {
+                Matcher lm = Pattern.compile(".*lang(?:\\((\\p{Lower}{2,})(?:,(\\p{Lower}{2,}))*\\))?.*").matcher(arg);
+                if (lm.matches()) {
+                    String josmLang = Main.pref.get("language");
+                    String jvmLang = (josmLang.isEmpty() ? Locale.getDefault().getLanguage() : josmLang).split("_")[0];
+                    if (lm.groupCount() == 0) {
+                        val = jvmLang;
+                    } else {
+                        for (int i = 1; i<=lm.groupCount() && val == null; i++) {
+                            if (jvmLang.equals(lm.group(i))) {
+                                val = jvmLang;
+                            }
+                        }
+                    }
+                }
+            }
+            
+            // Find a default value if set after ":"
+            if (val == null && arg.contains(":")) {
+                String[] vars = arg.split(":");
+                for (int i = 0; val == null && i < vars.length-1; i++) {
+                    val = findValue(vars[i], eval.matchingTags);
+                }
+                if (val == null) {
+                    // Default value
+                    val = vars[vars.length-1];
+                }
+            }
+            
+            // Has a value been found ?
+            if (val != null) {
+                try {
+                    // Special hack for Wikipedia that prevents spaces being replaced by "+" characters, but by "_"
+                    if (s.contains("wikipedia.")) {
+                        val = val.replaceAll(" ", "_");
+                    }
+                    // Encode param to be included in the URL, except if it is the URL itself !
+                    if (!m.group().equals(s)) {
+                        val = URLEncoder.encode(val, UTF8_ENCODING);
+                    }
+                    // Finally replace parameter
+                    result = result.replaceFirst(Pattern.quote(m.group()), val);
+                } catch (UnsupportedEncodingException e) {
+                    e.printStackTrace();
+                }
+            } else {
+                System.err.println("Invalid argument: "+arg);
+            }
+        }
+        return result;
     }
     
     private static void replaceMapParams(Map<String, String> map, EvalResult eval) {
-		for (Iterator<String> it = map.keySet().iterator(); it.hasNext(); ) {
-			String key = it.next();
-			String value = map.get(key);
-			String key2 = replaceParams(key, eval);
-			String value2 = replaceParams(value, eval);
-			if (key.equals(key2) && value.equals(value2)) {
-				// Nothing to do
-			} else if (key.equals(key2)) {
-				// Update value
-				map.put(key, value2);
-			} else {
-				// Update key, and maybe value
-				map.remove(key);
-				map.put(key2, value2);
-			}
-		}
+        for (Iterator<String> it = map.keySet().iterator(); it.hasNext(); ) {
+            String key = it.next();
+            String value = map.get(key);
+            String key2 = replaceParams(key, eval);
+            String value2 = replaceParams(value, eval);
+            if (key.equals(key2) && value.equals(value2)) {
+                // Nothing to do
+            } else if (key.equals(key2)) {
+                // Update value
+                map.put(key, value2);
+            } else {
+                // Update key, and maybe value
+                map.remove(key);
+                map.put(key2, value2);
+            }
+        }
     }
     
     private static Collection<Link> processEval(EvalResult eval, Rule rule, Source source) {
-    	Collection<Link> result = new ArrayList<Link>();
+        Collection<Link> result = new ArrayList<Link>();
         if (eval.matches()) {
             for (Link link : rule.links) {
-        		try {
-					Link copy = (Link) link.clone();
-	            	copy.name = copy.name.replaceAll("%name%", source.name);
-	            	copy.url = replaceParams(copy.url, eval);
-	            	if (copy instanceof LinkPost) {
-	            		LinkPost lp = (LinkPost) copy;
-	            		replaceMapParams(lp.headers, eval);
-	            		replaceMapParams(lp.params, eval);
-	            	}
-	            	result.add(copy);
-        		} catch (CloneNotSupportedException e) {
-        			System.err.println(e);
-        		}
-            }
-        }
-        return result;
-    }
-    
+                try {
+                    Link copy = (Link) link.clone();
+                    copy.name = copy.name.replaceAll("%name%", source.name);
+                    copy.url = replaceParams(copy.url, eval);
+                    if (copy instanceof LinkPost) {
+                        LinkPost lp = (LinkPost) copy;
+                        replaceMapParams(lp.headers, eval);
+                        replaceMapParams(lp.params, eval);
+                    }
+                    result.add(copy);
+                } catch (CloneNotSupportedException e) {
+                    System.err.println(e);
+                }
+            }
+        }
+        return result;
+    }
+    
+    /**
+     * Replies the links relevant to the given OSM primitive.
+     * @param p The OSM primitive
+     * @return the links relevant to the {@code p}.
+     */
     public static Collection<Link> getLinks(IPrimitive p) {
         Collection<Link> result = new ArrayList<Link>();
@@ -172,6 +185,11 @@
     }
 
-	public static Collection<Link> getLinks(Tag tag) {
-		Collection<Link> result = new ArrayList<Link>();
+    /**
+     * Replies the links relevant to the given OSM tag.
+     * @param tag The OSM tag
+     * @return the links relevant to the {@code tag}.
+     */
+    public static Collection<Link> getLinks(Tag tag) {
+        Collection<Link> result = new ArrayList<Link>();
         for (Source source : sources) {
             for (Rule rule : source.rules) {
@@ -179,5 +197,5 @@
             }
         }
-		return result;
-	}
+        return result;
+    }
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenLinkAction.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenLinkAction.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenLinkAction.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -33,4 +33,9 @@
 import org.openstreetmap.josm.tools.OpenBrowser;
 
+/**
+ * Action allowing to open a general link.
+ * @author Don-vip
+ *
+ */
 @SuppressWarnings("serial")
 public class OpenLinkAction extends JosmAction implements Tag2LinkConstants {
@@ -38,4 +43,8 @@
     private Link link;
     
+    /**
+     * Constructs a new {@code OpenLinkAction}.
+     * @param link The link to open
+     */
     public OpenLinkAction(Link link) {
         super(tr(link.name), ICON_24, tr("Launch browser with information about the selected object"), null, false);
@@ -45,55 +54,55 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-    	if (link instanceof LinkPost) {
-    		try {
-    			LinkPost lp = (LinkPost) link;
-        		System.out.println("Sending POST request to "+lp.url);
-        		HttpURLConnection conn = (HttpURLConnection) new URL(lp.url).openConnection();
-				conn.setDoOutput(true);
-				conn.setRequestMethod("POST");
-				for (String header : lp.headers.keySet()) {
-					conn.setRequestProperty(header, lp.headers.get(header));
-				}
-				String data = "";
-				for (String param : lp.params.keySet()) {
-					if (!data.isEmpty()) {
-						data += "&";
-					}
-					data += param+"="+lp.params.get(param);
-				}
-				OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());
-				osw.write(data);
-				osw.flush();
-				osw.close();
-				
-				String filename = "output.pdf";// FIXME: should work for PDF files only (not even tested)
-				FileOutputStream fos = new FileOutputStream(filename);
-				InputStream is = conn.getInputStream();
-				byte[] buffer = new byte[2048];
-				int n = -1;
-				while ((n = is.read(buffer)) > -1) {
-					fos.write(buffer, 0, n);
-				}
-				is.close();
-				fos.close();
-				
-		    	System.out.println("Opening "+filename);
-		    	String result = OpenBrowser.displayUrl("file://"+filename);
-		        if (result != null) {
-		        	System.err.println(result);
-		        }
-		        
-			} catch (MalformedURLException ex) {
-				ex.printStackTrace();
-			} catch (IOException ex) {
-				ex.printStackTrace();
-			}
-    	} else {
-	    	System.out.println("Opening "+link.url);
-	        String result = OpenBrowser.displayUrl(link.url);
-	        if (result != null) {
-	        	System.err.println(result);
-	        }
-    	}
+        if (link instanceof LinkPost) {
+            try {
+                LinkPost lp = (LinkPost) link;
+                System.out.println("Sending POST request to "+lp.url);
+                HttpURLConnection conn = (HttpURLConnection) new URL(lp.url).openConnection();
+                conn.setDoOutput(true);
+                conn.setRequestMethod("POST");
+                for (String header : lp.headers.keySet()) {
+                    conn.setRequestProperty(header, lp.headers.get(header));
+                }
+                String data = "";
+                for (String param : lp.params.keySet()) {
+                    if (!data.isEmpty()) {
+                        data += "&";
+                    }
+                    data += param+"="+lp.params.get(param);
+                }
+                OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());
+                osw.write(data);
+                osw.flush();
+                osw.close();
+                
+                String filename = "output.pdf";// FIXME: should work for PDF files only (not even tested)
+                FileOutputStream fos = new FileOutputStream(filename);
+                InputStream is = conn.getInputStream();
+                byte[] buffer = new byte[2048];
+                int n = -1;
+                while ((n = is.read(buffer)) > -1) {
+                    fos.write(buffer, 0, n);
+                }
+                is.close();
+                fos.close();
+                
+                System.out.println("Opening "+filename);
+                String result = OpenBrowser.displayUrl("file://"+filename);
+                if (result != null) {
+                    System.err.println(result);
+                }
+                
+            } catch (MalformedURLException ex) {
+                ex.printStackTrace();
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        } else {
+            System.out.println("Opening "+link.url);
+            String result = OpenBrowser.displayUrl(link.url);
+            if (result != null) {
+                System.err.println(result);
+            }
+        }
     }
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenMailAction.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenMailAction.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/action/OpenMailAction.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -26,9 +26,18 @@
 import org.openstreetmap.josm.plugins.tag2link.data.Link;
 
+/**
+ * Action allowing to open a mailto:// link.
+ * @author Don-vip
+ *
+ */
 @SuppressWarnings("serial")
 public class OpenMailAction extends JosmAction implements Tag2LinkConstants {
-	
+    
     private String url;
     
+    /**
+     * Constructs a new {@code OpenMailAction}.
+     * @param link The link to open
+     */
     public OpenMailAction(Link link) {
         super(tr(link.name), MAIL_ICON_24, tr("Launch your default software for sending an email to the selected contact address"), null, false);
@@ -38,12 +47,12 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-    	if (Desktop.isDesktopSupported()) {
-    		try {
-    			System.out.println("Sending "+url);
-				Desktop.getDesktop().mail(new URI(url));
-			} catch (Exception ex) {
-				ex.printStackTrace();
-			}
-    	}
+        if (Desktop.isDesktopSupported()) {
+            try {
+                System.out.println("Sending "+url);
+                Desktop.getDesktop().mail(new URI(url));
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+        }
     }
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Condition.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Condition.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Condition.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -18,18 +18,35 @@
 import java.util.regex.Pattern;
 
+/**
+ * A condition allowing to match a rule against an OSM primitive or tag.
+ * @author Don-vip
+ *
+ */
 public class Condition {
+    
+    /**
+     * The pattern used against tag key. May be null.
+     */
     public Pattern keyPattern;
+
+    /**
+     * The pattern used against tag value. May be null.
+     */
     public Pattern valPattern;
+
+    /**
+     * The condition id. May be null.
+     */
     public String id;
     
-	/* (non-Javadoc)
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString() {
-		return "Condition ["
-				+ (keyPattern != null ? "k=" + keyPattern + ", " : "")
-				+ (valPattern != null ? "v=" + valPattern + ", " : "")
-				+ (id != null ? "id=" + id : "") + "]";
-	}
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "Condition ["
+                + (keyPattern != null ? "k=" + keyPattern + ", " : "")
+                + (valPattern != null ? "v=" + valPattern + ", " : "")
+                + (id != null ? "id=" + id : "") + "]";
+    }
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Link.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Link.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Link.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -21,10 +21,10 @@
     
     public Link(String name, String url) {
-    	this.name = name;
-    	this.url = url;
+        this.name = name;
+        this.url = url;
     }
     
     public Link(Link link) {
-    	this(new String(link.name), new String(link.url));
+        this(new String(link.name), new String(link.url));
     }
     
@@ -45,18 +45,18 @@
     }
 
-	/* (non-Javadoc)
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString() {
-		return "Link [name=" + name + ", url=" + url + "]";
-	}
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "Link [name=" + name + ", url=" + url + "]";
+    }
 
-	/* (non-Javadoc)
-	 * @see java.lang.Object#clone()
-	 */
-	@Override
-	public Link clone() throws CloneNotSupportedException {
-		return new Link(this);
-	}
+    /* (non-Javadoc)
+     * @see java.lang.Object#clone()
+     */
+    @Override
+    public Link clone() throws CloneNotSupportedException {
+        return new Link(this);
+    }
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/LinkPost.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/LinkPost.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/LinkPost.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -21,56 +21,56 @@
 public class LinkPost extends Link {
 
-	public final Map<String, String> headers;
-	public final Map<String, String> params;
-	
-	public LinkPost(LinkPost link) {
-		this(new String(link.name), new String(link.url), 
-				link.headers == null ? null : new HashMap<String, String>(link.headers), 
-				link.params  == null ? null : new HashMap<String, String>(link.params));
-	}
+    public final Map<String, String> headers;
+    public final Map<String, String> params;
+    
+    public LinkPost(LinkPost link) {
+        this(new String(link.name), new String(link.url), 
+                link.headers == null ? null : new HashMap<String, String>(link.headers), 
+                link.params  == null ? null : new HashMap<String, String>(link.params));
+    }
 
-	public LinkPost(String name, String url) {
-		this(name, url, null, null);
-	}
+    public LinkPost(String name, String url) {
+        this(name, url, null, null);
+    }
 
-	public LinkPost(String name, String url, Map<String, String> headers, Map<String, String> params) {
-		super(name, url);
-		this.headers = headers;
-		this.params = params;
-	}
-	
-	protected final boolean containsParams(Map<String, String> map) {
-		if (map != null) {
-			for (String key : map.keySet()) {
-				if (containsParams(map.get(key))) {
-					return true;
-				}
-			}
-		}
-		return false;
-	}
-	
-	public boolean headersContainsParams() {
-		return containsParams(headers);
-	}
+    public LinkPost(String name, String url, Map<String, String> headers, Map<String, String> params) {
+        super(name, url);
+        this.headers = headers;
+        this.params = params;
+    }
+    
+    protected final boolean containsParams(Map<String, String> map) {
+        if (map != null) {
+            for (String key : map.keySet()) {
+                if (containsParams(map.get(key))) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+    
+    public boolean headersContainsParams() {
+        return containsParams(headers);
+    }
 
-	public boolean paramsContainsParams() {
-		return containsParams(params);
-	}
+    public boolean paramsContainsParams() {
+        return containsParams(params);
+    }
 
-	/* (non-Javadoc)
-	 * @see org.openstreetmap.josm.plugins.tag2link.data.Link#containsParams()
-	 */
-	@Override
-	public boolean containsParams() {
-		return super.containsParams() || headersContainsParams() || paramsContainsParams();
-	}
+    /* (non-Javadoc)
+     * @see org.openstreetmap.josm.plugins.tag2link.data.Link#containsParams()
+     */
+    @Override
+    public boolean containsParams() {
+        return super.containsParams() || headersContainsParams() || paramsContainsParams();
+    }
 
-	/* (non-Javadoc)
-	 * @see org.openstreetmap.josm.plugins.tag2link.data.Link#clone()
-	 */
-	@Override
-	public LinkPost clone() throws CloneNotSupportedException {
-		return new LinkPost(this);
-	}
+    /* (non-Javadoc)
+     * @see org.openstreetmap.josm.plugins.tag2link.data.Link#clone()
+     */
+    @Override
+    public LinkPost clone() throws CloneNotSupportedException {
+        return new LinkPost(this);
+    }
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Rule.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Rule.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Rule.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -35,52 +35,52 @@
         private String prefix;
         public MatchingTag(String key, String value, String prefix) {
-        	this.key = key;
-        	this.value = value;
-        	this.params = new HashMap<String, String>();
-        	this.prefix = prefix;
-        	addKeyValueParams();
+            this.key = key;
+            this.value = value;
+            this.params = new HashMap<String, String>();
+            this.prefix = prefix;
+            addKeyValueParams();
         }
         public void addParams(Matcher m, String paramName) {
-    		for (int i = 1; i<=m.groupCount(); i++) {
-    			params.put(prefix+paramName+"."+i, m.group(i));
-    		}
+            for (int i = 1; i<=m.groupCount(); i++) {
+                params.put(prefix+paramName+"."+i, m.group(i));
+            }
         }
         private void addKeyValueParams() {
-        	params.put("k", key);
-        	params.put("v", value);
-        	if (!prefix.isEmpty()) {
-            	params.put(prefix+"k", key);
-            	params.put(prefix+"v", value);
-        	}
+            params.put("k", key);
+            params.put("v", value);
+            if (!prefix.isEmpty()) {
+                params.put(prefix+"k", key);
+                params.put(prefix+"v", value);
+            }
         }
-		/* (non-Javadoc)
-		 * @see java.lang.Object#toString()
-		 */
-		@Override
-		public String toString() {
-			return "MatchingTag [" + (key != null ? "key=" + key + ", " : "")
-					+ (value != null ? "value=" + value + ", " : "")
-					+ (params != null ? "params=" + params + ", " : "")
-					+ (prefix != null ? "prefix=" + prefix : "") + "]";
-		}
+        /* (non-Javadoc)
+         * @see java.lang.Object#toString()
+         */
+        @Override
+        public String toString() {
+            return "MatchingTag [" + (key != null ? "key=" + key + ", " : "")
+                    + (value != null ? "value=" + value + ", " : "")
+                    + (params != null ? "params=" + params + ", " : "")
+                    + (prefix != null ? "prefix=" + prefix : "") + "]";
+        }
     }
     
     public static class EvalResult {
-    	private final int conditionsNumber;
-    	public EvalResult(int conditionsNumber) {
-    		this.conditionsNumber = conditionsNumber;
-    	}
+        private final int conditionsNumber;
+        public EvalResult(int conditionsNumber) {
+            this.conditionsNumber = conditionsNumber;
+        }
         public final Collection<MatchingTag> matchingTags = new ArrayList<MatchingTag>();
         public boolean matches() {
             return conditionsNumber > 0 && matchingTags.size() >= conditionsNumber;
         }
-		/* (non-Javadoc)
-		 * @see java.lang.Object#toString()
-		 */
-		@Override
-		public String toString() {
-			return "EvalResult [conditionsNumber=" + conditionsNumber
-					+ ", matchingTags=" + matchingTags + "]";
-		}
+        /* (non-Javadoc)
+         * @see java.lang.Object#toString()
+         */
+        @Override
+        public String toString() {
+            return "EvalResult [conditionsNumber=" + conditionsNumber
+                    + ", matchingTags=" + matchingTags + "]";
+        }
     }
     
@@ -91,19 +91,19 @@
                 Matcher keyMatcher = c.keyPattern.matcher(key);
                 if (keyMatcher.matches()) {
-                	String idPrefix = c.id == null ? "" : c.id+".";
-            		MatchingTag tag = new MatchingTag(key, tags.get(key), idPrefix);
-            		tag.addParams(keyMatcher, "k");
-                	boolean matchingTag = true;
-                	if (c.valPattern != null) {
-                		Matcher valMatcher = c.valPattern.matcher(tag.value);
-                		if (valMatcher.matches()) {
-                			tag.addParams(valMatcher, "v");
-                		} else {
-                			matchingTag = false;
-                		}
-                	}
-                	if (matchingTag) {
-                		result.matchingTags.add(tag);
-                	}
+                    String idPrefix = c.id == null ? "" : c.id+".";
+                    MatchingTag tag = new MatchingTag(key, tags.get(key), idPrefix);
+                    tag.addParams(keyMatcher, "k");
+                    boolean matchingTag = true;
+                    if (c.valPattern != null) {
+                        Matcher valMatcher = c.valPattern.matcher(tag.value);
+                        if (valMatcher.matches()) {
+                            tag.addParams(valMatcher, "v");
+                        } else {
+                            matchingTag = false;
+                        }
+                    }
+                    if (matchingTag) {
+                        result.matchingTags.add(tag);
+                    }
                 }
             }
@@ -113,19 +113,19 @@
     
     public EvalResult evaluates(IPrimitive p) {
-    	return evaluates(p.getKeys());
+        return evaluates(p.getKeys());
     }
 
-	public EvalResult evaluates(Tag tag) {
-		Map<String, String> map = new HashMap<String, String>();
-		map.put(tag.getKey(), tag.getValue());
-		return evaluates(map);
-	}
+    public EvalResult evaluates(Tag tag) {
+        Map<String, String> map = new HashMap<String, String>();
+        map.put(tag.getKey(), tag.getValue());
+        return evaluates(map);
+    }
 
-	/* (non-Javadoc)
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString() {
-		return "Rule [conditions=" + conditions + ", links=" + links + "]";
-	}
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "Rule [conditions=" + conditions + ", links=" + links + "]";
+    }
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Source.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Source.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/data/Source.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -19,18 +19,34 @@
 import java.util.Collection;
 
+/**
+ * A source of links relative to an OSM primitive or tag, depending of the successful match of its conditions against it.
+ * @author Don-vip
+ *
+ */
 public class Source {
+    /**
+     * The user-friendly source name.
+     */
     public final String name;
+    
+    /**
+     * The rules applied against an OSM primitive or tag.
+     */
     public final Collection<Rule> rules = new ArrayList<Rule>();
 
+    /**
+     * Constructs a new {@code Source}.
+     * @param name The user-friendly source name
+     */
     public Source(String name) {
-		this.name = name;
-	}
+        this.name = name;
+    }
 
-	/* (non-Javadoc)
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString() {
-		return "Source [name=" + name + ", rules=" + rules + "]";
-	}
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "Source [name=" + name + ", rules=" + rules + "]";
+    }
 }
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/io/SourcesReader.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/io/SourcesReader.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/io/SourcesReader.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -42,12 +42,25 @@
 import org.openstreetmap.josm.plugins.tag2link.data.Source;
 
+/**
+ * Class allowing to read the sources file.
+ * @author Don-vip
+ *
+ */
 public class SourcesReader implements Tag2LinkConstants {
     
     XMLStreamReader parser;
     
+    /**
+     * Constructs a new {@code SourcesReader}.
+     * @param parser The XML parser
+     */
     public SourcesReader(XMLStreamReader parser) {
         this.parser = parser;
     }
 
+    /**
+     * Reads the sources and replies them as a {@code Collection}. 
+     * @return The colleciton of sources.
+     */
     public static Collection<Source> readSources() {
         List<Source> result = new ArrayList<Source>();
@@ -184,5 +197,5 @@
         String v = parser.getAttributeValue(null, "v");
         if (v != null) {
-        	c.valPattern = Pattern.compile(v);
+            c.valPattern = Pattern.compile(v);
         }
         c.id = parser.getAttributeValue(null, "id");
@@ -197,17 +210,17 @@
         
         if ("POST".equals(parser.getAttributeValue(null, "method"))) {
-        	Map<String, String> headers = null;
-        	Map<String, String> params = null;
-        	while (parser.hasNext()) {
+            Map<String, String> headers = null;
+            Map<String, String> params = null;
+            while (parser.hasNext()) {
                 int event = parser.next();
                 if (event == XMLStreamConstants.START_ELEMENT) {
                     if (parser.getLocalName().equals("header")) {
                         if (headers == null) {
-                        	headers = new HashMap<String, String>();
+                            headers = new HashMap<String, String>();
                         }
                         headers.put(parser.getAttributeValue(null, "name"), parser.getAttributeValue(null, "value"));
                     } else if (parser.getLocalName().equals("param")) {
                         if (params == null) {
-                        	params = new HashMap<String, String>();
+                            params = new HashMap<String, String>();
                         }
                         params.put(parser.getAttributeValue(null, "name"), parser.getAttributeValue(null, "value"));
@@ -217,12 +230,12 @@
                 } else if (event == XMLStreamConstants.END_ELEMENT) {
                     if (parser.getLocalName().equals("link")) {
-                    	break;
+                        break;
                     }
                 }
             }
-        	link = new LinkPost(name, href, headers, params);
+            link = new LinkPost(name, href, headers, params);
         } else {
-	        link = new Link(name, href);
-	        jumpToEnd();
+            link = new Link(name, href);
+            jumpToEnd();
         }
         return link;
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/AbstractIPrimitivePopupListener.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/AbstractIPrimitivePopupListener.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/AbstractIPrimitivePopupListener.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/AbstractPopupListener.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/AbstractPopupListener.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/AbstractPopupListener.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
@@ -54,10 +54,10 @@
     
     protected void addLink(JPopupMenu popup, Link link) {
-    	JosmAction action = null;
-    	if (link.url.matches("mailto:.*")) {
-    		action = new OpenMailAction(link);
-    	} else {
-    		action = new OpenLinkAction(link);
-    	}
+        JosmAction action = null;
+        if (link.url.matches("mailto:.*")) {
+            action = new OpenMailAction(link);
+        } else {
+            action = new OpenLinkAction(link);
+        }
 
         itemList.add(popup.add(action));
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/MembershipPopupListener.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/MembershipPopupListener.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/MembershipPopupListener.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/PropertyPopupListener.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/PropertyPopupListener.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/PropertyPopupListener.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/RelationPopupListener.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/RelationPopupListener.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/RelationPopupListener.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
Index: /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/SelectionPopupListener.java
===================================================================
--- /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/SelectionPopupListener.java	(revision 28546)
+++ /applications/editors/josm/plugins/tag2link/src/org/openstreetmap/josm/plugins/tag2link/listeners/SelectionPopupListener.java	(revision 28547)
@@ -1,4 +1,4 @@
 //    JOSM tag2link plugin.
-//    Copyright (C) 2011 Don-vip & FrViPofm
+//    Copyright (C) 2011-2012 Don-vip & FrViPofm
 //
 //    This program is free software: you can redistribute it and/or modify
