Index: applications/editors/josm/plugins/turnrestrictions/.classpath
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/.classpath	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/.classpath	(revision 34567)
@@ -2,5 +2,9 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="test/unit"/>
+	<classpathentry kind="src" output="buildtest" path="test/unit">
+		<attributes>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
Index: applications/editors/josm/plugins/turnrestrictions/build.xml
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/build.xml	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/build.xml	(revision 34567)
@@ -4,5 +4,5 @@
     <property name="commit.message" value="Adapt to JOSM core change (DefaultNameFormatter)"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="13564"/>
+    <property name="plugin.main.version" value="14153"/>
 
     <!-- Configure these properties (replace "..." accordingly).
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanel.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanel.java	(revision 34567)
@@ -15,10 +15,10 @@
 import javax.swing.JScrollPane;
 
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.gui.help.HelpUtil;
 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel;
 import org.openstreetmap.josm.plugins.turnrestrictions.editor.NavigationControler.BasicEditorFokusTargets;
 import org.openstreetmap.josm.plugins.turnrestrictions.preferences.PreferenceKeys;
+import org.openstreetmap.josm.spi.preferences.Config;
+import org.openstreetmap.josm.spi.preferences.IPreferences;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 
@@ -100,5 +100,5 @@
         };
         add(spVias, gc);
-        if (!Main.pref.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false)) {
+        if (!Config.getPref().getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false)) {
             lblVias.setVisible(false);
             spVias.setVisible(false);
@@ -171,5 +171,5 @@
      * @param prefs the JOSM preferences
      */
-    public void initIconSetFromPreferences(Preferences prefs) {
+    public void initIconSetFromPreferences(IPreferences prefs) {
         cbTurnRestrictions.initIconSetFromPreferences(prefs);
     }
@@ -181,5 +181,5 @@
      * @param prefs the JOSM preferences
      */
-    public void initViasVisibilityFromPreferences(Preferences prefs) {
+    public void initViasVisibilityFromPreferences(IPreferences prefs) {
         boolean value = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false);
         if (value != lblVias.isVisible()) {
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModel.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModel.java	(revision 34567)
@@ -12,5 +12,5 @@
 import javax.swing.ListSelectionModel;
 
-import org.openstreetmap.josm.data.SelectionChangedListener;
+import org.openstreetmap.josm.data.osm.DataSelectionListener;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.PrimitiveId;
@@ -37,5 +37,5 @@
  */
 public class JosmSelectionListModel extends AbstractListModel<OsmPrimitive>
-    implements ActiveLayerChangeListener, SelectionChangedListener, DataSetListener, PrimitiveIdListProvider {
+    implements ActiveLayerChangeListener, DataSelectionListener, DataSetListener, PrimitiveIdListProvider {
 
     private final List<OsmPrimitive> selection = new ArrayList<>();
@@ -172,5 +172,5 @@
     /* ------------------------------------------------------------------------ */
     @Override
-    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
+    public void selectionChanged(SelectionChangeEvent event) {
         // only update the JOSM selection if it is changed in the same data layer
         // this turn restriction editor is working on
@@ -178,5 +178,5 @@
         if (layer == null) return;
         if (layer != this.layer) return;
-        setJOSMSelection(newSelection);
+        setJOSMSelection(event.getSelection());
     }
 
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionPanel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionPanel.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionPanel.java	(revision 34567)
@@ -88,5 +88,5 @@
         MainApplication.getLayerManager().addActiveLayerChangeListener(model);
         DatasetEventManager.getInstance().addDatasetListener(model, FireMode.IN_EDT);
-        SelectionEventManager.getInstance().addSelectionListener(model, FireMode.IN_EDT_CONSOLIDATED);
+        SelectionEventManager.getInstance().addSelectionListenerForEdt(model);
     }
 
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTable.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTable.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTable.java	(revision 34567)
@@ -36,4 +36,5 @@
 import org.openstreetmap.josm.plugins.turnrestrictions.dnd.PrimitiveIdTransferable;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.Shortcut;
 
@@ -151,11 +152,9 @@
                     model.getRelationMemberEditorModel().insertMembers(ids);
                 } catch (IllegalArgumentException e) {
-                    e.printStackTrace();
+                    Logging.error(e);
                     // FIXME: provide user feedback
                 }
-            } catch (IOException e) {
-                e.printStackTrace();
-            } catch (UnsupportedFlavorException e) {
-                e.printStackTrace();
+            } catch (IOException | UnsupportedFlavorException e) {
+                Logging.error(e);
             }
         }
@@ -271,8 +270,6 @@
                 }
                 return true;
-            } catch (IOException e) {
-                e.printStackTrace();
-            } catch (UnsupportedFlavorException e) {
-                e.printStackTrace();
+            } catch (IOException | UnsupportedFlavorException e) {
+                Logging.error(e);
             }
             return false;
@@ -348,11 +345,9 @@
                     model.getRelationMemberEditorModel().insertMembers(ids);
                 } catch (IllegalArgumentException e) {
-                    e.printStackTrace();
+                    Logging.error(e);
                     // FIXME: provide user feedback
                 }
-            } catch (IOException e) {
-                e.printStackTrace();
-            } catch (UnsupportedFlavorException e) {
-                e.printStackTrace();
+            } catch (IOException | UnsupportedFlavorException e) {
+                Logging.error(e);
             } finally {
                 setColumnSelectionAllowed(true);
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBox.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBox.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBox.java	(revision 34567)
@@ -4,6 +4,6 @@
 import javax.swing.JComboBox;
 
-import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.plugins.turnrestrictions.preferences.PreferenceKeys;
+import org.openstreetmap.josm.spi.preferences.IPreferences;
 /**
  * A combo box for selecting a turn restriction type.
@@ -37,5 +37,5 @@
      * @param prefs the JOSM preferences
      */
-    public void initIconSetFromPreferences(Preferences prefs) {
+    public void initIconSetFromPreferences(IPreferences prefs) {
         TurnRestrictionTypeRenderer renderer = (TurnRestrictionTypeRenderer) getRenderer();
         renderer.initIconSetFromPreferences(prefs);
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java	(revision 34567)
@@ -35,9 +35,9 @@
 import javax.swing.KeyStroke;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.AutoScaleAction;
 import org.openstreetmap.josm.command.AddCommand;
 import org.openstreetmap.josm.command.ChangeCommand;
 import org.openstreetmap.josm.command.conflict.ConflictAddCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
@@ -53,4 +53,5 @@
 import org.openstreetmap.josm.plugins.turnrestrictions.preferences.PreferenceKeys;
 import org.openstreetmap.josm.plugins.turnrestrictions.qa.IssuesView;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
@@ -335,10 +336,10 @@
             pnlJosmSelection.wireListeners();
             editorModel.registerAsEventListener();
-            Main.pref.addPreferenceChangeListener(this.preferenceChangeHandler = new PreferenceChangeHandler());
-            pnlBasicEditor.initIconSetFromPreferences(Main.pref);
+            Config.getPref().addPreferenceChangeListener(this.preferenceChangeHandler = new PreferenceChangeHandler());
+            pnlBasicEditor.initIconSetFromPreferences(Config.getPref());
         } else if (!visible && isVisible()) {
             pnlJosmSelection.unwireListeners();
             editorModel.unregisterAsEventListener();
-            Main.pref.removePreferenceChangeListener(preferenceChangeHandler);
+            Config.getPref().removePreferenceChangeListener(preferenceChangeHandler);
         }
         super.setVisible(visible);
@@ -546,5 +547,5 @@
             }
 
-            MainApplication.undoRedo.add(new AddCommand(getLayer().getDataSet(), newTurnRestriction));
+            UndoRedoHandler.getInstance().add(new AddCommand(getLayer().getDataSet(), newTurnRestriction));
 
             // make sure everybody is notified about the changes
@@ -568,5 +569,5 @@
             editorModel.apply(toUpdate);
             Conflict<Relation> conflict = new Conflict<>(getTurnRestriction(), toUpdate);
-            MainApplication.undoRedo.add(new ConflictAddCommand(getLayer().getDataSet(), conflict));
+            UndoRedoHandler.getInstance().add(new ConflictAddCommand(getLayer().getDataSet(), conflict));
         }
 
@@ -578,9 +579,9 @@
             if (getTurnRestriction().getDataSet() == null) {
                 editorModel.apply(getTurnRestriction());
-                MainApplication.undoRedo.add(new AddCommand(getLayer().getDataSet(), getTurnRestriction()));
+                UndoRedoHandler.getInstance().add(new AddCommand(getLayer().getDataSet(), getTurnRestriction()));
             } else {
                 Relation toUpdate = new Relation(getTurnRestriction());
                 editorModel.apply(toUpdate);
-                MainApplication.undoRedo.add(new ChangeCommand(getTurnRestriction(), toUpdate));
+                UndoRedoHandler.getInstance().add(new ChangeCommand(getTurnRestriction(), toUpdate));
             }
             // this will refresh the snapshot and update the dialog title
@@ -606,5 +607,5 @@
 
             int ret = HelpAwareOptionPane.showOptionDialog(
-                    Main.parent,
+                    MainApplication.getMainFrame(),
                     tr("<html>This turn restriction has been changed outside of the editor.<br>"
                             + "You cannot apply your changes and continue editing.<br>"
@@ -623,5 +624,5 @@
         protected void warnDoubleConflict() {
             JOptionPane.showMessageDialog(
-                    Main.parent,
+                    MainApplication.getMainFrame(),
                     tr("<html>Layer ''{0}'' already has a conflict for object<br>"
                             + "''{1}''.<br>"
@@ -886,5 +887,5 @@
     class PreferenceChangeHandler implements PreferenceChangedListener {
         public void refreshIconSet() {
-            pnlBasicEditor.initIconSetFromPreferences(Main.pref);
+            pnlBasicEditor.initIconSetFromPreferences(Config.getPref());
         }
 
@@ -894,5 +895,5 @@
                 refreshIconSet();
             } else if (evt.getKey().equals(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR)) {
-                pnlBasicEditor.initViasVisibilityFromPreferences(Main.pref);
+                pnlBasicEditor.initViasVisibilityFromPreferences(Config.getPref());
             }
         }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRenderer.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRenderer.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRenderer.java	(revision 34567)
@@ -15,6 +15,6 @@
 import javax.swing.UIManager;
 
-import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.plugins.turnrestrictions.preferences.PreferenceKeys;
+import org.openstreetmap.josm.spi.preferences.IPreferences;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -61,5 +61,5 @@
      * @param prefs the JOSM preferences
      */
-    public void initIconSetFromPreferences(Preferences prefs) {
+    public void initIconSetFromPreferences(IPreferences prefs) {
         iconSet = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");
         iconSet = iconSet.trim().toLowerCase();
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaList.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaList.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaList.java	(revision 34567)
@@ -38,4 +38,5 @@
 import org.openstreetmap.josm.plugins.turnrestrictions.dnd.PrimitiveIdTransferable;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.Logging;
 import org.openstreetmap.josm.tools.Shortcut;
 
@@ -131,8 +132,6 @@
                     List<PrimitiveId> idsToAdd = (List<PrimitiveId>) t.getTransferData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
                     model.insertVias(idsToAdd);
-                } catch (IOException e) {
-                    e.printStackTrace();
-                } catch (UnsupportedFlavorException e) {
-                    e.printStackTrace();
+                } catch (IOException | UnsupportedFlavorException e) {
+                    Logging.error(e);
                 }
             }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/AbstractTurnRestrictionsListView.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/AbstractTurnRestrictionsListView.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/AbstractTurnRestrictionsListView.java	(revision 34567)
@@ -6,6 +6,6 @@
 import javax.swing.event.ListSelectionListener;
 
-import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.spi.preferences.IPreferences;
 
 /**
@@ -36,5 +36,5 @@
     }
 
-    public void initIconSetFromPreferences(Preferences prefs) {
+    public void initIconSetFromPreferences(IPreferences prefs) {
         TurnRestrictionCellRenderer renderer = (TurnRestrictionCellRenderer) lstTurnRestrictions.getCellRenderer();
         renderer.initIconSetFromPreferences(prefs);
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionCellRenderer.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionCellRenderer.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionCellRenderer.java	(revision 34567)
@@ -23,5 +23,4 @@
 import javax.swing.table.TableCellRenderer;
 
-import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
@@ -31,4 +30,5 @@
 import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
 import org.openstreetmap.josm.plugins.turnrestrictions.preferences.PreferenceKeys;
+import org.openstreetmap.josm.spi.preferences.IPreferences;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -220,5 +220,5 @@
      * @param prefs the JOSM preferences
      */
-    public void initIconSetFromPreferences(Preferences prefs) {
+    public void initIconSetFromPreferences(IPreferences prefs) {
 
         iconSet = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionListModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionListModel.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionListModel.java	(revision 34567)
@@ -8,5 +8,5 @@
 import javax.swing.DefaultListSelectionModel;
 
-import org.openstreetmap.josm.data.SelectionChangedListener;
+import org.openstreetmap.josm.data.osm.DataSelectionListener;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
@@ -21,5 +21,5 @@
  */
 public class TurnRestrictionsInSelectionListModel extends TurnRestrictionsListModel
-    implements ActiveLayerChangeListener, SelectionChangedListener {
+    implements ActiveLayerChangeListener, DataSelectionListener {
 
     public TurnRestrictionsInSelectionListModel(
@@ -63,6 +63,6 @@
     /* --------------------------------------------------------------------------- */
     @Override
-    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
-        initFromSelection(newSelection);
+    public void selectionChanged(SelectionChangeEvent event) {
+        initFromSelection(event.getSelection());
     }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionView.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionView.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionView.java	(revision 34567)
@@ -10,7 +10,6 @@
 import javax.swing.ListSelectionModel;
 
-import org.openstreetmap.josm.data.SelectionChangedListener;
+import org.openstreetmap.josm.data.osm.DataSelectionListener;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
 import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
 import org.openstreetmap.josm.gui.MainApplication;
@@ -38,5 +37,5 @@
     protected void registerAsListener() {
         MainApplication.getLayerManager().addActiveLayerChangeListener((ActiveLayerChangeListener) model);
-        SelectionEventManager.getInstance().addSelectionListener((SelectionChangedListener) model, FireMode.IN_EDT_CONSOLIDATED);
+        SelectionEventManager.getInstance().addSelectionListenerForEdt((DataSelectionListener) model);
         TurnRestrictionsInSelectionListModel m = (TurnRestrictionsInSelectionListModel) model;
         if (MainApplication.getLayerManager().getEditLayer() != null) {
@@ -49,5 +48,5 @@
     protected void unregisterAsListener() {
         MainApplication.getLayerManager().removeActiveLayerChangeListener((ActiveLayerChangeListener) model);
-        SelectionEventManager.getInstance().removeSelectionListener((SelectionChangedListener) model);
+        SelectionEventManager.getInstance().removeSelectionListener((DataSelectionListener) model);
     }
 
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListDialog.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListDialog.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListDialog.java	(revision 34567)
@@ -23,5 +23,4 @@
 import javax.swing.event.ListSelectionListener;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.AutoScaleAction;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -40,4 +39,5 @@
 import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionEditorManager;
 import org.openstreetmap.josm.plugins.turnrestrictions.preferences.PreferenceKeys;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
@@ -82,5 +82,5 @@
         MainApplication.getLayerManager().addActiveLayerChangeListener(actNew);
         actNew.updateEnabledState();
-        Main.pref.addPreferenceChangeListener(preferenceChangeHandler);
+        Config.getPref().addPreferenceChangeListener(preferenceChangeHandler);
         preferenceChangeHandler.refreshIconSet();
     }
@@ -91,5 +91,5 @@
         pnlTurnRestrictionsInSelection.unregisterAsListener();
         MainApplication.getLayerManager().removeActiveLayerChangeListener(actNew);
-        Main.pref.removePreferenceChangeListener(preferenceChangeHandler);
+        Config.getPref().removePreferenceChangeListener(preferenceChangeHandler);
     }
 
@@ -445,6 +445,6 @@
     class PreferenceChangeHandler implements PreferenceChangedListener {
         public void refreshIconSet() {
-            pnlTurnRestrictionsInDataSet.initIconSetFromPreferences(Main.pref);
-            pnlTurnRestrictionsInSelection.initIconSetFromPreferences(Main.pref);
+            pnlTurnRestrictionsInDataSet.initIconSetFromPreferences(Config.getPref());
+            pnlTurnRestrictionsInSelection.initIconSetFromPreferences(Config.getPref());
             repaint();
         }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java	(revision 34567)
@@ -19,8 +19,8 @@
 import javax.swing.event.HyperlinkListener;
 
-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.HtmlPanel;
+import org.openstreetmap.josm.spi.preferences.Config;
 import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
@@ -83,5 +83,5 @@
 
         pnlIconPreferences = new PreferencesPanel();
-        pnlIconPreferences.initFromPreferences(Main.pref);
+        pnlIconPreferences.initFromPreferences(Config.getPref());
 
         JScrollPane sp = new JScrollPane(pnlIconPreferences);
@@ -113,5 +113,5 @@
     @Override
     public boolean ok() {
-        pnlIconPreferences.saveToPreferences(Main.pref);
+        pnlIconPreferences.saveToPreferences(Config.getPref());
         return false;
     }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferencesPanel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferencesPanel.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferencesPanel.java	(revision 34567)
@@ -17,8 +17,8 @@
 import javax.swing.JSeparator;
 
-import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.gui.widgets.HtmlPanel;
 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel;
 import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionType;
+import org.openstreetmap.josm.spi.preferences.IPreferences;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -171,5 +171,5 @@
      * @param prefs the preferences
      */
-    public void initFromPreferences(Preferences prefs) {
+    public void initFromPreferences(IPreferences prefs) {
         String set = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");
         if (!set.equals("set-a") && !set.equals("set-b")) {
@@ -194,5 +194,5 @@
      * @param prefs the preferences
      */
-    public void saveToPreferences(Preferences prefs) {
+    public void saveToPreferences(IPreferences prefs) {
         prefs.put(PreferenceKeys.ROAD_SIGNS, rbSetA.isSelected() ? "set-a" : "set-b");
         prefs.putBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, cbShowViaListInBasicEditor.isSelected());
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/TurnRestrictionLegSplitRequiredError.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/TurnRestrictionLegSplitRequiredError.java	(revision 34506)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/TurnRestrictionLegSplitRequiredError.java	(revision 34567)
@@ -11,9 +11,9 @@
 
 import org.openstreetmap.josm.command.SplitWayCommand;
+import org.openstreetmap.josm.data.UndoRedoHandler;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
 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.turnrestrictions.TurnRestrictionBuilder;
 import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionLegRole;
@@ -138,5 +138,5 @@
                   );
                   if (result != null) {
-                      MainApplication.undoRedo.add(result);
+                      UndoRedoHandler.getInstance().add(result);
                   }
             }
@@ -149,5 +149,5 @@
                 );
                 if (result != null) {
-                    MainApplication.undoRedo.add(result);
+                    UndoRedoHandler.getInstance().add(result);
                 }
                 if (result == null) return;
