Index: applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxPlugin.java
===================================================================
--- applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxPlugin.java	(revision 18962)
+++ applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxPlugin.java	(revision 19052)
@@ -14,6 +14,7 @@
 import org.openstreetmap.josm.gui.IconToggleButton;
 import org.openstreetmap.josm.gui.MapFrame;
+import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
 import org.openstreetmap.josm.gui.layer.Layer;
-import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
 import org.openstreetmap.josm.plugins.Plugin;
 
@@ -85,5 +86,5 @@
             eGpxLayer = new EditGpxLayer(tr("EditGpx"), dataSet);
             Main.main.addLayer(eGpxLayer);
-            Layer.listeners.add(new LayerChangeListener(){
+            MapView.addLayerChangeListener(new LayerChangeListener(){
 
                 public void activeLayerChange(final Layer oldLayer, final Layer newLayer) {
@@ -99,5 +100,5 @@
                         eGpxLayer = null;
                         //dataSet = new DataSet();
-
+                        MapView.removeLayerChangeListener(this);
                     }
                 }
