Index: applications/editors/josm/plugins/opendata/.classpath
===================================================================
--- applications/editors/josm/plugins/opendata/.classpath	(revision 34448)
+++ applications/editors/josm/plugins/opendata/.classpath	(revision 34452)
@@ -10,5 +10,9 @@
 	<classpathentry kind="src" path="modules/fr.toulouse/resources"/>
 	<classpathentry kind="src" path="util"/>
-	<classpathentry kind="src" path="test/unit"/>
+	<classpathentry kind="src" output="bintest" path="test/unit">
+		<attributes>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
 	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JOSM-utilsplugin2"/>
Index: applications/editors/josm/plugins/opendata/.settings/org.eclipse.wst.validation.prefs
===================================================================
--- applications/editors/josm/plugins/opendata/.settings/org.eclipse.wst.validation.prefs	(revision 34448)
+++ applications/editors/josm/plugins/opendata/.settings/org.eclipse.wst.validation.prefs	(revision 34452)
@@ -2,9 +2,10 @@
 USER_BUILD_PREFERENCE=enabledBuildValidatorList
 USER_MANUAL_PREFERENCE=enabledManualValidatorList
-USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.700.v201508251749
+USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.701.v201707142105
 eclipse.preferences.version=1
 override=true
 suspend=false
 vals/org.eclipse.wst.dtd.core.dtdDTDValidator/global=FF01
+vals/org.eclipse.wst.html.core.HTMLValidator/global=FF01
 vals/org.eclipse.wst.xml.core.xml/global=FF03
 vals/org.eclipse.wst.xsd.core.xsd/global=FF02162org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator
Index: applications/editors/josm/plugins/opendata/build.xml
===================================================================
--- applications/editors/josm/plugins/opendata/build.xml	(revision 34448)
+++ applications/editors/josm/plugins/opendata/build.xml	(revision 34452)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <project name="opendata" default="dist" basedir=".">
-    <property name="plugin.main.version" value="13927"/>
+    <property name="plugin.main.version" value="14153"/>
     <property name="plugin.author" value="Don-vip"/>
     <property name="plugin.class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/>
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java	(revision 34452)
@@ -14,7 +14,7 @@
 import javax.swing.JMenuItem;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.ExtensionFileFilter;
 import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.gui.MainFrame;
 import org.openstreetmap.josm.gui.MainMenu;
 import org.openstreetmap.josm.gui.MapFrame;
@@ -187,11 +187,12 @@
 
     private void loadModules() {
-        List<ModuleInformation> modulesToLoad = ModuleHandler.buildListOfModulesToLoad(Main.parent);
-        if (!modulesToLoad.isEmpty() && ModuleHandler.checkAndConfirmModuleUpdate(Main.parent)) {
-            modulesToLoad = ModuleHandler.updateModules(Main.parent, modulesToLoad, null);
+        MainFrame parent = MainApplication.getMainFrame();
+        List<ModuleInformation> modulesToLoad = ModuleHandler.buildListOfModulesToLoad(parent);
+        if (!modulesToLoad.isEmpty() && ModuleHandler.checkAndConfirmModuleUpdate(parent)) {
+            modulesToLoad = ModuleHandler.updateModules(parent, modulesToLoad, null);
         }
 
         ModuleHandler.installDownloadedModules(true);
-        ModuleHandler.loadModules(Main.parent, modulesToLoad, null);
+        ModuleHandler.loadModules(parent, modulesToLoad, null);
     }
 
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/DownloadDataTask.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/DownloadDataTask.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/DownloadDataTask.java	(revision 34452)
@@ -11,5 +11,4 @@
 import javax.swing.JOptionPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask;
 import org.openstreetmap.josm.actions.downloadtasks.DownloadParams;
@@ -118,5 +117,5 @@
 
         } catch (IOException e) {
-            JOptionPane.showMessageDialog(Main.parent, tr("License URL not available: {0}", license.toString()));
+            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("License URL not available: {0}", license.toString()));
             return false;
         }
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/OpenPreferencesActions.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/OpenPreferencesActions.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/OpenPreferencesActions.java	(revision 34452)
@@ -7,6 +7,6 @@
 import java.awt.event.KeyEvent;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.preferences.PreferenceDialog;
 import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
@@ -15,14 +15,14 @@
 
 public class OpenPreferencesActions extends JosmAction {
-    
+
     public OpenPreferencesActions() {
-        super(tr("OpenData preferences"), OdConstants.ICON_CORE_24, null, 
+        super(tr("OpenData preferences"), OdConstants.ICON_CORE_24, null,
                 Shortcut.registerShortcut("opendata_open_preferences", tr("OpenData preferences"),
                 KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), true, false);
     }
-    
+
     @Override
     public void actionPerformed(ActionEvent e) {
-        final PreferenceDialog p = new PreferenceDialog(Main.parent);
+        final PreferenceDialog p = new PreferenceDialog(MainApplication.getMainFrame());
         p.selectPreferencesTabByClass(OdPreferenceSetting.class);
         p.setVisible(true);
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/DataSetUpdater.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/DataSetUpdater.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/DataSetUpdater.java	(revision 34452)
@@ -10,5 +10,4 @@
 import java.util.stream.Collectors;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.SimplifyWayAction;
 import org.openstreetmap.josm.command.SequenceCommand;
@@ -22,4 +21,5 @@
 import org.openstreetmap.josm.io.OsmApi;
 import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+import org.openstreetmap.josm.spi.preferences.Config;
 
 public abstract class DataSetUpdater {
@@ -35,5 +35,5 @@
                     }
                 }
-                if (!Main.pref.getBoolean(OdConstants.PREF_RAWDATA)) {
+                if (!Config.getPref().getBoolean(OdConstants.PREF_RAWDATA)) {
                     handler.updateDataSet(dataSet);
                 }
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/WayCombiner.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/WayCombiner.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/WayCombiner.java	(revision 34452)
@@ -14,5 +14,4 @@
 import java.util.Set;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.corrector.ReverseWayTagCorrector;
@@ -23,4 +22,5 @@
 import org.openstreetmap.josm.data.osm.TagCollection;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog;
 import org.openstreetmap.josm.tools.UserCancelException;
@@ -132,5 +132,5 @@
         completeTagCollectionForEditing(tagsToEdit);
 
-        CombinePrimitiveResolverDialog dialog = new CombinePrimitiveResolverDialog(Main.parent);
+        CombinePrimitiveResolverDialog dialog = new CombinePrimitiveResolverDialog(MainApplication.getMainFrame());
         dialog.getTagConflictResolverModel().populate(tagsToEdit, completeWayTags.getKeysWithMultipleValues());
         dialog.setTargetPrimitive(targetWay);
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/be/BelgianDataSetHandler.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/be/BelgianDataSetHandler.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/be/BelgianDataSetHandler.java	(revision 34452)
@@ -6,5 +6,4 @@
 import java.util.Locale;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -14,4 +13,5 @@
 import org.openstreetmap.josm.plugins.opendata.core.datasets.SimpleDataSetHandler;
 import org.openstreetmap.josm.plugins.opendata.core.io.tabular.DefaultCsvHandler;
+import org.openstreetmap.josm.spi.preferences.Config;
 
 public abstract class BelgianDataSetHandler extends SimpleDataSetHandler implements BelgianConstants {
@@ -92,5 +92,5 @@
         try {
             String nationalPortalPath = "";
-            String lang = Main.pref.get("language");
+            String lang = Config.getPref().get("language");
             if (lang == null || lang.isEmpty()) {
                 lang = Locale.getDefault().toString();
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/AskLicenseAgreementDialog.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/AskLicenseAgreementDialog.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/AskLicenseAgreementDialog.java	(revision 34452)
@@ -6,12 +6,12 @@
 import java.io.IOException;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.plugins.opendata.core.licenses.License;
 
 public class AskLicenseAgreementDialog extends ViewLicenseDialog {
-    
+
     public AskLicenseAgreementDialog(License license) throws IOException {
-        super(license, Main.parent, tr("License Agreement"), new String[] {tr("Accept"), "", tr("Refuse")});
-        
+        super(license, MainApplication.getMainFrame(), tr("License Agreement"), new String[] {tr("Accept"), "", tr("Refuse")});
+
         setToolTipTexts(new String[] {
                 tr("I understand and accept these terms and conditions"),
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ChooserLauncher.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ChooserLauncher.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ChooserLauncher.java	(revision 34452)
@@ -4,6 +4,6 @@
 import java.awt.Component;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.projection.Projection;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.gui.util.GuiHelper;
@@ -20,5 +20,5 @@
     @Override
     public void run() {
-        Component parent = progressMonitor == null ? Main.parent : progressMonitor.getWindowParent();
+        Component parent = progressMonitor == null ? MainApplication.getMainFrame() : progressMonitor.getWindowParent();
         ProjectionChooser dialog = (ProjectionChooser) new ProjectionChooser(parent).showDialog();
         if (dialog.getValue() == 1) {
@@ -26,5 +26,5 @@
         }
     }
-    
+
     public static Projection askForProjection(ProgressMonitor pm) {
         ChooserLauncher launcher = new ChooserLauncher(pm);
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreference.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreference.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreference.java	(revision 34452)
@@ -39,5 +39,4 @@
 import javax.swing.event.DocumentListener;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.HelpAwareOptionPane;
 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
@@ -54,4 +53,5 @@
 import org.openstreetmap.josm.plugins.opendata.core.modules.ReadLocalModuleInformationTask;
 import org.openstreetmap.josm.plugins.opendata.core.modules.ReadRemoteModuleInformationTask;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
@@ -225,5 +225,5 @@
             LinkedList<String> l = new LinkedList<>(model.getSelectedModuleNames());
             Collections.sort(l);
-            Main.pref.putList(OdConstants.PREF_MODULES, l);
+            Config.getPref().putList(OdConstants.PREF_MODULES, l);
             return true;
         }
@@ -484,5 +484,5 @@
                     }
                     String s = (String) JOptionPane.showInputDialog(
-                            Main.parent,
+                            MainApplication.getMainFrame(),
                             tr("Edit Open Data Module description URL."),
                             tr("Open Data Module description URL"),
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreferencesModel.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreferencesModel.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreferencesModel.java	(revision 34452)
@@ -13,5 +13,4 @@
 import java.util.Set;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.util.ChangeNotifier;
 import org.openstreetmap.josm.plugins.opendata.OdPlugin;
@@ -19,4 +18,5 @@
 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleException;
 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleInformation;
+import org.openstreetmap.josm.spi.preferences.Config;
 
 public class ModulePreferencesModel extends ChangeNotifier {
@@ -29,5 +29,5 @@
 
     protected List<String> getModules(List<String> def) {
-        return Main.pref.getList(OdConstants.PREF_MODULES, def);
+        return Config.getPref().getList(OdConstants.PREF_MODULES, def);
     }
 
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/OdPreferenceSetting.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/OdPreferenceSetting.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/OdPreferenceSetting.java	(revision 34452)
@@ -22,5 +22,4 @@
 import javax.swing.SwingUtilities;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
@@ -29,4 +28,5 @@
 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleDownloadTask;
 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleInformation;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.GBC;
 
@@ -59,5 +59,5 @@
      */
     public static final Collection<String> getModuleSites() {
-        return Main.pref.getList(OdConstants.PREF_MODULES_SITES, Arrays.asList(OdConstants.DEFAULT_MODULE_SITES));
+        return Config.getPref().getList(OdConstants.PREF_MODULES_SITES, Arrays.asList(OdConstants.DEFAULT_MODULE_SITES));
     }
 
@@ -68,5 +68,5 @@
      */
     public static void setModuleSites(List<String> sites) {
-        Main.pref.putList(OdConstants.PREF_MODULES_SITES, sites);
+        Config.getPref().putList(OdConstants.PREF_MODULES_SITES, sites);
     }
 
@@ -88,5 +88,5 @@
 
         // option to enable raw data
-        rawData.setSelected(Main.pref.getBoolean(OdConstants.PREF_RAWDATA, OdConstants.DEFAULT_RAWDATA));
+        rawData.setSelected(Config.getPref().getBoolean(OdConstants.PREF_RAWDATA, OdConstants.DEFAULT_RAWDATA));
         rawData.setToolTipText(tr("Import only raw data (i.e. do not add/delete tags or replace them by standard OSM tags)"));
         general.add(rawData, GBC.eop().insets(0, 0, 0, 0));
@@ -103,5 +103,5 @@
         bgCoordinates.add(rbCC43);
         bgCoordinates.add(rbWGS84);
-        String currentCoordinates = Main.pref.get(PREF_COORDINATES, VALUE_CC9ZONES);
+        String currentCoordinates = Config.getPref().get(PREF_COORDINATES, VALUE_CC9ZONES);
         if (currentCoordinates.equals(VALUE_WGS84))
             rbWGS84.setSelected(true);
@@ -113,5 +113,5 @@
         // option to set the Overpass API server
         JLabel jLabelOapi = new JLabel(tr("Overpass API server:"));
-        oapi.setText(Main.pref.get(OdConstants.PREF_OAPI, OdConstants.DEFAULT_OAPI));
+        oapi.setText(Config.getPref().get(OdConstants.PREF_OAPI, OdConstants.DEFAULT_OAPI));
         oapi.setToolTipText(tr("Overpass API server used to download OSM data"));
         general.add(jLabelOapi, GBC.std().insets(0, 5, 10, 0));
@@ -120,5 +120,5 @@
         // option to set the XAPI server
         JLabel jLabelXapi = new JLabel(tr("XAPI server:"));
-        xapi.setText(Main.pref.get(OdConstants.PREF_XAPI, OdConstants.DEFAULT_XAPI));
+        xapi.setText(Config.getPref().get(OdConstants.PREF_XAPI, OdConstants.DEFAULT_XAPI));
         xapi.setToolTipText(tr("XAPI server used to download OSM data when Overpass API is not available"));
         general.add(jLabelXapi, GBC.std().insets(0, 5, 10, 0));
@@ -134,8 +134,8 @@
     public boolean ok() {
         boolean result = modulePref.ok();
-        //Main.pref.put(PREF_COORDINATES, rbWGS84.isSelected() ? VALUE_WGS84 : VALUE_CC9ZONES);
-        Main.pref.put(OdConstants.PREF_OAPI, oapi.getText());
-        Main.pref.put(OdConstants.PREF_XAPI, xapi.getText());
-        Main.pref.putBoolean(OdConstants.PREF_RAWDATA, rawData.isSelected());
+        //Config.getPref().put(PREF_COORDINATES, rbWGS84.isSelected() ? VALUE_WGS84 : VALUE_CC9ZONES);
+        Config.getPref().put(OdConstants.PREF_OAPI, oapi.getText());
+        Config.getPref().put(OdConstants.PREF_XAPI, xapi.getText());
+        Config.getPref().putBoolean(OdConstants.PREF_RAWDATA, rawData.isSelected());
 
         // create a task for downloading modules if the user has activated, yet not downloaded,
@@ -178,5 +178,5 @@
             if ((task != null && !task.isCanceled()) || requiresRestart) {
                 JOptionPane.showMessageDialog(
-                        Main.parent,
+                        MainApplication.getMainFrame(),
                         sb.toString(),
                         tr("Warning"),
@@ -184,5 +184,5 @@
                         );
             }
-            Main.parent.repaint();
+            MainApplication.getMainFrame().repaint();
         };
 
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ViewLicenseDialog.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ViewLicenseDialog.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ViewLicenseDialog.java	(revision 34452)
@@ -14,6 +14,6 @@
 import javax.swing.JScrollPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.ExtendedDialog;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.plugins.opendata.core.licenses.License;
 import org.openstreetmap.josm.tools.ImageProvider;
@@ -24,12 +24,12 @@
     private final JEditorPane htmlPane;
     private boolean summary;
-    
+
     public ViewLicenseDialog(License license) throws IOException {
-        this(license, Main.parent, tr("License"), new String[] {tr("OK"), "", tr("Cancel")});
+        this(license, MainApplication.getMainFrame(), tr("License"), new String[] {tr("OK"), "", tr("Cancel")});
     }
 
     public ViewLicenseDialog(License license, Component parent, String title, String[] buttonTexts) throws IOException {
         super(parent, title, buttonTexts);
-        
+
         this.license = license;
         this.htmlPane = new JEditorPane();
@@ -44,5 +44,5 @@
         JScrollPane scrollPane = new JScrollPane(htmlPane);
         scrollPane.setPreferredSize(new Dimension(800, 600));
-        
+
         setButtonIcons(new Icon[] {
                 ImageProvider.get("ok"),
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/OsmDownloader.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/OsmDownloader.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/OsmDownloader.java	(revision 34452)
@@ -6,7 +6,7 @@
 import java.util.Collection;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.Logging;
 
@@ -20,5 +20,5 @@
         if (oapiReq != null) {
             try {
-                String oapiServer = Main.pref.get(OdConstants.PREF_OAPI, OdConstants.DEFAULT_OAPI);
+                String oapiServer = Config.getPref().get(OdConstants.PREF_OAPI, OdConstants.DEFAULT_OAPI);
                 Logging.info(oapiReq);
                 String oapiReqEnc = URLEncoder.encode(oapiReq, OdConstants.UTF8);
@@ -32,5 +32,5 @@
     public static void downloadXapi(Collection<String> xapiReqs) {
         if (xapiReqs != null) {
-            String xapiServer = Main.pref.get(OdConstants.PREF_XAPI, OdConstants.DEFAULT_XAPI);
+            String xapiServer = Config.getPref().get(OdConstants.PREF_XAPI, OdConstants.DEFAULT_XAPI);
             for (String xapiReq : xapiReqs) {
                 MainApplication.getMenu().openLocation.openUrl(false, xapiServer+xapiReq);
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/DefaultShpHandler.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/DefaultShpHandler.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/DefaultShpHandler.java	(revision 34452)
@@ -20,5 +20,4 @@
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.operation.MathTransform;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -33,4 +32,5 @@
 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
 import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.Pair;
@@ -50,7 +50,7 @@
 
     private static boolean equals(Double a, Double b) {
-        boolean res = Math.abs(a - b) <= Main.pref.getDouble(
+        boolean res = Math.abs(a - b) <= Config.getPref().getDouble(
                 OdConstants.PREF_CRS_COMPARISON_TOLERANCE, OdConstants.DEFAULT_CRS_COMPARISON_TOLERANCE);
-        if (Main.pref.getBoolean(OdConstants.PREF_CRS_COMPARISON_DEBUG, false)) {
+        if (Config.getPref().getBoolean(OdConstants.PREF_CRS_COMPARISON_DEBUG, false)) {
             Logging.debug("Comparing "+a+" and "+b+" -> "+res);
         }
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java	(revision 34452)
@@ -44,5 +44,4 @@
 import org.opengis.referencing.operation.OperationNotFoundException;
 import org.opengis.referencing.operation.TransformException;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -59,4 +58,5 @@
 import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
 import org.openstreetmap.josm.plugins.opendata.core.gui.DialogPrompter;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.ImageOverlay;
 import org.openstreetmap.josm.tools.ImageProvider;
@@ -372,10 +372,10 @@
                         if (candidate instanceof AbstractCRS && crs instanceof AbstractIdentifiedObject) {
 
-                            Hints.putSystemDefault(Hints.COMPARISON_TOLERANCE, Main.pref.getDouble(
+                            Hints.putSystemDefault(Hints.COMPARISON_TOLERANCE, Config.getPref().getDouble(
                                     OdConstants.PREF_CRS_COMPARISON_TOLERANCE, OdConstants.DEFAULT_CRS_COMPARISON_TOLERANCE));
                             if (((AbstractCRS) candidate).equals((AbstractIdentifiedObject) crs, false)) {
                                 Logging.info("Found a potential CRS: "+candidate.getName());
                                 candidates.add(candidate);
-                            } else if (Main.pref.getBoolean(OdConstants.PREF_CRS_COMPARISON_DEBUG, false)) {
+                            } else if (Config.getPref().getBoolean(OdConstants.PREF_CRS_COMPARISON_DEBUG, false)) {
                                 compareDebug(crs, candidate);
                             }
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GmlReader.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GmlReader.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GmlReader.java	(revision 34452)
@@ -20,9 +20,9 @@
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.TransformException;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.io.UTFInputStreamReader;
@@ -93,5 +93,5 @@
     private DataSet parseDoc(ProgressMonitor instance) throws XMLStreamException, GeoCrsException, FactoryException,
     GeoMathTransformException, MismatchedDimensionException, TransformException {
-        Component parent = instance != null ? instance.getWindowParent() : Main.parent;
+        Component parent = instance != null ? instance.getWindowParent() : MainApplication.getMainFrame();
         while (parser.hasNext()) {
             int event = parser.next();
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java	(revision 34452)
@@ -40,5 +40,4 @@
 import org.opengis.referencing.FactoryException;
 import org.opengis.referencing.operation.TransformException;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
@@ -46,4 +45,5 @@
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.gui.util.GuiHelper;
@@ -235,5 +235,5 @@
                 int n = 0;
 
-                Component parent = instance != null ? instance.getWindowParent() : Main.parent;
+                Component parent = instance != null ? instance.getWindowParent() : MainApplication.getMainFrame();
 
                 try (FeatureIterator<?> iterator = collection.features()) {
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/OdsDocument.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/OdsDocument.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/OdsDocument.java	(revision 34452)
@@ -12,5 +12,5 @@
 import org.jopendocument.model.OpenDocument;
 import org.openstreetmap.josm.tools.Logging;
-import org.openstreetmap.josm.tools.Utils;
+import org.openstreetmap.josm.tools.XmlUtils;
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
@@ -37,5 +37,5 @@
         try {
             final ZipInputStream zis = new ZipInputStream(in);
-            final XMLReader rdr = Utils.newSafeSAXParser().getXMLReader();
+            final XMLReader rdr = XmlUtils.newSafeSAXParser().getXMLReader();
 
             ZipEntry entry;
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java	(revision 34452)
@@ -18,5 +18,4 @@
 import java.util.regex.Pattern;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -29,4 +28,5 @@
 import org.openstreetmap.josm.plugins.opendata.core.gui.ChooserLauncher;
 import org.openstreetmap.josm.plugins.opendata.core.io.ProjectionPatterns;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.Logging;
 
@@ -254,5 +254,5 @@
                     }
                     if (n == firstNode || n.getCoor().greatCircleDistance(firstNode.getCoor())
-                            > Main.pref.getDouble(OdConstants.PREF_TOLERANCE, OdConstants.DEFAULT_TOLERANCE)) {
+                            > Config.getPref().getDouble(OdConstants.PREF_TOLERANCE, OdConstants.DEFAULT_TOLERANCE)) {
                         ds.addPrimitive(n);
                     } else {
@@ -261,5 +261,5 @@
                 }
             }
-            if (handler != null && !Main.pref.getBoolean(OdConstants.PREF_RAWDATA)) {
+            if (handler != null && !Config.getPref().getBoolean(OdConstants.PREF_RAWDATA)) {
                 handler.nodesAdded(ds, nodes, header, lineNumber);
             }
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleHandler.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleHandler.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleHandler.java	(revision 34452)
@@ -34,5 +34,4 @@
 import javax.swing.JPanel;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.PreferencesUtils;
 import org.openstreetmap.josm.data.preferences.sources.SourceProvider;
@@ -48,4 +47,5 @@
 import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
 import org.openstreetmap.josm.plugins.opendata.core.gui.OdPreferenceSetting;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 import org.openstreetmap.josm.tools.I18n;
@@ -101,9 +101,9 @@
         String togglePreferenceKey = null;
         long tim = System.currentTimeMillis();
-        long last = Main.pref.getLong("opendata.modulemanager.lastupdate", 0);
-        Integer maxTime = Main.pref.getInt("opendata.modulemanager.time-based-update.interval", 60);
+        long last = Config.getPref().getLong("opendata.modulemanager.lastupdate", 0);
+        Integer maxTime = Config.getPref().getInt("opendata.modulemanager.time-based-update.interval", 60);
         long d = (tim - last) / (24 * 60 * 60 * 1000L);
         if ((last <= 0) || (maxTime <= 0)) {
-            Main.pref.put("opendata.modulemanager.lastupdate", Long.toString(tim));
+            Config.getPref().put("opendata.modulemanager.lastupdate", Long.toString(tim));
         } else if (d > maxTime) {
             message =
@@ -136,5 +136,5 @@
         // check whether automatic update at startup was disabled
         //
-        String policy = Main.pref.get(togglePreferenceKey, "ask");
+        String policy = Config.getPref().get(togglePreferenceKey, "ask");
         policy = policy.trim().toLowerCase();
         if (policy.equals("never")) {
@@ -169,13 +169,13 @@
             switch(ret) {
             case 0:
-                Main.pref.put(togglePreferenceKey, "always");
+                Config.getPref().put(togglePreferenceKey, "always");
                 break;
             case JOptionPane.CLOSED_OPTION:
             case 1:
-                Main.pref.put(togglePreferenceKey, "never");
+                Config.getPref().put(togglePreferenceKey, "never");
                 break;
             }
         } else {
-            Main.pref.put(togglePreferenceKey, "ask");
+            Config.getPref().put(togglePreferenceKey, "ask");
         }
         return ret == 0;
@@ -258,5 +258,5 @@
         }
         if (msg != null && confirmDisableModule(parent, msg, module.name)) {
-            PreferencesUtils.removeFromList(Main.pref, OdConstants.PREF_MODULES, module.name);
+            PreferencesUtils.removeFromList(Config.getPref(), OdConstants.PREF_MODULES, module.name);
         }
     }
@@ -364,5 +364,5 @@
     public static List<ModuleInformation> buildListOfModulesToLoad(Component parent) {
         Set<String> modules = new HashSet<>();
-        modules.addAll(Main.pref.getList(OdConstants.PREF_MODULES, new LinkedList<String>()));
+        modules.addAll(Config.getPref().getList(OdConstants.PREF_MODULES, new LinkedList<String>()));
         if (System.getProperty("josm."+OdConstants.PREF_MODULES) != null) {
             modules.addAll(Arrays.asList(System.getProperty("josm."+OdConstants.PREF_MODULES).split(",")));
@@ -494,5 +494,5 @@
         // remember the update because it was successful
         //
-        Main.pref.put("opendata.modulemanager.lastupdate", Long.toString(System.currentTimeMillis()));
+        Config.getPref().put("opendata.modulemanager.lastupdate", Long.toString(System.currentTimeMillis()));
         return modules;
     }
@@ -613,5 +613,5 @@
 
         int ret = HelpAwareOptionPane.showOptionDialog(
-                Main.parent,
+                MainApplication.getMainFrame(),
                 msg.toString(),
                 tr("Update modules"),
@@ -670,5 +670,5 @@
 
         Set<String> modules = new HashSet<String>(
-                Main.pref.getCollection(PREF_MODULES, Collections.<String> emptySet())
+                Config.getPref().getCollection(PREF_MODULES, Collections.<String> emptySet())
         );
         if (! modules.contains(module.getModuleInformation().name))
@@ -683,7 +683,7 @@
         // deactivate the module
         modules.remove(module.getModuleInformation().name);
-        Main.pref.putCollection(PREF_MODULES, modules);
+        Config.getPref().putCollection(PREF_MODULES, modules);
         JOptionPane.showMessageDialog(
-                Main.parent,
+                MainApplication.getMainFrame(),
                 tr("The module has been removed from the configuration. Please restart JOSM to unload the module."),
                 tr("Information"),
@@ -695,5 +695,5 @@
     /*public static String getBugReportText() {
         String text = "";
-        LinkedList <String> pl = new LinkedList<String>(Main.pref.getCollection(PREF_MODULES, new LinkedList<String>()));
+        LinkedList <String> pl = new LinkedList<String>(Config.getPref().getCollection(PREF_MODULES, new LinkedList<String>()));
         for (final Module pp : moduleList) {
             ModuleInformation pi = pp.getModuleInformation();
@@ -729,5 +729,5 @@
                     a.setEditable(false);
                     a.setText(b.toString());
-                    JOptionPane.showMessageDialog(Main.parent, new JScrollPane(a), tr("Module information"),
+                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(), new JScrollPane(a), tr("Module information"),
                             JOptionPane.INFORMATION_MESSAGE);
                 }
@@ -780,5 +780,5 @@
 
         public void initDontShowAgain(String preferencesKey) {
-            String policy = Main.pref.get(preferencesKey, "ask");
+            String policy = Config.getPref().get(preferencesKey, "ask");
             policy = policy.trim().toLowerCase();
             cbDontShowAgain.setSelected(!policy.equals("ask"));
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleInformation.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleInformation.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleInformation.java	(revision 34452)
@@ -24,5 +24,5 @@
 import javax.swing.ImageIcon;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.plugins.opendata.OdPlugin;
 import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
@@ -261,5 +261,5 @@
 
     public static Collection<String> getModuleLocations() {
-        Collection<String> locations = Main.pref.getAllPossiblePreferenceDirs();
+        Collection<String> locations = Preferences.getAllPossiblePreferenceDirs();
         Collection<String> all = new ArrayList<>(locations.size());
         for (String s : locations) {
Index: applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/util/OdUtils.java
===================================================================
--- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/util/OdUtils.java	(revision 34448)
+++ applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/util/OdUtils.java	(revision 34452)
@@ -14,7 +14,7 @@
 
 import org.apache.commons.lang3.StringUtils;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Utils;
@@ -71,5 +71,5 @@
 
     public static final String getJosmLanguage() {
-        String lang = Main.pref.get("language");
+        String lang = Config.getPref().get("language");
         if (lang == null || lang.isEmpty()) {
             lang = Locale.getDefault().toString();
