Index: /trunk/scripts/SyncEditorLayerIndex.groovy
===================================================================
--- /trunk/scripts/SyncEditorLayerIndex.groovy	(revision 14148)
+++ /trunk/scripts/SyncEditorLayerIndex.groovy	(revision 14149)
@@ -25,5 +25,4 @@
 import javax.json.JsonValue
 
-import org.openstreetmap.josm.Main
 import org.openstreetmap.josm.data.Preferences
 import org.openstreetmap.josm.data.imagery.ImageryInfo
@@ -61,5 +60,4 @@
         Locale.setDefault(Locale.ROOT)
         parse_command_line_arguments(args)
-        Main.determinePlatformHook()
         def pref = new Preferences(JosmBaseDirectories.getInstance())
         Config.setPreferencesInstance(pref)
Index: /trunk/scripts/TagInfoExtract.groovy
===================================================================
--- /trunk/scripts/TagInfoExtract.groovy	(revision 14148)
+++ /trunk/scripts/TagInfoExtract.groovy	(revision 14149)
@@ -21,7 +21,7 @@
 import javax.json.stream.JsonGenerator
 
-import org.openstreetmap.josm.Main
 import org.openstreetmap.josm.actions.DeleteAction
 import org.openstreetmap.josm.command.DeleteCommand
+import org.openstreetmap.josm.data.Preferences
 import org.openstreetmap.josm.data.Version
 import org.openstreetmap.josm.data.coor.LatLon
@@ -413,8 +413,7 @@
      */
     def init() {
-        Main.determinePlatformHook()
         Logging.setLogLevel(Logging.LEVEL_INFO)
-        Main.pref.enableSaveOnPut(false)
-        Config.setPreferencesInstance(Main.pref)
+        Preferences.main().enableSaveOnPut(false)
+        Config.setPreferencesInstance(Preferences.main())
         Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance())
         Config.setUrlsProvider(JosmUrls.getInstance())
Index: /trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/Main.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/Main.java	(revision 14149)
@@ -43,5 +43,7 @@
     /**
      * Global application preferences
-     */
+     * @deprecated Use {@link Config#getPref()} or {@link Preferences#main()}
+     */
+    @Deprecated
     public static final Preferences pref = new Preferences(JosmBaseDirectories.getInstance());
 
Index: /trunk/src/org/openstreetmap/josm/actions/PreferenceToggleAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/PreferenceToggleAction.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/actions/PreferenceToggleAction.java	(revision 14149)
@@ -6,5 +6,5 @@
 import javax.swing.JCheckBoxMenuItem;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.preferences.BooleanProperty;
 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
@@ -35,5 +35,5 @@
         checkbox = new JCheckBoxMenuItem(this);
         checkbox.setSelected(pref.get());
-        Main.pref.addWeakKeyPreferenceChangeListener(prefKey, this);
+        Preferences.main().addWeakKeyPreferenceChangeListener(prefKey, this);
     }
 
Index: /trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java	(revision 14149)
@@ -26,4 +26,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.Version;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -277,5 +278,5 @@
         String reportHeader = getReportHeader();
         text.append(reportHeader);
-        Map<String, Setting<?>> settings = Main.pref.getAllSettings();
+        Map<String, Setting<?>> settings = Preferences.main().getAllSettings();
         Set<String> keys = new HashSet<>(settings.keySet());
         for (String key : keys) {
Index: /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawSnapHelper.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawSnapHelper.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/actions/mapmode/DrawSnapHelper.java	(revision 14149)
@@ -18,5 +18,5 @@
 import javax.swing.JPopupMenu;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -234,5 +234,5 @@
 
         computeSnapAngles();
-        Main.pref.addWeakKeyPreferenceChangeListener(DRAW_ANGLESNAP_ANGLES, e -> this.computeSnapAngles());
+        Preferences.main().addWeakKeyPreferenceChangeListener(DRAW_ANGLESNAP_ANGLES, e -> this.computeSnapAngles());
     }
 
Index: /trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 14149)
@@ -36,4 +36,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.preferences.ColorInfo;
+import org.openstreetmap.josm.data.preferences.JosmBaseDirectories;
 import org.openstreetmap.josm.data.preferences.NamedColorProperty;
 import org.openstreetmap.josm.data.preferences.PreferencesReader;
@@ -116,4 +117,6 @@
     private final HashMap<String, ListenerList<org.openstreetmap.josm.spi.preferences.PreferenceChangedListener>> keyListeners = new HashMap<>();
 
+    private static final Preferences defaultInstance = new Preferences(JosmBaseDirectories.getInstance());
+
     /**
      * Constructs a new {@code Preferences}.
@@ -141,4 +144,13 @@
         settingsMap.putAll(pref.settingsMap);
         defaultsMap.putAll(pref.defaultsMap);
+    }
+
+    /**
+     * Returns the main (default) preferences instance.
+     * @return the main (default) preferences instance
+     * @since 14149
+     */
+    public static Preferences main() {
+        return defaultInstance;
     }
 
@@ -274,6 +286,6 @@
     public static Collection<String> getAllPossiblePreferenceDirs() {
         Set<String> locations = new HashSet<>();
-        addPossibleResourceDir(locations, Config.getDirs().getPreferencesDirectory(false).getPath());
-        addPossibleResourceDir(locations, Config.getDirs().getUserDataDirectory(false).getPath());
+        addPossibleResourceDir(locations, defaultInstance.dirs.getPreferencesDirectory(false).getPath());
+        addPossibleResourceDir(locations, defaultInstance.dirs.getUserDataDirectory(false).getPath());
         addPossibleResourceDir(locations, getSystemEnv("JOSM_RESOURCES"));
         addPossibleResourceDir(locations, getSystemProperty("josm.resources"));
Index: /trunk/src/org/openstreetmap/josm/gui/MainApplication.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 14149)
@@ -83,4 +83,5 @@
 import org.openstreetmap.josm.command.SplitWayCommand;
 import org.openstreetmap.josm.data.Bounds;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.UndoRedoHandler.CommandQueueListener;
@@ -819,5 +820,6 @@
         PlatformManager.getPlatform().preStartupHook();
 
-        Config.setPreferencesInstance(Main.pref);
+        Preferences prefs = Preferences.main();
+        Config.setPreferencesInstance(prefs);
         Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance());
         Config.setUrlsProvider(JosmUrls.getInstance());
@@ -843,10 +845,10 @@
 
         try {
-            Main.pref.init(args.hasOption(Option.RESET_PREFERENCES));
+            Preferences.main().init(args.hasOption(Option.RESET_PREFERENCES));
         } catch (SecurityException e) {
             Logging.log(Logging.LEVEL_ERROR, "Unable to initialize preferences", e);
         }
 
-        args.getPreferencesToSet().forEach(Main.pref::put);
+        args.getPreferencesToSet().forEach(prefs::put);
 
         if (!language.isPresent()) {
@@ -854,5 +856,5 @@
         }
         updateSystemProperties();
-        Main.pref.addPreferenceChangeListener(new PreferenceChangedListener() {
+        Preferences.main().addPreferenceChangeListener(new PreferenceChangedListener() {
             @Override
             public void preferenceChanged(PreferenceChangeEvent e) {
@@ -887,5 +889,5 @@
 
         if (args.hasOption(Option.LOAD_PREFERENCES)) {
-            XMLCommandProcessor config = new XMLCommandProcessor(Main.pref);
+            XMLCommandProcessor config = new XMLCommandProcessor(prefs);
             for (String i : args.get(Option.LOAD_PREFERENCES)) {
                 try {
Index: /trunk/src/org/openstreetmap/josm/gui/MainTermination.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/MainTermination.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/gui/MainTermination.java	(revision 14149)
@@ -8,5 +8,5 @@
 import java.util.Objects;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.cache.JCSCacheManager;
 import org.openstreetmap.josm.tools.ImageProvider;
@@ -48,5 +48,5 @@
         ImageProvider.shutdown(false);
         try {
-            Main.pref.saveDefaults();
+            Preferences.main().saveDefaults();
         } catch (IOException | InvalidPathException ex) {
             Logging.log(Logging.LEVEL_WARN, tr("Failed to save default preferences."), ex);
Index: /trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java	(revision 14149)
@@ -100,5 +100,5 @@
      */
     public static void readXML(File file) {
-        readXML(file, Main.pref);
+        readXML(file, Preferences.main());
     }
 
@@ -206,5 +206,5 @@
     public static void exportPreferencesKeysByPatternToFile(String fileName, boolean append, String pattern) {
         List<String> keySet = new ArrayList<>();
-        Map<String, Setting<?>> allSettings = Main.pref.getAllSettings();
+        Map<String, Setting<?>> allSettings = Preferences.main().getAllSettings();
         for (String key: allSettings.keySet()) {
             if (key.matches(pattern))
@@ -227,5 +227,5 @@
 
         try {
-            String toXML = Main.pref.toXML(true);
+            String toXML = Preferences.main().toXML(true);
             DocumentBuilder builder = XmlUtils.newSafeDOMBuilder();
             document = builder.parse(new ByteArrayInputStream(toXML.getBytes(StandardCharsets.UTF_8)));
@@ -358,5 +358,5 @@
                     for (PluginInformation pi4: toDeletePlugins) {
                         pls.remove(pi4.name);
-                        new File(Main.pref.getPluginsDirectory(), pi4.name+".jar").deleteOnExit();
+                        new File(Preferences.main().getPluginsDirectory(), pi4.name+".jar").deleteOnExit();
                     }
                     Config.getPref().putList("plugins", pls);
@@ -375,5 +375,5 @@
             dir = Config.getDirs().getCacheDirectory(false).getAbsolutePath();
         } else if ("plugins".equals(base)) {
-            dir = Main.pref.getPluginsDirectory().getAbsolutePath();
+            dir = Preferences.main().getPluginsDirectory().getAbsolutePath();
         } else {
             dir = null;
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java	(revision 14149)
@@ -130,5 +130,5 @@
             }
         });
-        readPreferences(Main.pref);
+        readPreferences(Preferences.main());
 
         applyFilter();
@@ -181,9 +181,9 @@
     private void readPreferences(Preferences tmpPrefs) {
         Map<String, Setting<?>> loaded;
-        Map<String, Setting<?>> orig = Main.pref.getAllSettings();
+        Map<String, Setting<?>> orig = Preferences.main().getAllSettings();
         Map<String, Setting<?>> defaults = tmpPrefs.getAllDefaults();
         orig.remove("osm-server.password");
         defaults.remove("osm-server.password");
-        if (tmpPrefs != Main.pref) {
+        if (tmpPrefs != Preferences.main()) {
             loaded = tmpPrefs.getAllSettings();
             // plugins preference keys may be changed directly later, after plugins are downloaded
@@ -262,5 +262,5 @@
             return;
 
-        Preferences tmpPrefs = new Preferences(Main.pref);
+        Preferences tmpPrefs = new Preferences(Preferences.main());
 
         StringBuilder log = new StringBuilder();
@@ -324,5 +324,5 @@
 
         for (Entry<String, String> e: profileTypes.entrySet()) {
-            menu.add(new ExportProfileAction(Main.pref, e.getKey(), e.getValue()));
+            menu.add(new ExportProfileAction(Preferences.main(), e.getKey(), e.getValue()));
         }
 
@@ -339,11 +339,11 @@
                         "Are you sure you want to continue?")
                         +"</html>", null, "")) {
-                    Main.pref.resetToDefault();
+                    Preferences.main().resetToDefault();
                     try {
-                        Main.pref.save();
+                        Preferences.main().save();
                     } catch (IOException | InvalidPathException e) {
                         Logging.log(Logging.LEVEL_WARN, "Exception while saving preferences:", e);
                     }
-                    readPreferences(Main.pref);
+                    readPreferences(Preferences.main());
                     applyFilter();
                 }
@@ -412,5 +412,5 @@
         @Override
         public void actionPerformed(ActionEvent ae) {
-            Preferences tmpPrefs = new Preferences(Main.pref);
+            Preferences tmpPrefs = new Preferences(Preferences.main());
             CustomConfigurator.readXML(file, tmpPrefs);
             readPreferences(tmpPrefs);
@@ -460,5 +460,5 @@
         for (PrefEntry e : allData) {
             if (e.isChanged()) {
-                Main.pref.putSetting(e.getKey(), e.getValue().getValue() == null ? null : e.getValue());
+                Preferences.main().putSetting(e.getKey(), e.getValue().getValue() == null ? null : e.getValue());
             }
         }
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java	(revision 14149)
@@ -36,5 +36,5 @@
 import javax.swing.table.DefaultTableCellRenderer;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
 import org.openstreetmap.josm.data.preferences.ColorInfo;
@@ -269,5 +269,5 @@
     public void addGui(final PreferenceTabbedPane gui) {
         fixColorPrefixes();
-        setColors(Main.pref.getAllNamedColors());
+        setColors(Preferences.main().getAllNamedColors());
 
         colorEdit = new JButton(tr("Choose"));
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java	(revision 14149)
@@ -45,4 +45,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.ExpertToggleAction;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.Version;
 import org.openstreetmap.josm.gui.HelpAwareOptionPane;
@@ -300,5 +301,5 @@
         if (answer != 0 /* OK */)
             return;
-        Main.pref.setPluginSites(pnl.getUpdateSites());
+        Preferences.main().setPluginSites(pnl.getUpdateSites());
     }
 
@@ -376,5 +377,5 @@
         @Override
         public void actionPerformed(ActionEvent e) {
-            Collection<String> pluginSites = Main.pref.getOnlinePluginSites();
+            Collection<String> pluginSites = Preferences.main().getOnlinePluginSites();
             if (pluginSites.isEmpty()) {
                 return;
@@ -430,5 +431,5 @@
             // the async task for downloading plugin information
             final ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask(
-                    Main.pref.getOnlinePluginSites());
+                    Preferences.main().getOnlinePluginSites());
 
             // to be run asynchronously after the plugin download
@@ -601,5 +602,5 @@
             super(new GridBagLayout());
             add(new JLabel(tr("Add JOSM Plugin description URL.")), GBC.eol());
-            for (String s : Main.pref.getPluginSites()) {
+            for (String s : Preferences.main().getPluginSites()) {
                 model.addElement(s);
             }
Index: /trunk/src/org/openstreetmap/josm/io/CachedFile.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/io/CachedFile.java	(revision 14149)
@@ -29,5 +29,5 @@
 import java.util.zip.ZipFile;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.HttpClient;
@@ -298,5 +298,5 @@
                 cacheFile = new File(Config.getDirs().getUserDataDirectory(false), name.substring("josmdir://".length()));
             } else if (name.startsWith("josmplugindir://")) {
-                cacheFile = new File(Main.pref.getPluginsDirectory(), name.substring("josmplugindir://".length()));
+                cacheFile = new File(Preferences.main().getPluginsDirectory(), name.substring("josmplugindir://".length()));
             } else {
                 cacheFile = new File(name);
Index: /trunk/src/org/openstreetmap/josm/plugins/Plugin.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/plugins/Plugin.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/plugins/Plugin.java	(revision 14149)
@@ -11,5 +11,5 @@
 import java.util.List;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.MapFrameListener;
@@ -167,5 +167,5 @@
      */
     public ClassLoader getPluginResourceClassLoader() {
-        File pluginDir = Main.pref.getPluginsDirectory();
+        File pluginDir = Preferences.main().getPluginsDirectory();
         File pluginJar = new File(pluginDir, info.name + ".jar");
         final URL pluginJarUrl = Utils.fileToURL(pluginJar);
Index: /trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java	(revision 14149)
@@ -15,5 +15,5 @@
 import java.util.LinkedList;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.Version;
 import org.openstreetmap.josm.gui.ExtendedDialog;
@@ -155,5 +155,5 @@
     @Override
     protected void realRun() throws SAXException, IOException {
-        File pluginDir = Main.pref.getPluginsDirectory();
+        File pluginDir = Preferences.main().getPluginsDirectory();
         if (!pluginDir.exists() && !pluginDir.mkdirs()) {
             String message = tr("Failed to create plugin directory ''{0}''", pluginDir.toString());
Index: /trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 14149)
@@ -55,4 +55,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.RestartAction;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.PreferencesUtils;
 import org.openstreetmap.josm.data.Version;
@@ -535,5 +536,5 @@
         }
         if (NetworkManager.isOffline(OnlineResource.JOSM_WEBSITE)) {
-            for (String updateSite : Main.pref.getPluginSites()) {
+            for (String updateSite : Preferences.main().getPluginSites()) {
                 try {
                     OnlineResource.JOSM_WEBSITE.checkOfflineAccess(updateSite, Config.getUrls().getJOSMWebsite());
@@ -598,5 +599,5 @@
         // Update plugin list
         final ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask(
-                Main.pref.getOnlinePluginSites());
+                Preferences.main().getOnlinePluginSites());
         MainApplication.worker.submit(pluginInfoDownloadTask);
 
@@ -743,5 +744,5 @@
     private static void extendJoinedPluginResourceCL(Collection<PluginInformation> plugins) {
         // iterate all plugins and collect all libraries of all plugins:
-        File pluginDir = Main.pref.getPluginsDirectory();
+        File pluginDir = Preferences.main().getPluginsDirectory();
         DynamicURLClassLoader cl = getJoinedPluginResourceCL();
 
@@ -1076,5 +1077,5 @@
             ReadRemotePluginInformationTask task1 = new ReadRemotePluginInformationTask(
                     monitor.createSubTaskMonitor(1, false),
-                    Main.pref.getOnlinePluginSites(), displayErrMsg
+                    Preferences.main().getOnlinePluginSites(), displayErrMsg
             );
             task1.run();
@@ -1248,5 +1249,5 @@
      */
     public static void installDownloadedPlugins(Collection<PluginInformation> pluginsToLoad, boolean dowarn) {
-        File pluginDir = Main.pref.getPluginsDirectory();
+        File pluginDir = Preferences.main().getPluginsDirectory();
         if (!pluginDir.exists() || !pluginDir.isDirectory() || !pluginDir.canWrite())
             return;
@@ -1326,5 +1327,5 @@
      */
     public static File findUpdatedJar(String name) {
-        File pluginDir = Main.pref.getPluginsDirectory();
+        File pluginDir = Preferences.main().getPluginsDirectory();
         // Find the downloaded file. We have tried to install the downloaded plugins
         // (PluginHandler.installDownloadedPlugins). This succeeds depending on the platform.
Index: /trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java	(revision 14149)
@@ -31,5 +31,5 @@
 import javax.swing.JScrollPane;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
@@ -245,5 +245,5 @@
      */
     protected void cachePluginList(String site, String list) {
-        File pluginDir = Main.pref.getPluginsDirectory();
+        File pluginDir = Preferences.main().getPluginsDirectory();
         if (!pluginDir.exists() && !pluginDir.mkdirs()) {
             Logging.warn(tr("Failed to create plugin directory ''{0}''. Cannot cache plugin list from plugin site ''{1}''.",
@@ -318,5 +318,5 @@
         }
 
-        File pluginDir = Main.pref.getPluginsDirectory();
+        File pluginDir = Preferences.main().getPluginsDirectory();
         for (String site: sites) {
             String printsite = site.replaceAll("%<(.*)>", "");
Index: /trunk/src/org/openstreetmap/josm/tools/Shortcut.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 14148)
+++ /trunk/src/org/openstreetmap/josm/tools/Shortcut.java	(revision 14149)
@@ -22,5 +22,5 @@
 import javax.swing.text.JTextComponent;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.spi.preferences.Config;
 
@@ -386,5 +386,5 @@
         PlatformManager.getPlatform().initSystemShortcuts();
         // (2) User defined shortcuts
-        Main.pref.getAllPrefixCollectionKeys("shortcut.entry.").stream()
+        Preferences.main().getAllPrefixCollectionKeys("shortcut.entry.").stream()
                 .map(Shortcut::new)
                 .filter(sc -> !findShortcut(sc.getAssignedKey(), sc.getAssignedModifier()).isPresent())
Index: /trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java	(revision 14148)
+++ /trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java	(revision 14149)
@@ -16,4 +16,5 @@
 import org.openstreetmap.josm.actions.DeleteAction;
 import org.openstreetmap.josm.command.DeleteCommand;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.preferences.JosmBaseDirectories;
 import org.openstreetmap.josm.data.preferences.JosmUrls;
@@ -104,9 +105,10 @@
         System.setProperty("josm.home", josmHome);
         TimeZone.setDefault(DateUtils.UTC);
-        Config.setPreferencesInstance(Main.pref);
+        Preferences pref = Preferences.main();
+        Config.setPreferencesInstance(pref);
         Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance());
         Config.setUrlsProvider(JosmUrls.getInstance());
-        Main.pref.resetToInitialState();
-        Main.pref.enableSaveOnPut(false);
+        pref.resetToInitialState();
+        pref.enableSaveOnPut(false);
         I18n.init();
         // initialize the plaform hook, and
@@ -115,5 +117,5 @@
 
         Logging.setLogLevel(Logging.LEVEL_INFO);
-        Main.pref.init(false);
+        pref.init(false);
         String url = Config.getPref().get("osm-server.url");
         if (url == null || url.isEmpty() || isProductionApiUrl(url)) {
Index: /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java	(revision 14148)
+++ /trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java	(revision 14149)
@@ -13,6 +13,6 @@
 import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
 import org.openstreetmap.josm.plugins.PluginDownloadTask;
@@ -62,5 +62,5 @@
             new File(TestUtils.getTestDataRoot()), "__files/" + this.pluginPath
         );
-        final File pluginDir = Main.pref.getPluginsDirectory();
+        final File pluginDir = Preferences.main().getPluginsDirectory();
         final File pluginFile = new File(pluginDir, "dummy_plugin.jar");
         final File pluginFileNew = new File(pluginDir, "dummy_plugin.jar.new");
@@ -104,5 +104,5 @@
             new File(TestUtils.getTestDataRoot()), "__files/" + this.pluginPath
         );
-        final File pluginDir = Main.pref.getPluginsDirectory();
+        final File pluginDir = Preferences.main().getPluginsDirectory();
         final File pluginFile = new File(pluginDir, "corrupted_plugin.jar");
         final File pluginFileNew = new File(pluginDir, "corrupted_plugin.jar.new");
Index: /trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java	(revision 14148)
+++ /trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java	(revision 14149)
@@ -6,5 +6,4 @@
 import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
 
@@ -33,5 +32,5 @@
             "  <tag key='osm-server.url' value='http://fake.xxx/api'/>%n" +
             "</preferences>%n", Version.getInstance().getVersion()),
-                Main.pref.toXML(true));
+                Preferences.main().toXML(true));
     }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/data/preferences/NamedColorPropertyTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/preferences/NamedColorPropertyTest.java	(revision 14148)
+++ /trunk/test/unit/org/openstreetmap/josm/data/preferences/NamedColorPropertyTest.java	(revision 14149)
@@ -11,5 +11,5 @@
 import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
@@ -18,5 +18,5 @@
 
 /**
- * Test {@link ColorProperty}
+ * Test {@link NamedColorProperty}
  * @author Michael Zangl
  */
@@ -39,5 +39,5 @@
 
     /**
-     * Test {@link ColorProperty#get()}
+     * Test {@link NamedColorProperty#get()}
      */
     @Test
@@ -47,5 +47,5 @@
 
     /**
-     * Test {@link ColorProperty#put}
+     * Test {@link NamedColorProperty#put}
      */
     @Test
@@ -67,5 +67,5 @@
     public void testColorAlpha() {
         assertEquals(0x12, new NamedColorProperty("foo", new Color(0x12345678, true)).get().getAlpha());
-        assertTrue(Main.pref.putList("clr.general.bar", Arrays.asList("#34567812", "general", "", "bar")));
+        assertTrue(Preferences.main().putList("clr.general.bar", Arrays.asList("#34567812", "general", "", "bar")));
         assertEquals(0x12, new NamedColorProperty("bar", Color.RED).get().getAlpha());
     }
@@ -80,5 +80,5 @@
 
     /**
-     * Test {@link ColorProperty#getChildColor(String)}
+     * Test {@link NamedColorProperty#getChildColor(String)}
      */
     @Test
Index: /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java	(revision 14148)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java	(revision 14149)
@@ -26,5 +26,4 @@
 import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.Bounds;
@@ -217,5 +216,5 @@
         assertEquals(0xff00ff00, paintedSlippyMap.getRGB(0, 0));
 
-        assertEquals("Green Tiles", Main.pref.get("slippy_map_chooser.mapstyle", "Fail"));
+        assertEquals("Green Tiles", Config.getPref().get("slippy_map_chooser.mapstyle", "Fail"));
     }
 
@@ -244,5 +243,5 @@
         this.assertSingleSelectedSourceLabel("Magenta Tiles");
 
-        assertEquals("Magenta Tiles", Main.pref.get("slippy_map_chooser.mapstyle", "Fail"));
+        assertEquals("Magenta Tiles", Config.getPref().get("slippy_map_chooser.mapstyle", "Fail"));
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java	(revision 14148)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java	(revision 14149)
@@ -6,6 +6,6 @@
 import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
@@ -35,6 +35,6 @@
             "All the preferences of this group are default, nothing to save", JOptionPane.OK_OPTION
         ));
-        new ExportProfileAction(Main.pref, "foo", "bar").actionPerformed(null);
-        new ExportProfileAction(Main.pref, "expert", "expert").actionPerformed(null);
+        new ExportProfileAction(Preferences.main(), "foo", "bar").actionPerformed(null);
+        new ExportProfileAction(Preferences.main(), "expert", "expert").actionPerformed(null);
     }
 }
Index: /trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java	(revision 14148)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceHighLevelTest.java	(revision 14149)
@@ -23,4 +23,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
 import org.openstreetmap.josm.gui.util.GuiHelper;
@@ -97,5 +98,5 @@
         this.referenceBazJarOld = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v6.jar");
         this.referenceBazJarNew = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v7.jar");
-        this.pluginDir = Main.pref.getPluginsDirectory();
+        this.pluginDir = Preferences.main().getPluginsDirectory();
         this.targetDummyJar = new File(this.pluginDir, "dummy_plugin.jar");
         this.targetDummyJarNew = new File(this.pluginDir, "dummy_plugin.jar.new");
Index: /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java	(revision 14148)
+++ /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java	(revision 14149)
@@ -17,4 +17,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
@@ -66,5 +67,5 @@
         this.referenceBazJarOld = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v6.jar");
         this.referenceBazJarNew = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v7.jar");
-        this.pluginDir = Main.pref.getPluginsDirectory();
+        this.pluginDir = Preferences.main().getPluginsDirectory();
         this.targetDummyJar = new File(this.pluginDir, "dummy_plugin.jar");
         this.targetDummyJarNew = new File(this.pluginDir, "dummy_plugin.jar.new");
Index: /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java	(revision 14148)
+++ /trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java	(revision 14149)
@@ -19,5 +19,5 @@
 import org.junit.Rule;
 import org.junit.Test;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.gpx.GpxData;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -93,5 +93,5 @@
         // Download complete list of plugins
         ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask(
-                Main.pref.getOnlinePluginSites());
+                Preferences.main().getOnlinePluginSites());
         pluginInfoDownloadTask.run();
         List<PluginInformation> plugins = pluginInfoDownloadTask.getAvailablePlugins();
Index: /trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java	(revision 14148)
+++ /trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java	(revision 14149)
@@ -26,4 +26,5 @@
 import org.openstreetmap.josm.actions.DeleteAction;
 import org.openstreetmap.josm.command.DeleteCommand;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.UserIdentityManager;
 import org.openstreetmap.josm.data.Version;
@@ -418,5 +419,6 @@
         }
 
-        Config.setPreferencesInstance(Main.pref);
+        Preferences pref = Preferences.main();
+        Config.setPreferencesInstance(pref);
         Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance());
         Config.setUrlsProvider(JosmUrls.getInstance());
@@ -449,8 +451,8 @@
         if (usePreferences) {
             @SuppressWarnings("unchecked")
-            final Map<String, Setting<?>> defaultsMap = (Map<String, Setting<?>>) TestUtils.getPrivateField(Main.pref, "defaultsMap");
+            final Map<String, Setting<?>> defaultsMap = (Map<String, Setting<?>>) TestUtils.getPrivateField(pref, "defaultsMap");
             defaultsMap.clear();
-            Main.pref.resetToInitialState();
-            Main.pref.enableSaveOnPut(false);
+            pref.resetToInitialState();
+            pref.enableSaveOnPut(false);
             // No pref init -> that would only create the preferences file.
             // We force the use of a wrong API server, just in case anyone attempts an upload
@@ -543,5 +545,5 @@
         MemoryManagerTest.resetState(true);
         cleanLayerEnvironment();
-        Main.pref.resetToInitialState();
+        Preferences.main().resetToInitialState();
         System.gc();
     }
@@ -584,5 +586,5 @@
         // TODO: Remove global listeners and other global state.
         ProjectionRegistry.clearProjectionChangeListeners();
-        Main.pref.resetToInitialState();
+        Preferences.main().resetToInitialState();
 
         if (this.assumeRevisionString != null && this.originalVersion != null) {
