Index: applications/editors/josm/plugins/trustosm/build.xml
===================================================================
--- applications/editors/josm/plugins/trustosm/build.xml	(revision 34564)
+++ applications/editors/josm/plugins/trustosm/build.xml	(revision 34565)
@@ -5,5 +5,5 @@
     <property name="commit.message" value="New plugin for digital signing osm data"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="12840" />
+    <property name="plugin.main.version" value="14153" />
     <property name="plugin.author" value="Christoph Wagner" />
     <property name="plugin.class" value="org.openstreetmap.josm.plugins.trustosm.TrustOSMplugin" />
Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/TrustOSMplugin.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/TrustOSMplugin.java	(revision 34564)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/TrustOSMplugin.java	(revision 34565)
@@ -27,6 +27,6 @@
 import javax.swing.JMenuItem;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.ExtensionFileFilter;
+import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MainMenu;
@@ -42,4 +42,5 @@
 import org.openstreetmap.josm.plugins.trustosm.io.SigImporter;
 import org.openstreetmap.josm.plugins.trustosm.util.TrustGPG;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.Logging;
 
@@ -65,7 +66,7 @@
         super(info);
         // check if the jarlibs are already extracted or not and extract them if not
-        /*if (!Main.pref.getBoolean("trustosm.jarLibsExtracted")) {
-            Main.pref.put("trustosm.jarLibsExtracted", extractFiles("trustosm","lib"));
-            Main.pref.put("trustosm.jarLibsExtracted", extractFiles("trustosm","resources"));
+        /*if (!Config.getPref().getBoolean("trustosm.jarLibsExtracted")) {
+            Config.getPref().put("trustosm.jarLibsExtracted", extractFiles("trustosm","lib"));
+            Config.getPref().put("trustosm.jarLibsExtracted", extractFiles("trustosm","resources"));
         }*/
         extractFiles("trustosm", "lib");
@@ -161,6 +162,6 @@
         String cmd = "sh -c sudo -S mv "+sysSecPath+"/local_policy.jar "+sysSecPath+"/local_policy.jar.restricted";
         /*        String cmd2 = "sudo -S mv "+sysSecPath+"/US_export_policy.jar "+sysSecPath+"/US_export_policy.jar.restricted";
-        String cmd3 = "sudo -S cp "+Main.pref.getPluginsDirectory().getPath()+"/trustosm/jce/US_export_policy.jar "+sysSecPath;
-        String cmd4 = "sudo -S cp "+Main.pref.getPluginsDirectory().getPath()+"/trustosm/jce/local_policy.jar "+sysSecPath;
+        String cmd3 = "sudo -S cp "+Config.getPref().getPluginsDirectory().getPath()+"/trustosm/jce/US_export_policy.jar "+sysSecPath;
+        String cmd4 = "sudo -S cp "+Config.getPref().getPluginsDirectory().getPath()+"/trustosm/jce/local_policy.jar "+sysSecPath;
 
 
@@ -226,5 +227,5 @@
     public static boolean extractFiles(String pluginname, String extractDir) {
         if (extractDir == null) extractDir = "lib";
-        String path = Main.pref.getPluginsDirectory().getPath();
+        String path = Preferences.main().getPluginsDirectory().getPath();
         try (JarFile jar = new JarFile(path+"/"+pluginname+".jar")) {
             Enumeration<JarEntry> entries = jar.entries();
@@ -265,10 +266,10 @@
 
     public static void setSettings() {
-        Map<String, String> prefs = Main.pref.getAllPrefix("trustosm.");
+        Map<String, String> prefs = Preferences.main().getAllPrefix("trustosm.");
 
         // if setting isn't present, we set a default
         // This makes sense for example when we start the plugin for the first time
-        if (!prefs.containsKey("trustosm.gpg")) Main.pref.put("trustosm.gpg", "gpg");
-        if (!prefs.containsKey("trustosm.gpg.separateHomedir")) Main.pref.putBoolean("trustosm.gpg.separateHomedir", true);
+        if (!prefs.containsKey("trustosm.gpg")) Config.getPref().put("trustosm.gpg", "gpg");
+        if (!prefs.containsKey("trustosm.gpg.separateHomedir")) Config.getPref().putBoolean("trustosm.gpg.separateHomedir", true);
     }
 
@@ -287,5 +288,5 @@
 
     public static String getGpgPath() {
-        return Main.pref.getPluginsDirectory().getPath() + "/trustosm/gnupg/";
+        return Preferences.main().getPluginsDirectory().getPath() + "/trustosm/gnupg/";
     }
 }
Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/actions/GetMissingDataAction.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/actions/GetMissingDataAction.java	(revision 34564)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/actions/GetMissingDataAction.java	(revision 34565)
@@ -12,5 +12,4 @@
 import javax.swing.JOptionPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -43,7 +42,7 @@
         int itemCount = trustitems.size();
         if (missingCount == 0) {
-            JOptionPane.showMessageDialog(Main.parent, tr("{0} Signatures loaded. All referenced OSM objects found.", itemCount));
+            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("{0} Signatures loaded. All referenced OSM objects found.", itemCount));
         } else {
-            int n = JOptionPane.showOptionDialog(Main.parent,
+            int n = JOptionPane.showOptionDialog(MainApplication.getMainFrame(),
                     tr("{0} of {1} OSM objects are referenced but not there.\nDo you want to load them from OSM-Server?",
                             missingCount, itemCount),
Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/gui/dialogs/TrustDialog.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/gui/dialogs/TrustDialog.java	(revision 34564)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/gui/dialogs/TrustDialog.java	(revision 34565)
@@ -493,5 +493,5 @@
             content.setMaximumSize(new Dimension(600, 500));
             content.add(scroller);
-            JOptionPane.showMessageDialog(Main.parent,content, tr("Clearsigned Signature"), JOptionPane.PLAIN_MESSAGE);
+            JOptionPane.showMessageDialog(MainApplication.getMainFrame(),content, tr("Clearsigned Signature"), JOptionPane.PLAIN_MESSAGE);
         }
     }
Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/gui/dialogs/TrustPreferenceEditor.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/gui/dialogs/TrustPreferenceEditor.java	(revision 34564)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/gui/dialogs/TrustPreferenceEditor.java	(revision 34565)
@@ -16,8 +16,8 @@
 import javax.swing.JTabbedPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
 import org.openstreetmap.josm.plugins.trustosm.TrustOSMplugin;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.GBC;
 
@@ -50,5 +50,5 @@
         gpgdirGroup.add(defaultHomedir);
 
-        if (Main.pref.getBoolean("trustosm.gpg.separateHomedir")) {
+        if (Config.getPref().getBoolean("trustosm.gpg.separateHomedir")) {
             separateHomedir.setSelected(true);
         } else
@@ -70,6 +70,6 @@
     @Override
     public boolean ok() {
-        Main.pref.putBoolean("trustosm.gpg.showSignedDeleted", showSignedDeleted.isSelected());
-        Main.pref.putBoolean("trustosm.gpg.separateHomedir", separateHomedir.isSelected());
+        Config.getPref().putBoolean("trustosm.gpg.showSignedDeleted", showSignedDeleted.isSelected());
+        Config.getPref().putBoolean("trustosm.gpg.separateHomedir", separateHomedir.isSelected());
         return false;
     }
Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/gui/dialogs/TrustSignaturesDialog.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/gui/dialogs/TrustSignaturesDialog.java	(revision 34564)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/gui/dialogs/TrustSignaturesDialog.java	(revision 34565)
@@ -21,8 +21,8 @@
 import org.bouncycastle.openpgp.PGPSignature;
 import org.jdesktop.swingx.JXTreeTable;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.gui.ExtendedDialog;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.plugins.trustosm.TrustOSMplugin;
 import org.openstreetmap.josm.plugins.trustosm.data.TrustNode;
@@ -99,5 +99,5 @@
         scroller.setPreferredSize(new Dimension(700, 500));
         String[] buttons = {tr("Ok")};
-        ExtendedDialog info = new ExtendedDialog(Main.parent, tr("Signature Info"), buttons, false);
+        ExtendedDialog info = new ExtendedDialog(MainApplication.getMainFrame(), tr("Signature Info"), buttons, false);
         info.setContent(scroller, false);
         info.showDialog();
@@ -164,5 +164,5 @@
 
         p.add(createKeyButton(uid,pub.getKeyID()));
-        JOptionPane.showMessageDialog(Main.parent,p, tr("Key Signatures"), JOptionPane.PLAIN_MESSAGE);
+        JOptionPane.showMessageDialog(MainApplication.getMainFrame(),p, tr("Key Signatures"), JOptionPane.PLAIN_MESSAGE);
     }
 
Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/io/SigExporter.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/io/SigExporter.java	(revision 34564)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/io/SigExporter.java	(revision 34565)
@@ -10,6 +10,6 @@
 import javax.swing.JOptionPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.ExtensionFileFilter;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.io.importexport.FileExporter;
 import org.openstreetmap.josm.gui.layer.Layer;
@@ -42,5 +42,5 @@
         } catch (IOException x) {
             x.printStackTrace();
-            JOptionPane.showMessageDialog(Main.parent, tr("Error while exporting {0}:\n{1}", fn, x.getMessage()),
+            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Error while exporting {0}:\n{1}", fn, x.getMessage()),
                     tr("Error"), JOptionPane.ERROR_MESSAGE);
         }
Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/io/SigImporter.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/io/SigImporter.java	(revision 34564)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/io/SigImporter.java	(revision 34565)
@@ -56,12 +56,12 @@
         int itemCount = trustitems.size();
         if (missingCount == 0) {
-            JOptionPane.showMessageDialog(Main.parent, tr("{0} Signatures loaded. All referenced OSM objects found.",itemCount));
+            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("{0} Signatures loaded. All referenced OSM objects found.",itemCount));
         } else {
-            int n = JOptionPane.showOptionDialog(Main.parent,
+            int n = JOptionPane.showOptionDialog(MainApplication.getMainFrame(),
             tr("{0} of {1} OSM objects are referenced but not there.\nDo you want to load them from OSM-Server?",missingCount,itemCount),
             tr("Load objects from server"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
 
             if (n == JOptionPane.YES_OPTION) {
-                Main.worker.submit(new DownloadSignedOsmDataTask(missingData, Main.main.getEditLayer()));
+                Main.worker.submit(new DownloadSignedOsmDataTask(missingData, OsmDataManager.getInstance().getEditLayer()));
             }
         }
Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/TrustAnalyzer.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/TrustAnalyzer.java	(revision 34564)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/TrustAnalyzer.java	(revision 34565)
@@ -12,7 +12,7 @@
 
 import org.bouncycastle.openpgp.PGPSignature;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.plugins.trustosm.TrustOSMplugin;
 import org.openstreetmap.josm.plugins.trustosm.data.TrustNode;
@@ -28,5 +28,5 @@
 
     public static void showManipulationWarning() {
-        JOptionPane.showMessageDialog(Main.parent, tr("The Signature is broken!"), tr("Manipulation Warning"), JOptionPane.WARNING_MESSAGE);
+        JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("The Signature is broken!"), tr("Manipulation Warning"), JOptionPane.WARNING_MESSAGE);
     }
 
Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/TrustGPG.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/TrustGPG.java	(revision 34564)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/TrustGPG.java	(revision 34565)
@@ -85,8 +85,9 @@
 import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder;
 import org.bouncycastle.util.encoders.Hex;
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
 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.plugins.trustosm.data.TrustNode;
 import org.openstreetmap.josm.plugins.trustosm.data.TrustOsmPrimitive;
@@ -158,5 +159,5 @@
                 Logging.error(e);
                 Logging.error("GPG Key Ring File could not be created in: "+
-                        Main.pref.getPluginsDirectory().getPath() + "/trustosm/gnupg/secring.gpg");
+                        Preferences.main().getPluginsDirectory().getPath() + "/trustosm/gnupg/secring.gpg");
             }
         }
@@ -249,5 +250,5 @@
         p.add(Box.createRigidArea(d));
 
-        int n = JOptionPane.showOptionDialog(Main.parent, p, tr("Select a Key to sign"),
+        int n = JOptionPane.showOptionDialog(MainApplication.getMainFrame(), p, tr("Select a Key to sign"),
                 JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, ImageProvider.get("keyring"), null, null);
 
@@ -269,6 +270,6 @@
         FileInputStream secIn;
         try {
-            pubIn = new FileInputStream(Main.pref.getPluginsDirectory().getPath() + "/trustosm/gnupg/secring.gpg");
-            secIn = new FileInputStream(Main.pref.getPluginsDirectory().getPath() + "/trustosm/gnupg/pubring.gpg");
+            pubIn = new FileInputStream(Preferences.main().getPluginsDirectory().getPath() + "/trustosm/gnupg/secring.gpg");
+            secIn = new FileInputStream(Preferences.main().getPluginsDirectory().getPath() + "/trustosm/gnupg/pubring.gpg");
             //pubIn = new FileInputStream("/tmp/secring.gpg");
             //secIn = new FileInputStream("/tmp/pubring.gpg");
@@ -276,5 +277,5 @@
             pgpPub = new BcPGPPublicKeyRingCollection(PGPUtil.getDecoderStream(secIn));
         } catch (FileNotFoundException e) {
-            System.err.println("No gpg files found in "+Main.pref.getPluginsDirectory().getPath() + "/trustosm/gnupg/secring.gpg");
+            System.err.println("No gpg files found in "+Preferences.main().getPluginsDirectory().getPath() + "/trustosm/gnupg/secring.gpg");
             pgpSec = null;
             pgpPub = null;
@@ -284,5 +285,5 @@
 
     public void writeGpgFiles() throws FileNotFoundException, IOException {
-        String path = Main.pref.getPluginsDirectory().getPath();
+        String path = Preferences.main().getPluginsDirectory().getPath();
         try (FileOutputStream pubOut = new FileOutputStream(path + "/trustosm/gnupg/pubring.gpg");
                 FileOutputStream secOut = new FileOutputStream(path + "/trustosm/gnupg/secring.gpg")) {
@@ -313,5 +314,5 @@
 
         /*final JPasswordField passwordField = new JPasswordField(10);
-        JOptionPane.showMessageDialog(Main.parent, passwordField, "Enter password", JOptionPane.OK_OPTION, ImageProvider.get("lock"));
+        JOptionPane.showMessageDialog(MainApplication.getMainFrame(), passwordField, "Enter password", JOptionPane.OK_OPTION, ImageProvider.get("lock"));
         password = passwordField.getPassword();
          */
@@ -348,5 +349,5 @@
     public void invalidIDWarning(OsmPrimitive osm) {
         // CHECKSTYLE.OFF: LineLength
-        JOptionPane.showMessageDialog(Main.parent,
+        JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
                 tr("The object with the ID \"{0}\" ({1}) is newly created.\nYou can not sign it, because the signature would lose the ID-Reference after uploading it to the OSM-server.",
                         osm.getUniqueId(), osm.toString()),
@@ -476,5 +477,5 @@
         p.add(new JLabel(tr("meters")), GBC.eol());
 
-        int n = JOptionPane.showOptionDialog(Main.parent, p, tr("Accuracy"),
+        int n = JOptionPane.showOptionDialog(MainApplication.getMainFrame(), p, tr("Accuracy"),
                 JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
 
@@ -503,5 +504,5 @@
         p.add(trusted, GBC.eol());
 
-        int n = JOptionPane.showOptionDialog(Main.parent, p, tr("Which source did you use?"),
+        int n = JOptionPane.showOptionDialog(MainApplication.getMainFrame(), p, tr("Which source did you use?"),
                 JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
 
@@ -699,5 +700,5 @@
         //        metaPanel.add(sp);
 
-        JOptionPane.showMessageDialog(Main.parent, p, tr("PGP-Key details"), JOptionPane.INFORMATION_MESSAGE);
+        JOptionPane.showMessageDialog(MainApplication.getMainFrame(), p, tr("PGP-Key details"), JOptionPane.INFORMATION_MESSAGE);
     }
 
@@ -706,5 +707,5 @@
 
         JTextField userId = new JTextField();
-        NameGenerator nameGen = new NameGenerator(Main.pref.getPluginsDirectory().getPath()+"/trustosm/resources/syllables.txt");
+        NameGenerator nameGen = new NameGenerator(Preferences.main().getPluginsDirectory().getPath()+"/trustosm/resources/syllables.txt");
         userId.setText(nameGen.compose(3));
 
@@ -793,5 +794,5 @@
                 16, 6);      //xPad, yPad
 
-        int n = JOptionPane.showOptionDialog(Main.parent, p, tr("Create a new signing key"),
+        int n = JOptionPane.showOptionDialog(MainApplication.getMainFrame(), p, tr("Create a new signing key"),
                 JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
 
