Index: applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSInfo.java
===================================================================
--- applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSInfo.java	(revision 23324)
+++ applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSInfo.java	(revision 23325)
@@ -3,6 +3,4 @@
 import java.util.ArrayList;
 import java.util.Collection;
-
-import org.openstreetmap.josm.Main;
 
 /**
@@ -16,4 +14,5 @@
     String url=null;
     String cookies = null;
+    String eulaAcceptanceRequired = null;
     boolean html = false;
     double pixelPerDegree = 0.0;
@@ -28,5 +27,11 @@
     }
 
-    public WMSInfo(String name, String url, String cookies) {
+    public WMSInfo(String name, String url, String eulaAcceptanceRequired) {
+        this.name=name;
+        setURL(url);
+        this.eulaAcceptanceRequired = eulaAcceptanceRequired;
+    }
+
+    public WMSInfo(String name, String url, String eulaAcceptanceRequired, String cookies) {
         this.name=name;
         setURL(url);
Index: applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayerInfo.java
===================================================================
--- applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayerInfo.java	(revision 23324)
+++ applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayerInfo.java	(revision 23325)
@@ -4,10 +4,9 @@
 
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStreamReader;
-import java.io.IOException;
 import java.io.UnsupportedEncodingException;
-
+import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -103,10 +102,14 @@
                 {
                     String val[] = line.split(";");
-                    if(!line.startsWith("#") && val.length == 3) {
+                    if(!line.startsWith("#") && (val.length == 3 || val.length == 4)) {
                         boolean force = "true".equals(val[0]);
                         String name = tr(val[1]);
                         String url = val[2];
-
-                        defaultLayers.add(new WMSInfo(name, url));
+                        String eulaAcceptanceRequired = null;
+                        if (val.length == 4) {
+                            // 4th parameter optional for license agreement (EULA)
+                            eulaAcceptanceRequired = val[3];
+                        }
+                        defaultLayers.add(new WMSInfo(name, url, eulaAcceptanceRequired));
 
                         if(force) {
Index: applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
===================================================================
--- applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java	(revision 23324)
+++ applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java	(revision 23325)
@@ -10,7 +10,8 @@
 import java.awt.event.ActionListener;
 import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Locale;
 
 import javax.swing.Box;
@@ -18,4 +19,5 @@
 import javax.swing.JCheckBox;
 import javax.swing.JComboBox;
+import javax.swing.JEditorPane;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
@@ -58,5 +60,5 @@
         JScrollPane scroll = new JScrollPane(list);
         p.add(scroll, GBC.eol().fill(GridBagConstraints.BOTH));
-        scroll.setPreferredSize(new Dimension(200,200));
+        scroll.setPreferredSize(new Dimension(200, 200));
 
         final WMSDefaultLayerTableModel modeldef = new WMSDefaultLayerTableModel();
@@ -71,5 +73,5 @@
         // scrolldef is added after the buttons so it's clearer the buttons
         // control the top list and not the default one
-        scrolldef.setPreferredSize(new Dimension(200,200));
+        scrolldef.setPreferredSize(new Dimension(200, 200));
 
         TableColumnModel mod = listdef.getColumnModel();
@@ -84,6 +86,6 @@
 
         JButton add = new JButton(tr("Add"));
-        buttonPanel.add(add, GBC.std().insets(0,5,0,0));
-        add.addActionListener(new ActionListener(){
+        buttonPanel.add(add, GBC.std().insets(0, 5, 0, 0));
+        add.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 AddWMSLayerPanel p = new AddWMSLayerPanel();
@@ -99,11 +101,10 @@
 
         JButton delete = new JButton(tr("Delete"));
-        buttonPanel.add(delete, GBC.std().insets(0,5,0,0));
-        delete.addActionListener(new ActionListener(){
+        buttonPanel.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
-                {
+                else {
                     Integer i;
                     while ((i = list.getSelectedRow()) != -1)
@@ -114,6 +115,6 @@
 
         JButton copy = new JButton(tr("Copy Selected Default(s)"));
-        buttonPanel.add(copy, GBC.std().insets(0,5,0,0));
-        copy.addActionListener(new ActionListener(){
+        buttonPanel.add(copy, GBC.std().insets(0, 5, 0, 0));
+        copy.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 int[] lines = listdef.getSelectedRows();
@@ -123,16 +124,15 @@
                             tr("Please select at least one row to copy."),
                             tr("Information"),
-                            JOptionPane.INFORMATION_MESSAGE
-                    );
+                            JOptionPane.INFORMATION_MESSAGE);
                     return;
                 }
 
-                outer: for(int i = 0; i < lines.length; i++) {
+                outer: for (int i = 0; i < lines.length; i++) {
                     WMSInfo info = modeldef.getRow(lines[i]);
 
                     // Check if an entry with exactly the same values already
                     // exists
-                    for(int j = 0; j < model.getRowCount(); j++) {
-                        if(info.equalsBaseValues(model.getRow(j))) {
+                    for (int j = 0; j < model.getRowCount(); j++) {
+                        if (info.equalsBaseValues(model.getRow(j))) {
                             // Select the already existing row so the user has
                             // some feedback in case an entry exists
@@ -143,4 +143,9 @@
                     }
 
+                    if (info.eulaAcceptanceRequired != null) {
+                        if (!confirmeEulaAcceptance(gui, info.eulaAcceptanceRequired))
+                            continue outer;
+                    }
+
                     model.addRow(new WMSInfo(info));
                     int lastLine = model.getRowCount() - 1;
@@ -154,7 +159,7 @@
         p.add(Box.createHorizontalGlue(), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
         // Add default item list
-        p.add(scrolldef, GBC.eol().insets(0,5,0,0).fill(GridBagConstraints.BOTH));
-
-        browser = new JComboBox(new String[]{
+        p.add(scrolldef, GBC.eol().insets(0, 5, 0, 0).fill(GridBagConstraints.BOTH));
+
+        browser = new JComboBox(new String[] {
                 "webkit-image {0}",
                 "gnome-web-photo --mode=photo --format=png {0} /dev/stdout",
@@ -166,8 +171,8 @@
         p.add(browser);
 
-        //Overlap
+        // Overlap
         p.add(Box.createHorizontalGlue(), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
 
-        overlapCheckBox = new JCheckBox(tr("Overlap tiles"), plugin.PROP_OVERLAP.get() );
+        overlapCheckBox = new JCheckBox(tr("Overlap tiles"), plugin.PROP_OVERLAP.get());
         JLabel labelEast = new JLabel(tr("% of east:"));
         JLabel labelNorth = new JLabel(tr("% of north:"));
@@ -193,7 +198,6 @@
         p.add(overlapPanelSimConn, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
 
-
         allowRemoteControl = Main.pref.getBoolean("wmsplugin.remotecontrol", true);
-        remoteCheckBox = new JCheckBox(tr("Allow remote control (reqires remotecontrol plugin)"), allowRemoteControl );
+        remoteCheckBox = new JCheckBox(tr("Allow remote control (reqires remotecontrol plugin)"), allowRemoteControl);
         JPanel remotePanel = new JPanel(new FlowLayout());
         remotePanel.add(remoteCheckBox);
@@ -214,5 +218,5 @@
         Main.pref.put("wmsplugin.browser", browser.getEditor().getItem().toString());
 
-        Main.pref.put("wmsplugin.remotecontrol",    String.valueOf(allowRemoteControl));
+        Main.pref.put("wmsplugin.remotecontrol", String.valueOf(allowRemoteControl));
         return false;
     }
@@ -221,18 +225,17 @@
      * Updates a server URL in the preferences dialog. Used by other plugins.
      *
-     * @param server The server name
-     * @param url The server URL
+     * @param server
+     *            The server name
+     * @param url
+     *            The server URL
      */
-    public void setServerUrl(String server, String url)
-    {
-        for (int i = 0; i < model.getRowCount(); i++)
-        {
-            if( server.equals(model.getValueAt(i,0).toString()) )
-            {
+    public void setServerUrl(String server, String url) {
+        for (int i = 0; i < model.getRowCount(); i++) {
+            if (server.equals(model.getValueAt(i, 0).toString())) {
                 model.setValueAt(url, i, 1);
                 return;
             }
         }
-        model.addRow(new String[]{server, url});
+        model.addRow(new String[] { server, url });
     }
 
@@ -240,14 +243,12 @@
      * Gets a server URL in the preferences dialog. Used by other plugins.
      *
-     * @param server The server name
+     * @param server
+     *            The server name
      * @return The server URL
      */
-    public String getServerUrl(String server)
-    {
-        for (int i = 0; i < model.getRowCount(); i++)
-        {
-            if( server.equals(model.getValueAt(i,0).toString()) )
-            {
-                return model.getValueAt(i,1).toString();
+    public String getServerUrl(String server) {
+        for (int i = 0; i < model.getRowCount(); i++) {
+            if (server.equals(model.getValueAt(i, 0).toString())) {
+                return model.getValueAt(i, 1).toString();
             }
         }
@@ -261,5 +262,5 @@
     class WMSLayerTableModel extends DefaultTableModel {
         public WMSLayerTableModel() {
-            setColumnIdentifiers(new String[]{tr("Menu Name"), tr("WMS URL"), trc("layer", "Zoom")});
+            setColumnIdentifiers(new String[] { tr("Menu Name"), tr("WMS URL"), trc("layer", "Zoom") });
         }
 
@@ -270,11 +271,12 @@
         public void addRow(WMSInfo i) {
             plugin.info.add(i);
-            int p = getRowCount()-1;
-            fireTableRowsInserted(p,p);
-        }
-
+            int p = getRowCount() - 1;
+            fireTableRowsInserted(p, p);
+        }
+
+        @Override
         public void removeRow(int i) {
             plugin.info.remove(getRow(i));
-            fireTableRowsDeleted(i,i);
+            fireTableRowsDeleted(i, i);
         }
 
@@ -287,8 +289,11 @@
         public Object getValueAt(int row, int column) {
             WMSInfo info = plugin.info.layers.get(row);
-            switch(column) {
-            case 0: return info.name;
-            case 1: return info.getFullURL();
-            case 2: return info.pixelPerDegree == 0.0 ? "" : info.pixelPerDegree;
+            switch (column) {
+            case 0:
+                return info.name;
+            case 1:
+                return info.getFullURL();
+            case 2:
+                return info.pixelPerDegree == 0.0 ? "" : info.pixelPerDegree;
             }
             return null;
@@ -307,5 +312,5 @@
     class WMSDefaultLayerTableModel extends DefaultTableModel {
         public WMSDefaultLayerTableModel() {
-            setColumnIdentifiers(new String[]{tr("Menu Name (Default)"), tr("WMS URL (Default)")});
+            setColumnIdentifiers(new String[] { tr("Menu Name (Default)"), tr("WMS URL (Default)") });
         }
 
@@ -322,7 +327,9 @@
         public Object getValueAt(int row, int column) {
             WMSInfo info = plugin.info.defaultLayers.get(row);
-            switch(column) {
-            case 0: return info.name;
-            case 1: return info.getFullURL();
+            switch (column) {
+            case 0:
+                return info.name;
+            case 1:
+                return info.getFullURL();
             }
             return null;
@@ -334,3 +341,36 @@
         }
     }
+
+    private boolean confirmeEulaAcceptance(PreferenceTabbedPane gui, String eulaUrl) {
+        URL url = null;
+        try {
+            url = new URL(eulaUrl.replaceAll("\\{lang\\}", Locale.getDefault().toString()));
+            JEditorPane htmlPane = null;
+            try {
+                htmlPane = new JEditorPane(url);
+            } catch (IOException e1) {
+                // give a second chance with a default Locale 'en'
+                try {
+                    url = new URL(eulaUrl.replaceAll("\\{lang\\}", "en"));
+                    htmlPane = new JEditorPane(url);
+                } catch (IOException e2) {
+                    JOptionPane.showMessageDialog(gui ,tr("EULA license URL not available: {0}", eulaUrl));
+                    return false;
+                }
+            }
+            Box box = Box.createVerticalBox();
+            htmlPane.setEditable(false);
+            JScrollPane scrollPane = new JScrollPane(htmlPane);
+            scrollPane.setPreferredSize(new Dimension(400, 400));
+            box.add(scrollPane);
+            int option = JOptionPane.showConfirmDialog(Main.parent, box, tr("Please abort if you are not sure"), JOptionPane.YES_NO_OPTION,
+                    JOptionPane.WARNING_MESSAGE);
+            if (option == JOptionPane.YES_OPTION) {
+                return true;
+            }
+        } catch (MalformedURLException e2) {
+            JOptionPane.showMessageDialog(gui ,tr("Malformed URL for the EULA licence: {0}", eulaUrl));
+        }
+        return false;
+    }
 }
