Index: applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
===================================================================
--- applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java	(revision 32936)
+++ applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java	(revision 33760)
@@ -16,5 +16,4 @@
 import javax.swing.JPanel;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.SelectionChangedListener;
 import org.openstreetmap.josm.data.SystemOfMeasurement;
@@ -33,4 +32,5 @@
 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent;
 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.SideButton;
 import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
@@ -171,4 +171,8 @@
     @Override
     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
+        refresh(newSelection);
+    }
+
+    private void refresh(Collection<? extends OsmPrimitive> selection) {
         double length = 0.0;
         double segAngle = 0.0;
@@ -177,7 +181,7 @@
         Node lastNode = null;
         // Don't mix up way and nodes computation (fix #6872). Priority given to ways
-        ways = new SubclassFilteredCollection<>(newSelection, Way.class::isInstance);
+        ways = new SubclassFilteredCollection<>(selection, Way.class::isInstance);
         if (ways.isEmpty()) {
-            nodes = new SubclassFilteredCollection<>(newSelection, Node.class::isInstance);
+            nodes = new SubclassFilteredCollection<>(selection, Node.class::isInstance);
             for (Node n : nodes) {
                 if (n.getCoor() != null) {
@@ -241,5 +245,5 @@
         });
 
-        DataSet currentDs = Main.getLayerManager().getEditDataSet();
+        DataSet currentDs = MainApplication.getLayerManager().getEditDataSet();
 
         if (ds != currentDs) {
@@ -280,5 +284,11 @@
         // Refresh selection if a node belonging to a selected member has moved (example: scale action)
         if ((nodes != null && nodes.contains(n)) || waysContain(n)) {
-            selectionChanged(Main.getLayerManager().getEditDataSet().getSelected());
+            refresh(event.getDataset().getSelected());
+        }
+    }
+
+    @Override public void wayNodesChanged(WayNodesChangedEvent event) {
+        if (ways.contains(event.getChangedWay())) {
+            refresh(event.getDataset().getSelected());
         }
     }
@@ -287,5 +297,4 @@
     @Override public void primitivesRemoved(PrimitivesRemovedEvent event) {}
     @Override public void tagsChanged(TagsChangedEvent event) {}
-    @Override public void wayNodesChanged(WayNodesChangedEvent event) { }
     @Override public void relationMembersChanged(RelationMembersChangedEvent event) {}
     @Override public void otherDatasetChange(AbstractDatasetChangedEvent event) {}
@@ -295,7 +304,7 @@
     public void systemOfMeasurementChanged(String oldSoM, String newSoM) {
         // Refresh selection to take into account new system of measurement
-        DataSet currentDs = Main.getLayerManager().getEditDataSet();
+        DataSet currentDs = MainApplication.getLayerManager().getEditDataSet();
         if (currentDs != null) {
-            selectionChanged(currentDs.getSelected());
+            refresh(currentDs.getSelected());
         }
     }
Index: applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java
===================================================================
--- applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java	(revision 32936)
+++ applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java	(revision 33760)
@@ -34,4 +34,5 @@
 import org.openstreetmap.josm.data.gpx.WayPoint;
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.gui.NavigatableComponent;
@@ -115,5 +116,4 @@
         if(l != null) points.remove(l);
         recalculate();
-        Main.map.repaint();
     }
 
@@ -121,8 +121,7 @@
         if (e.getButton() != MouseEvent.BUTTON1) return;
 
-        LatLon coor = Main.map.mapView.getLatLon(e.getX(), e.getY());
+        LatLon coor = MainApplication.getMap().mapView.getLatLon(e.getX(), e.getY());
         points.add(new WayPoint(coor));
 
-        Main.map.repaint();
         recalculate();
     }
@@ -131,5 +130,4 @@
         points.clear();
         recalculate();
-        Main.map.repaint();
     }
 
@@ -149,7 +147,8 @@
             MeasurementPlugin.measurementDialog.pathLengthLabel.setText(NavigatableComponent.getDistText(pathLength));
         }
-        if (Main.map.mapMode instanceof MeasurementMode) {
-            Main.map.statusLine.setDist(pathLength);
-        }
+        if (MainApplication.getMap().mapMode instanceof MeasurementMode) {
+            MainApplication.getMap().statusLine.setDist(pathLength);
+        }
+        invalidate();
     }
 
@@ -234,5 +233,5 @@
             Box panel = Box.createVerticalBox();
             final JList<GpxLayer> layerList = new JList<>(model);
-            Collection<Layer> data = Main.getLayerManager().getLayers();
+            Collection<Layer> data = MainApplication.getLayerManager().getLayers();
             Layer lastLayer = null;
             int layerCnt = 0;
@@ -295,5 +294,4 @@
                 }
                 recalculate();
-                Main.parent.repaint();
             } else{
                 // TODO: register a listener and show menu entry only if gps layers are available
Index: applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementMode.java
===================================================================
--- applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementMode.java	(revision 32936)
+++ applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementMode.java	(revision 33760)
@@ -12,12 +12,12 @@
 import org.openstreetmap.josm.actions.mapmode.MapMode;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.gui.MapFrame;
+import org.openstreetmap.josm.gui.MainApplication;
 
 public class MeasurementMode extends MapMode {
 
     private static final long serialVersionUID = 3853830673475744263L;
-    
-    public MeasurementMode(MapFrame mapFrame, String name, String desc) {
-        super(name, "measurement.png", desc, mapFrame, Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
+
+    public MeasurementMode(String name, String desc) {
+        super(name, "measurement.png", desc, Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
     }
 
@@ -25,5 +25,5 @@
     public void enterMode() {
         super.enterMode();
-        Main.map.mapView.addMouseListener(this);
+        MainApplication.getMap().mapView.addMouseListener(this);
     }
 
@@ -31,5 +31,5 @@
     public void exitMode() {
         super.exitMode();
-        Main.map.mapView.removeMouseListener(this);
+        MainApplication.getMap().mapView.removeMouseListener(this);
     }
 
@@ -47,5 +47,5 @@
             MeasurementPlugin.getCurrentLayer().removeLastPoint();
         } else if (e.getButton() == MouseEvent.BUTTON1){
-            LatLon coor = Main.map.mapView.getLatLon(e.getX(), e.getY());
+            LatLon coor = MainApplication.getMap().mapView.getLatLon(e.getX(), e.getY());
             if (coor.isOutSideWorld()) {
                 JOptionPane.showMessageDialog(Main.parent,tr("Can not draw outside of the world."));
Index: applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.java
===================================================================
--- applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.java	(revision 32936)
+++ applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.java	(revision 33760)
@@ -4,6 +4,6 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.IconToggleButton;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.layer.Layer;
@@ -32,5 +32,5 @@
         if (newFrame != null) {
             newFrame.addToggleDialog(measurementDialog = new MeasurementDialog());
-            mode = new MeasurementMode(newFrame, "measurement", tr("measurement mode"));
+            mode = new MeasurementMode("measurement", tr("measurement mode"));
             btn = new IconToggleButton(mode);
             btn.setVisible(true);
@@ -46,15 +46,15 @@
         if (currentLayer == null) {
             currentLayer = new MeasurementLayer(tr("Measurements"));
-            Main.getLayerManager().addLayer(currentLayer);
+            MainApplication.getLayerManager().addLayer(currentLayer);
             final ActiveLayerChangeListener activeListener = new ActiveLayerChangeListener() {
                 @Override
                 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
-                    Layer newLayer = Main.getLayerManager().getActiveLayer();
+                    Layer newLayer = MainApplication.getLayerManager().getActiveLayer();
                     if (newLayer instanceof MeasurementLayer)
                         MeasurementPlugin.currentLayer = (MeasurementLayer)newLayer;
                 }
             };
-            Main.getLayerManager().addActiveLayerChangeListener(activeListener);
-            Main.getLayerManager().addLayerChangeListener(new LayerChangeListener(){
+            MainApplication.getLayerManager().addActiveLayerChangeListener(activeListener);
+            MainApplication.getLayerManager().addLayerChangeListener(new LayerChangeListener(){
                 @Override
                 public void layerAdded(LayerAddEvent e) {
@@ -66,6 +66,6 @@
                     Layer oldLayer = e.getRemovedLayer();
                     if (oldLayer != null && oldLayer == currentLayer) {
-                        Main.getLayerManager().removeActiveLayerChangeListener(activeListener);
-                        Main.getLayerManager().removeLayerChangeListener(this);
+                        MainApplication.getLayerManager().removeActiveLayerChangeListener(activeListener);
+                        MainApplication.getLayerManager().removeLayerChangeListener(this);
                     }
                 }
