Index: /applications/editors/josm/plugins/piclayer/build.xml
===================================================================
--- /applications/editors/josm/plugins/piclayer/build.xml	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/build.xml	(revision 33809)
@@ -3,5 +3,5 @@
     <property name="commit.message" value="[josm/PicLayer] - #12045 add ability to localize dialog titles"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="11713"/>
+    <property name="plugin.main.version" value="13050"/>
 	
     <!-- Configure these properties (replace "..." accordingly).
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java	(revision 33809)
@@ -32,4 +32,5 @@
 import org.openstreetmap.josm.actions.mapmode.MapMode;
 import org.openstreetmap.josm.gui.IconToggleButton;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MainMenu;
 import org.openstreetmap.josm.gui.MapFrame;
@@ -76,10 +77,10 @@
 
         // Add menu items
-        MainMenu.add(Main.main.menu.imagerySubMenu, newLayerFromFileAction);
-        MainMenu.add(Main.main.menu.imagerySubMenu, newLayerFromClipboardAction);
+        MainMenu.add(MainApplication.getMenu().imagerySubMenu, newLayerFromFileAction);
+        MainMenu.add(MainApplication.getMenu().imagerySubMenu, newLayerFromClipboardAction);
         updateEnabledState();
         // Listen to layers
-        Main.getLayerManager().addLayerChangeListener(this);
-        Main.getLayerManager().addActiveLayerChangeListener(this);
+        MainApplication.getLayerManager().addLayerChangeListener(this);
+        MainApplication.getLayerManager().addActiveLayerChangeListener(this);
     }
 
@@ -132,5 +133,5 @@
     public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
         Layer oldLayer = e.getPreviousActiveLayer();
-        Layer newLayer = Main.getLayerManager().getActiveLayer();
+        Layer newLayer = MainApplication.getLayerManager().getActiveLayer();
         boolean oldPic = oldLayer instanceof PicLayerAbstract;
         boolean newPic = newLayer instanceof PicLayerAbstract;
@@ -177,5 +178,5 @@
 
     private void updateEnabledState() {
-        boolean enable = !Main.getLayerManager().getLayers().isEmpty();
+        boolean enable = !MainApplication.getLayerManager().getLayers().isEmpty();
         newLayerFromFileAction.setEnabled(enable);
         newLayerFromClipboardAction.setEnabled(enable);
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/GenericPicTransformAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/GenericPicTransformAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/GenericPicTransformAction.java	(revision 33809)
@@ -8,7 +8,7 @@
 import java.awt.geom.Point2D;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.mapmode.MapMode;
 import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.layer.Layer;
@@ -43,6 +43,6 @@
     public void enterMode() {
         super.enterMode();
-        Main.map.mapView.addMouseListener(this);
-        Main.map.mapView.addMouseMotionListener(this);
+        MainApplication.getMap().mapView.addMouseListener(this);
+        MainApplication.getMap().mapView.addMouseMotionListener(this);
     }
 
@@ -50,6 +50,6 @@
     public void exitMode() {
         super.exitMode();
-        Main.map.mapView.removeMouseListener(this);
-        Main.map.mapView.removeMouseMotionListener(this);
+        MainApplication.getMap().mapView.removeMouseListener(this);
+        MainApplication.getMap().mapView.removeMouseMotionListener(this);
     }
 
@@ -57,6 +57,6 @@
     public void mousePressed(MouseEvent e) {
         // Start action
-        if (Main.getLayerManager().getActiveLayer() instanceof PicLayerAbstract) {
-            currentLayer = (PicLayerAbstract) Main.getLayerManager().getActiveLayer();
+        if (MainApplication.getLayerManager().getActiveLayer() instanceof PicLayerAbstract) {
+            currentLayer = (PicLayerAbstract) MainApplication.getLayerManager().getActiveLayer();
 
             if (currentLayer != null && e.getButton() == MouseEvent.BUTTON1) {
@@ -64,5 +64,5 @@
                 isDragging = true;
                 prevMousePoint = new Point(e.getPoint());
-                prevEastNorth = Main.map.mapView.getEastNorth(e.getX(), e.getY());
+                prevEastNorth = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY());
                 // try to find and fill selected point if possible
                 selectedPoint = currentLayer.findSelectedPoint(e.getPoint());
@@ -78,5 +78,5 @@
             doAction(e);
             prevMousePoint = new Point(e.getPoint());
-            prevEastNorth = Main.map.mapView.getEastNorth(e.getX(), e.getY());
+            prevEastNorth = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY());
             currentLayer.invalidate();
         }
@@ -99,5 +99,5 @@
 
     protected void updateDrawPoints(boolean value) {
-        Layer active = Main.getLayerManager().getActiveLayer();
+        Layer active = MainApplication.getLayerManager().getActiveLayer();
         if (active instanceof PicLayerAbstract) {
             ((PicLayerAbstract) active).setDrawPoints(value);
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromClipboardAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromClipboardAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromClipboardAction.java	(revision 33809)
@@ -28,6 +28,6 @@
 import javax.swing.JOptionPane;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerFromClipboard;
 
@@ -63,5 +63,5 @@
         }
         // Add layer
-        Main.getLayerManager().addLayer(layer);
+        MainApplication.getLayerManager().addLayer(layer);
     }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromFileAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromFileAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromFileAction.java	(revision 33809)
@@ -37,4 +37,5 @@
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract;
@@ -119,7 +120,7 @@
             // or at the bottom of the stack if there is no such layer yet
             // The next layers we load will be placed one after the other after this first layer
-            int newLayerPos = Main.getLayerManager().getLayers().size();
-            for (Layer l : Main.getLayerManager().getLayersOfType(PicLayerAbstract.class)) {
-                int pos = Main.getLayerManager().getLayers().indexOf(l);
+            int newLayerPos = MainApplication.getLayerManager().getLayers().size();
+            for (Layer l : MainApplication.getLayerManager().getLayersOfType(PicLayerAbstract.class)) {
+                int pos = MainApplication.getLayerManager().getLayers().indexOf(l);
                 if (pos < newLayerPos) newLayerPos = pos;
             }
@@ -164,12 +165,12 @@
         // Add layer only if successfully initialized
 
-        Main.getLayerManager().addLayer(layer);
-        Main.map.mapView.moveLayer(layer, newLayerPos++);
+        MainApplication.getLayerManager().addLayer(layer);
+        MainApplication.getMap().mapView.moveLayer(layer, newLayerPos++);
 
-        if (isZoomToLayer && Main.pref.getInteger("piclayer.zoom-on-load", 1) != 0) {
+        if (isZoomToLayer && Main.pref.getInt("piclayer.zoom-on-load", 1) != 0) {
             // if we are loading a single picture file, zoom on it, so that the user can see something
             BoundingXYVisitor v = new BoundingXYVisitor();
             layer.visitBoundingBox(v);
-            Main.map.mapView.zoomTo(v);
+            MainApplication.getMap().mapView.zoomTo(v);
         }
     }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/MovePictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/MovePictureAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/MovePictureAction.java	(revision 33809)
@@ -25,6 +25,6 @@
 import java.awt.event.MouseEvent;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
@@ -41,10 +41,11 @@
      */
     public MovePictureAction(MapFrame frame) {
-        super(tr("PicLayer move"), tr("Moved"), "move", tr("Drag to move the picture"), frame, ImageProvider.getCursor("crosshair", null));
+        super(tr("PicLayer move"), tr("Moved"), "move", tr("Drag to move the picture"),
+                frame, ImageProvider.getCursor("crosshair", null));
     }
 
     @Override
     protected void doAction(MouseEvent e) {
-        EastNorth eastNorth = Main.map.mapView.getEastNorth(e.getX(), e.getY());
+        EastNorth eastNorth = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY());
         currentLayer.movePictureBy(
             eastNorth.east() - prevEastNorth.east(),
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/RotatePictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/RotatePictureAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/RotatePictureAction.java	(revision 33809)
@@ -27,5 +27,5 @@
 import java.awt.geom.Point2D;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
@@ -48,5 +48,5 @@
     @Override
     protected void doAction(MouseEvent e) {
-        Point2D center = new Point(Main.map.mapView.getWidth()/2, Main.map.mapView.getHeight()/2);
+        Point2D center = new Point(MainApplication.getMap().mapView.getWidth()/2, MainApplication.getMap().mapView.getHeight()/2);
         double alpha1 = Math.atan2(e.getY() - center.getY(), e.getX() - center.getX());
         double alpha0 = Math.atan2(prevMousePoint.getY() - center.getY(), prevMousePoint.getX() - center.getX());
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXPictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXPictureAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXPictureAction.java	(revision 33809)
@@ -25,5 +25,5 @@
 import java.awt.event.MouseEvent;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
@@ -40,10 +40,11 @@
      */
     public ScaleXPictureAction(MapFrame frame) {
-        super(tr("PicLayer scale X"), tr("Scaled by X"), "scale_x", tr("Drag to scale the picture in the X Axis"), frame, ImageProvider.getCursor("crosshair", null));
+        super(tr("PicLayer scale X"), tr("Scaled by X"), "scale_x", tr("Drag to scale the picture in the X Axis"),
+                frame, ImageProvider.getCursor("crosshair", null));
     }
 
     @Override
     protected void doAction(MouseEvent e) {
-        double centerX = Main.map.mapView.getWidth()/2;
+        double centerX = MainApplication.getMap().mapView.getWidth()/2;
         double dx0 = Math.max(Math.abs(prevMousePoint.getX() - centerX), 10);
         double dx = Math.abs(e.getX() - centerX);
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXYPictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXYPictureAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleXYPictureAction.java	(revision 33809)
@@ -27,5 +27,5 @@
 import java.awt.geom.Point2D;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
@@ -42,11 +42,12 @@
      */
     public ScaleXYPictureAction(MapFrame frame) {
-        super(tr("PicLayer scale"), tr("Scaled"), "scale", tr("Drag to scale the picture in the X and Y Axis"), frame, ImageProvider.getCursor("crosshair", null));
+        super(tr("PicLayer scale"), tr("Scaled"), "scale", tr("Drag to scale the picture in the X and Y Axis"),
+                frame, ImageProvider.getCursor("crosshair", null));
     }
 
     @Override
     protected void doAction(MouseEvent e) {
-        double centerX = Main.map.mapView.getWidth()/2;
-        double centerY = Main.map.mapView.getHeight()/2;
+        double centerX = MainApplication.getMap().mapView.getWidth()/2;
+        double centerY = MainApplication.getMap().mapView.getHeight()/2;
         double d0 = Math.max(prevMousePoint.distance(centerX, centerY), 10);
         Point2D mousePoint = new Point(e.getX(), e.getY());
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleYPictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleYPictureAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ScaleYPictureAction.java	(revision 33809)
@@ -25,5 +25,5 @@
 import java.awt.event.MouseEvent;
 
-import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
@@ -40,10 +40,11 @@
      */
     public ScaleYPictureAction(MapFrame frame) {
-        super(tr("PicLayer scale Y"), tr("Scaled by Y"), "scale_y", tr("Drag to scale the picture in the Y Axis"), frame, ImageProvider.getCursor("crosshair", null));
+        super(tr("PicLayer scale Y"), tr("Scaled by Y"), "scale_y", tr("Drag to scale the picture in the Y Axis"),
+                frame, ImageProvider.getCursor("crosshair", null));
     }
 
     @Override
     protected void doAction(MouseEvent e) {
-        double centerY = Main.map.mapView.getHeight()/2;
+        double centerY = MainApplication.getMap().mapView.getHeight()/2;
         double dy0 = Math.max(Math.abs(prevMousePoint.getY() - centerY), 10);
         double dy = Math.abs(e.getY() - centerY);
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ShearPictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ShearPictureAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/ShearPictureAction.java	(revision 33809)
@@ -27,6 +27,6 @@
 import java.awt.event.MouseEvent;
 
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.plugins.piclayer.actions.GenericPicTransformAction;
@@ -48,5 +48,5 @@
     @Override
     protected void doAction(MouseEvent e) {
-        EastNorth eastNorth = Main.map.mapView.getEastNorth(e.getX(), e.getY());
+        EastNorth eastNorth = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY());
         currentLayer.shearPictureBy(
             1000* (eastNorth.east() - prevEastNorth.east()),
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/MovePointAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/MovePointAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/MovePointAction.java	(revision 33809)
@@ -16,5 +16,6 @@
 
     public MovePointAction(MapFrame frame) {
-        super(tr("PicLayer Move point"), tr("Point added/moved"), "movepoint", tr("Drag or create point on the picture"), frame, ImageProvider.getCursor("crosshair", null));
+        super(tr("PicLayer Move point"), tr("Point added/moved"), "movepoint", tr("Drag or create point on the picture"),
+                frame, ImageProvider.getCursor("crosshair", null));
     }
 
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/RemovePointAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/RemovePointAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/RemovePointAction.java	(revision 33809)
@@ -13,5 +13,6 @@
 
     public RemovePointAction(MapFrame frame) {
-        super(tr("PicLayer Remove point"), tr("Point removed"), "removepoint", tr("Remove point on the picture"), frame, ImageProvider.getCursor("crosshair", null));
+        super(tr("PicLayer Remove point"), tr("Point removed"), "removepoint", tr("Remove point on the picture"),
+                frame, ImageProvider.getCursor("crosshair", null));
     }
 
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/TransformPointAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/TransformPointAction.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/transform/affine/TransformPointAction.java	(revision 33809)
@@ -15,5 +15,6 @@
 
     public TransformPointAction(MapFrame frame) {
-        super(tr("PicLayer Transform point"), tr("Point transformed"), "transformpoint", tr("Transform point on the picture"), frame, ImageProvider.getCursor("crosshair", null));
+        super(tr("PicLayer Transform point"), tr("Point transformed"), "transformpoint", tr("Transform point on the picture"),
+                frame, ImageProvider.getCursor("crosshair", null));
     }
 
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/command/TransformCommand.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/command/TransformCommand.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/command/TransformCommand.java	(revision 33809)
@@ -10,5 +10,5 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.plugins.piclayer.layer.PicLayerAbstract;
 import org.openstreetmap.josm.plugins.piclayer.transform.PictureTransform;
@@ -23,4 +23,5 @@
 
     public TransformCommand(PicLayerAbstract layer, String actionName) {
+        super(MainApplication.getLayerManager().getEditDataSet());
         this.layer = layer;
         this.actionName = actionName;
@@ -61,9 +62,4 @@
 
     @Override
-    public boolean invalidBecauselayerRemoved(Layer oldLayer) {
-        return oldLayer == layer;
-    }
-
-    @Override
     public Icon getDescriptionIcon() {
         return ImageProvider.get("layericon");
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java	(revision 33809)
@@ -50,4 +50,5 @@
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
 import org.openstreetmap.josm.data.projection.Projection;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.gui.layer.Layer;
@@ -58,4 +59,6 @@
 import org.openstreetmap.josm.plugins.piclayer.actions.SavePictureCalibrationToWorldAction;
 import org.openstreetmap.josm.plugins.piclayer.transform.PictureTransform;
+import org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider;
+import org.openstreetmap.josm.tools.Logging;
 
 /**
@@ -156,7 +159,7 @@
 
         // If the map does not exist - we're screwed. We should not get into this situation in the first place!
-        if (Main.map != null && Main.map.mapView != null) {
-
-            EastNorth center = Main.map.mapView.getCenter();
+        if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) {
+
+            EastNorth center = MainApplication.getMap().mapView.getCenter();
 
 //            imagePosition = new EastNorth(center.east(), center.north());
@@ -164,5 +167,5 @@
 //            initialImagePosition = new EastNorth(imagePosition.east(), imagePosition.north());
             // Initial scale at which the image was loaded
-            initialImageScale = Main.map.mapView.getDist100Pixel();
+            initialImageScale = MainApplication.getMap().mapView.getDist100Pixel();
         } else {
             throw new IOException(tr("Could not find the map object."));
@@ -449,10 +452,10 @@
             // initialize matrix
             double[] matrix = new double[6];
-            matrix[0] = Double.parseDouble(props.getProperty(MATRIXm00, "1"));
-            matrix[1] = Double.parseDouble(props.getProperty(MATRIXm01, "0"));
-            matrix[2] = Double.parseDouble(props.getProperty(MATRIXm10, "0"));
-            matrix[3] = Double.parseDouble(props.getProperty(MATRIXm11, "1"));
-            matrix[4] = Double.parseDouble(props.getProperty(MATRIXm02, "0"));
-            matrix[5] = Double.parseDouble(props.getProperty(MATRIXm12, "0"));
+            matrix[0] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm00, "1"));
+            matrix[1] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm01, "0"));
+            matrix[2] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm10, "0"));
+            matrix[3] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm11, "1"));
+            matrix[4] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm02, "0"));
+            matrix[5] = JosmDecimalFormatSymbolsProvider.parseDouble(props.getProperty(MATRIXm12, "0"));
 
             transform = new AffineTransform(matrix);
@@ -474,5 +477,5 @@
             for (int i = 0; i < 6; ++i) {
                 String line = br.readLine();
-                e[i] = Double.parseDouble(line);
+                e[i] = JosmDecimalFormatSymbolsProvider.parseDouble(line);
             }
             double sx = e[0], ry = e[1], rx = e[2], sy = e[3], dx = e[4], dy = e[5];
@@ -532,9 +535,9 @@
         // Position image at the right graphical place
 
-        EastNorth center = Main.map.mapView.getCenter();
-        EastNorth leftop = Main.map.mapView.getEastNorth(0, 0);
+        EastNorth center = MainApplication.getMap().mapView.getCenter();
+        EastNorth leftop = MainApplication.getMap().mapView.getEastNorth(0, 0);
         // Number of pixels for one unit in east north space.
         // This is the same in x- and y- direction.
-        double pixel_per_en = (Main.map.mapView.getWidth() / 2.0) / (center.east() - leftop.east());
+        double pixel_per_en = (MainApplication.getMap().mapView.getWidth() / 2.0) / (center.east() - leftop.east());
 
         EastNorth imageCenter = transformer.getImagePosition();
@@ -565,9 +568,9 @@
     public void rotatePictureBy(double angle) {
         try {
-            Point2D trans = transformPoint(new Point(Main.map.mapView.getWidth()/2, Main.map.mapView.getHeight()/2));
-
+            MapView mapView = MainApplication.getMap().mapView;
+            Point2D trans = transformPoint(new Point(mapView.getWidth()/2, mapView.getHeight()/2));
             transformer.concatenateTransformPoint(AffineTransform.getRotateInstance(angle), trans);
         } catch (NoninvertibleTransformException e) {
-            e.printStackTrace();
+            Logging.error(e);
         }
     }
@@ -575,9 +578,9 @@
     public void scalePictureBy(double scalex, double scaley) {
         try {
-            Point2D trans = transformPoint(new Point(Main.map.mapView.getWidth()/2, Main.map.mapView.getHeight()/2));
-
+            MapView mapView = MainApplication.getMap().mapView;
+            Point2D trans = transformPoint(new Point(mapView.getWidth()/2, mapView.getHeight()/2));
             transformer.concatenateTransformPoint(AffineTransform.getScaleInstance(scalex, scaley), trans);
         } catch (NoninvertibleTransformException e) {
-            e.printStackTrace();
+            Logging.error(e);
         }
     }
@@ -585,9 +588,9 @@
     public void shearPictureBy(double shx, double shy) {
         try {
-            Point2D trans = transformPoint(new Point(Main.map.mapView.getWidth()/2, Main.map.mapView.getHeight()/2));
-
+            MapView mapView = MainApplication.getMap().mapView;
+            Point2D trans = transformPoint(new Point(mapView.getWidth()/2, mapView.getHeight()/2));
             transformer.concatenateTransformPoint(AffineTransform.getShearInstance(shx, shy), trans);
         } catch (NoninvertibleTransformException e) {
-            e.printStackTrace();
+            Logging.error(e);
         }
     }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerFromFile.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerFromFile.java	(revision 33808)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerFromFile.java	(revision 33809)
@@ -37,4 +37,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.Logging;
 /**
  * Layer displaying a picture loaded from a file.
@@ -71,6 +72,4 @@
     protected Image createImage() throws IOException {
         // Try to load file
-        Image image = null;
-
         if (isZip) {
             try (ZipFile zipFile = new ZipFile(m_file)) {
@@ -95,13 +94,12 @@
                     }
                 }
-                System.err.println("Warning: no image in zip file found");
+                Logging.warn("Warning: no image in zip file found");
                 return null;
             } catch (Exception e) {
-                System.err.println(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", m_file.getName(), e.toString()));
+                Logging.warn(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", m_file.getName(), e.toString()));
                 return null;
             }
         } else {
-            image = ImageIO.read(m_file);
-            return image;
+            return ImageIO.read(m_file);
         }
     }
@@ -170,5 +168,5 @@
                 }
             } catch (Exception e) {
-                Main.warn(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", m_file.getName(), e.toString()));
+                Logging.warn(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", m_file.getName(), e.toString()));
                 return;
             }
