Index: /applications/editors/josm/plugins/editgpx/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- /applications/editors/josm/plugins/editgpx/.settings/org.eclipse.jdt.core.prefs	(revision 32262)
+++ /applications/editors/josm/plugins/editgpx/.settings/org.eclipse.jdt.core.prefs	(revision 32263)
@@ -81,4 +81,5 @@
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
 org.eclipse.jdt.core.compiler.problem.unusedImport=warning
 org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
Index: /applications/editors/josm/plugins/editgpx/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- /applications/editors/josm/plugins/editgpx/.settings/org.eclipse.jdt.ui.prefs	(revision 32262)
+++ /applications/editors/josm/plugins/editgpx/.settings/org.eclipse.jdt.ui.prefs	(revision 32263)
@@ -1,3 +1,2 @@
-#Sat Oct 16 19:07:29 CEST 2010
 cleanup.add_default_serial_version_id=true
 cleanup.add_generated_serial_version_id=false
@@ -62,5 +61,6 @@
 sp_cleanup.add_missing_methods=false
 sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
 sp_cleanup.add_serial_version_id=false
 sp_cleanup.always_use_blocks=true
@@ -68,8 +68,10 @@
 sp_cleanup.always_use_this_for_non_static_field_access=false
 sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
 sp_cleanup.convert_to_enhanced_for_loop=false
 sp_cleanup.correct_indentation=true
 sp_cleanup.format_source_code=false
 sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
 sp_cleanup.make_local_variable_final=false
 sp_cleanup.make_parameters_final=false
@@ -87,4 +89,5 @@
 sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
 sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=false
 sp_cleanup.remove_trailing_whitespaces=true
 sp_cleanup.remove_trailing_whitespaces_all=true
@@ -100,6 +103,8 @@
 sp_cleanup.sort_members=false
 sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
 sp_cleanup.use_blocks=false
 sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
 sp_cleanup.use_parentheses_in_expressions=false
 sp_cleanup.use_this_for_non_static_field_access=false
@@ -107,2 +112,3 @@
 sp_cleanup.use_this_for_non_static_method_access=false
 sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
Index: /applications/editors/josm/plugins/editgpx/build.xml
===================================================================
--- /applications/editors/josm/plugins/editgpx/build.xml	(revision 32262)
+++ /applications/editors/josm/plugins/editgpx/build.xml	(revision 32263)
@@ -4,5 +4,5 @@
     <property name="commit.message" value="Changed constructor signature of plugin main class"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="10144"/>
+    <property name="plugin.main.version" value="10282"/>
     
     <!-- Configure these properties (replace "..." accordingly).
Index: /applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxLayer.java
===================================================================
--- /applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxLayer.java	(revision 32262)
+++ /applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxLayer.java	(revision 32263)
@@ -38,6 +38,10 @@
     private GPXLayerImportAction layerImport;
 
-    public EditGpxLayer(String str, EditGpxData gpxData) {
-        super(str);
+    /**
+     * Constructs a new {@code EditGpxLayer}.
+     * @param gpxData edit gpx data
+     */
+    public EditGpxLayer(EditGpxData gpxData) {
+        super(tr("EditGpx"));
         data = gpxData;
         layerImport = new GPXLayerImportAction(data);
@@ -49,10 +53,6 @@
      */
     public void initializeImport() {
-        try {
-            if (data.isEmpty()) {
-                layerImport.activateImport();
-            }
-        } catch (Exception e) {
-            Main.error(e);
+        if (data.isEmpty()) {
+            layerImport.activateImport();
         }
     }
@@ -116,9 +116,7 @@
     }
 
-
     public void reset(){
         //TODO implement a reset
     }
-
 
     @Override
@@ -126,5 +124,4 @@
         // TODO Auto-generated method stub
     }
-
 
     /**
@@ -142,4 +139,7 @@
      */
     public class ConvertToGpxLayerAction extends AbstractAction {
+        /**
+         * Constructs a new {@code ConvertToGpxLayerAction}.
+         */
         public ConvertToGpxLayerAction() {
             super(tr("Convert to GPX layer"), ImageProvider.get("converttogpx"));
@@ -147,8 +147,6 @@
         @Override
         public void actionPerformed(ActionEvent e) {
-            if (Main.map.mapMode instanceof EditGpxMode) {
-                if (!Main.map.selectSelectTool(false)) {
-                    Main.map.selectZoomTool(false); // Select tool might not be support of active layer, zoom is always supported
-                }
+            if (Main.map.mapMode instanceof EditGpxMode && !Main.map.selectSelectTool(false)) {
+                Main.map.selectZoomTool(false); // Select tool might not be support of active layer, zoom is always supported
             }
             Main.main.addLayer(new GpxLayer(toGpxData(false), tr("Converted from: {0}", getName())));
@@ -161,4 +159,7 @@
      */
     public class ConvertToAnonTimeGpxLayerAction extends AbstractAction {
+        /**
+         * Constructs a new {@code ConvertToAnonTimeGpxLayerAction}.
+         */
         public ConvertToAnonTimeGpxLayerAction() {
             super(tr("Convert to GPX layer with anonymised time"), ImageProvider.get("converttogpx"));
@@ -166,8 +167,6 @@
         @Override
         public void actionPerformed(ActionEvent e) {
-            if (Main.map.mapMode instanceof EditGpxMode) {
-                if (!Main.map.selectSelectTool(false)) {
-                    Main.map.selectZoomTool(false); // Select tool might not be support of active layer, zoom is always supported
-                }
+            if (Main.map.mapMode instanceof EditGpxMode && !Main.map.selectSelectTool(false)) {
+                Main.map.selectZoomTool(false); // Select tool might not be support of active layer, zoom is always supported
             }
             Main.main.addLayer(new GpxLayer(toGpxData(true), tr("Converted from: {0}", getName())));
Index: /applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxMode.java
===================================================================
--- /applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxMode.java	(revision 32262)
+++ /applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxMode.java	(revision 32263)
@@ -18,7 +18,8 @@
 import org.openstreetmap.josm.actions.mapmode.MapMode;
 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.LayerManager.LayerAddEvent;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
+import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.plugins.editgpx.data.EditGpxData;
@@ -31,11 +32,15 @@
     private static final long serialVersionUID = 7940589057093872411L;
     Point pointPressed;
-    MapFrame mapFrame;
+    private final MapFrame mapFrame;
     Rectangle oldRect;
-    MapFrame frame;
-    EditGpxLayer currentEditLayer;
+    transient EditGpxLayer currentEditLayer;
 
-    public EditGpxMode(MapFrame mapFrame, String name, String desc) {
-        super(name, "editgpx_mode.png", desc, mapFrame, Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
+    /**
+     * Constructs a new {@code EditGpxMode}.
+     * @param mapFrame map frame
+     */
+    public EditGpxMode(MapFrame mapFrame) {
+        super("editgpx", "editgpx_mode.png", tr("edit gpx tracks"), Main.map, Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
+        this.mapFrame = mapFrame;
     }
 
@@ -45,5 +50,5 @@
         Main.map.mapView.addMouseListener(this);
         Main.map.mapView.addMouseMotionListener(this);
-        MapView.addLayerChangeListener(this);
+        Main.map.mapView.getLayerManager().addLayerChangeListener(this);
         updateLayer();
     }
@@ -54,5 +59,5 @@
         Main.map.mapView.removeMouseListener(this);
         Main.map.mapView.removeMouseMotionListener(this);
-        MapView.removeLayerChangeListener(this);
+        Main.map.mapView.getLayerManager().removeLayerChangeListener(this);
     }
 
@@ -78,7 +83,5 @@
         requestFocusInMapView();
 
-        Point pointReleased = e.getPoint();
-
-        Rectangle r = createRect(pointReleased, pointPressed);
+        Rectangle r = createRect(e.getPoint(), pointPressed);
 
         //go through nodes and mark the ones in the selection rect as deleted
@@ -133,6 +136,6 @@
      */
     private void paintRect(Point p1, Point p2) {
-        if (frame != null) {
-            Graphics g = frame.getGraphics();
+        if (mapFrame != null) {
+            Graphics g = mapFrame.getGraphics();
 
             Rectangle r = oldRect;
@@ -152,8 +155,4 @@
     }
 
-    public void setFrame(MapFrame mapFrame) {
-        frame = mapFrame;
-    }
-
     /**
      * create new layer, add listeners and try importing gpx data.
@@ -161,9 +160,9 @@
     private void updateLayer() {
 
-        List<EditGpxLayer> layers = Main.map.mapView.getLayersOfType(EditGpxLayer.class);
-        currentEditLayer = layers.isEmpty()?null:layers.get(0);
+        List<EditGpxLayer> layers = Main.map.mapView.getLayerManager().getLayersOfType(EditGpxLayer.class);
+        currentEditLayer = layers.isEmpty() ? null : layers.get(0);
 
         if(currentEditLayer == null) {
-            currentEditLayer = new EditGpxLayer(tr("EditGpx"), new EditGpxData());
+            currentEditLayer = new EditGpxLayer(new EditGpxData());
             Main.main.addLayer(currentEditLayer);
             currentEditLayer.initializeImport();
@@ -172,13 +171,15 @@
     }
 
-    public void activeLayerChange(Layer oldLayer, Layer newLayer) { }
+    @Override
+    public void layerAdded(LayerAddEvent e) {
+        // Do nothing
+    }
 
-    public void layerAdded(Layer newLayer) { }
-
-    public void layerRemoved(Layer oldLayer) {
-        if (oldLayer instanceof EditGpxLayer) {
+    @Override
+    public void layerRemoving(LayerRemoveEvent e) {
+        if (e.getRemovedLayer() instanceof EditGpxLayer) {
             currentEditLayer = null;
             if (Main.map.mapMode instanceof EditGpxMode) {
-                if (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
+                if (Main.map.mapView.getLayerManager().getActiveLayer() instanceof OsmDataLayer) {
                     Main.map.selectSelectTool(false);
                 } else {
@@ -190,7 +191,6 @@
 
     @Override
-    public void destroy() {
-        super.destroy();
-        MapView.removeLayerChangeListener(this);
+    public void layerOrderChanged(LayerOrderChangeEvent e) {
+        // Do nothing
     }
 }
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 32262)
+++ /applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxPlugin.java	(revision 32263)
@@ -3,8 +3,4 @@
  */
 package org.openstreetmap.josm.plugins.editgpx;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.net.URL;
 
 import javax.swing.ImageIcon;
@@ -26,18 +22,13 @@
  * - BUG: when importing eGpxLayer is shown as RawGpxLayer??
  * - implement reset if user made mistake while marking
- *
- *
  */
 public class EditGpxPlugin extends Plugin {
 
-    private IconToggleButton btn;
-    private EditGpxMode mode;
-
+    /**
+     * Constructs a new {@code EditGpxPlugin}.
+     * @param info plugin information
+     */
     public EditGpxPlugin(PluginInformation info) {
         super(info);
-        mode = new EditGpxMode(Main.map, "editgpx", tr("edit gpx tracks"));
-
-        btn = new IconToggleButton(mode);
-        btn.setVisible(true);
     }
 
@@ -47,14 +38,13 @@
     @Override
     public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-        mode.setFrame(newFrame);
-        if (oldFrame == null && newFrame != null) {
+        if (newFrame != null) {
+            EditGpxMode mode = new EditGpxMode(newFrame);
             if (Main.map != null)
-                Main.map.addMapMode(btn);
+                Main.map.addMapMode(new IconToggleButton(mode));
         }
     }
 
     public static ImageIcon loadIcon(String name) {
-        URL url = EditGpxPlugin.class.getResource("/images/editgpx.png");
-        return new ImageIcon(url);
+        return new ImageIcon(EditGpxPlugin.class.getResource("/images/editgpx.png"));
     }
 }
Index: /applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/GPXLayerImportAction.java
===================================================================
--- /applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/GPXLayerImportAction.java	(revision 32262)
+++ /applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/GPXLayerImportAction.java	(revision 32263)
@@ -11,5 +11,4 @@
 import java.awt.Component;
 import java.awt.event.ActionEvent;
-import java.util.Collection;
 
 import javax.swing.AbstractAction;
@@ -53,9 +52,8 @@
 
         final JList<GpxLayer> layerList = new JList<>(dModel);
-        Collection<Layer> data = Main.map.mapView.getAllLayers();
         int layerCnt = 0;
 
-        for (Layer l : data){
-            if(l instanceof GpxLayer){
+        for (Layer l : Main.map.mapView.getLayerManager().getLayers()){
+            if (l instanceof GpxLayer){
                 dModel.addElement((GpxLayer) l);
                 layerCnt++;
@@ -65,5 +63,6 @@
             layerList.setSelectionInterval(0, layerCnt-1);
             layerList.setCellRenderer(new DefaultListCellRenderer(){
-                @Override public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+                @Override
+                public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                     Layer layer = (Layer)value;
                     JLabel label = (JLabel)super.getListCellRendererComponent(list,
@@ -114,6 +113,6 @@
     /**
      * called when pressing "Import.." from context menu of EditGpx layer
-     *
      */
+    @Override
     public void actionPerformed(ActionEvent arg0) {
         activateImport();
