Index: applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaAction.java
===================================================================
--- applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaAction.java	(revision 33918)
+++ applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaAction.java	(revision 34556)
@@ -21,5 +21,4 @@
 import javax.swing.JOptionPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.command.ChangeCommand;
@@ -29,4 +28,5 @@
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.Bounds;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.Node;
@@ -35,6 +35,7 @@
 import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.HelpAwareOptionPane;
+import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
 import org.openstreetmap.josm.gui.MainApplication;
-import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -65,5 +66,5 @@
                 new ButtonSpec(tr("No, abort"), ImageProvider.get("cancel"), tr("Cancel operation"), null) };
         return 0 == HelpAwareOptionPane.showOptionDialog(
-                Main.parent,
+                MainApplication.getMainFrame(),
                 "<html>" + trn("The selected way has nodes outside of the downloaded data region.", "The selected ways have nodes outside of the downloaded data region.", 
                         MainApplication.getLayerManager().getEditDataSet().getSelectedWays().size())
@@ -74,5 +75,5 @@
 
     private void alertSelectAtLeastOneWay() {
-        HelpAwareOptionPane.showOptionDialog(Main.parent, tr("Please select at least one way to simplify."), tr("Warning"), JOptionPane.WARNING_MESSAGE, null);
+        HelpAwareOptionPane.showOptionDialog(MainApplication.getMainFrame(), tr("Please select at least one way to simplify."), tr("Warning"), JOptionPane.WARNING_MESSAGE, null);
     }
 
@@ -80,5 +81,5 @@
         final ButtonSpec[] options = new ButtonSpec[] { new ButtonSpec(tr("Yes"), ImageProvider.get("ok"), tr("Simplify all selected ways"), null),
                 new ButtonSpec(tr("Cancel"), ImageProvider.get("cancel"), tr("Cancel operation"), null) };
-        return 0 == HelpAwareOptionPane.showOptionDialog(Main.parent, tr("The selection contains {0} ways. Are you sure you want to simplify them all?", numWays), 
+        return 0 == HelpAwareOptionPane.showOptionDialog(MainApplication.getMainFrame(), tr("The selection contains {0} ways. Are you sure you want to simplify them all?", numWays), 
                 tr("Simplify ways?"),
                 JOptionPane.WARNING_MESSAGE, null, // no special icon
@@ -174,5 +175,5 @@
         if (!allCommands.isEmpty()) {
             final SequenceCommand rootCommand = new SequenceCommand(trn("Simplify {0} way", "Simplify {0} ways", allCommands.size(), allCommands.size()), allCommands);
-            Main.main.undoRedo.add(rootCommand);
+            UndoRedoHandler.getInstance().add(rootCommand);
             MainApplication.getMap().repaint();
         }
@@ -198,5 +199,5 @@
     // average nearby nodes
     private static Collection<Command> averageNearbyNodes(final Collection<Way> ways, final Collection<Node> nodesAlreadyDeleted) {
-        final double mergeThreshold = Main.pref.getDouble(SimplifyAreaPreferenceSetting.MERGE_THRESHOLD, 0.2);
+        final double mergeThreshold = Config.getPref().getDouble(SimplifyAreaPreferenceSetting.MERGE_THRESHOLD, 0.2);
 
         final Map<Node, LatLon> coordMap = new HashMap<>();
@@ -321,10 +322,10 @@
 
     private static void addNodesToDelete(final Collection<Node> nodesToDelete, final Way w) {
-        final double angleThreshold = Main.pref.getDouble(SimplifyAreaPreferenceSetting.ANGLE_THRESHOLD, 10);
-        final double angleFactor = Main.pref.getDouble(SimplifyAreaPreferenceSetting.ANGLE_FACTOR, 1.0);
-        final double areaThreshold = Main.pref.getDouble(SimplifyAreaPreferenceSetting.AREA_THRESHOLD, 5.0);
-        final double areaFactor = Main.pref.getDouble(SimplifyAreaPreferenceSetting.AREA_FACTOR, 1.0);
-        final double distanceThreshold = Main.pref.getDouble(SimplifyAreaPreferenceSetting.DIST_THRESHOLD, 3);
-        final double distanceFactor = Main.pref.getDouble(SimplifyAreaPreferenceSetting.DIST_FACTOR, 3);
+        final double angleThreshold = Config.getPref().getDouble(SimplifyAreaPreferenceSetting.ANGLE_THRESHOLD, 10);
+        final double angleFactor = Config.getPref().getDouble(SimplifyAreaPreferenceSetting.ANGLE_FACTOR, 1.0);
+        final double areaThreshold = Config.getPref().getDouble(SimplifyAreaPreferenceSetting.AREA_THRESHOLD, 5.0);
+        final double areaFactor = Config.getPref().getDouble(SimplifyAreaPreferenceSetting.AREA_FACTOR, 1.0);
+        final double distanceThreshold = Config.getPref().getDouble(SimplifyAreaPreferenceSetting.DIST_THRESHOLD, 3);
+        final double distanceFactor = Config.getPref().getDouble(SimplifyAreaPreferenceSetting.DIST_FACTOR, 3);
 
         final List<Node> nodes = w.getNodes();
Index: applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaPreferenceSetting.java
===================================================================
--- applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaPreferenceSetting.java	(revision 33918)
+++ applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaPreferenceSetting.java	(revision 34556)
@@ -9,8 +9,8 @@
 import javax.swing.JTextField;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting;
 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
 import org.openstreetmap.josm.gui.widgets.JosmTextField;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.GBC;
 
@@ -49,29 +49,29 @@
         final JPanel tab = gui.createPreferenceTab(this);
 
-        angleThreshold.setText(Main.pref.get(ANGLE_THRESHOLD, "10"));
+        angleThreshold.setText(Config.getPref().get(ANGLE_THRESHOLD, "10"));
         tab.add(new JLabel(tr("Angle Threshold")), GBC.std());
         tab.add(angleThreshold, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
 
-        angleFactor.setText(Main.pref.get(ANGLE_FACTOR, "1.0"));
+        angleFactor.setText(Config.getPref().get(ANGLE_FACTOR, "1.0"));
         tab.add(new JLabel(tr("Angle Factor")), GBC.std());
         tab.add(angleFactor, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
 
-        areaThreshold.setText(Main.pref.get(AREA_THRESHOLD, "5.0"));
+        areaThreshold.setText(Config.getPref().get(AREA_THRESHOLD, "5.0"));
         tab.add(new JLabel(tr("Area Threshold")), GBC.std());
         tab.add(areaThreshold, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
 
-        areaFactor.setText(Main.pref.get(AREA_FACTOR, "1.0"));
+        areaFactor.setText(Config.getPref().get(AREA_FACTOR, "1.0"));
         tab.add(new JLabel(tr("Area Factor")), GBC.std());
         tab.add(areaFactor, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
 
-        distanceThreshold.setText(Main.pref.get(DIST_THRESHOLD, "3"));
+        distanceThreshold.setText(Config.getPref().get(DIST_THRESHOLD, "3"));
         tab.add(new JLabel(tr("Distance Threshold")), GBC.std());
         tab.add(distanceThreshold, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
 
-        distanceFactor.setText(Main.pref.get(DIST_FACTOR, "3"));
+        distanceFactor.setText(Config.getPref().get(DIST_FACTOR, "3"));
         tab.add(new JLabel(tr("Distance Factor")), GBC.std());
         tab.add(distanceFactor, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
 
-        mergeThreshold.setText(Main.pref.get(MERGE_THRESHOLD, "0.2"));
+        mergeThreshold.setText(Config.getPref().get(MERGE_THRESHOLD, "0.2"));
         tab.add(new JLabel(tr("Merge Nearby Nodes Threshold")), GBC.std());
         tab.add(mergeThreshold, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
@@ -82,11 +82,11 @@
     @Override
     public boolean ok() {
-        Main.pref.put(MERGE_THRESHOLD, mergeThreshold.getText());
-        Main.pref.put(ANGLE_THRESHOLD, angleThreshold.getText());
-        Main.pref.put(ANGLE_FACTOR, angleFactor.getText());
-        Main.pref.put(AREA_THRESHOLD, areaThreshold.getText());
-        Main.pref.put(AREA_FACTOR, areaFactor.getText());
-        Main.pref.put(DIST_THRESHOLD, distanceThreshold.getText());
-        Main.pref.put(DIST_FACTOR, distanceFactor.getText());
+        Config.getPref().put(MERGE_THRESHOLD, mergeThreshold.getText());
+        Config.getPref().put(ANGLE_THRESHOLD, angleThreshold.getText());
+        Config.getPref().put(ANGLE_FACTOR, angleFactor.getText());
+        Config.getPref().put(AREA_THRESHOLD, areaThreshold.getText());
+        Config.getPref().put(AREA_FACTOR, areaFactor.getText());
+        Config.getPref().put(DIST_THRESHOLD, distanceThreshold.getText());
+        Config.getPref().put(DIST_FACTOR, distanceFactor.getText());
         return false;
     }
