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 31729)
+++ applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java	(revision 32329)
@@ -158,6 +158,5 @@
                 new SavePictureCalibrationAction((PicLayerAbstract) arg0).actionPerformed(null);
         }
-        // Why should I do all these checks now?
-        boolean enable = Main.map != null && Main.map.mapView != null && Main.map.mapView.getAllLayers() != null && Main.map.mapView.getAllLayers().size() != 0;
+        boolean enable = !Main.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 31729)
+++ applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/GenericPicTransformAction.java	(revision 32329)
@@ -57,6 +57,6 @@
     public void mousePressed(MouseEvent e) {
         // Start action
-        if ( Main.map.mapView.getActiveLayer() instanceof PicLayerAbstract ) {
-            currentLayer = (PicLayerAbstract)Main.map.mapView.getActiveLayer();
+        if ( Main.getLayerManager().getActiveLayer() instanceof PicLayerAbstract ) {
+            currentLayer = (PicLayerAbstract)Main.getLayerManager().getActiveLayer();
 
             if ( currentLayer != null && e.getButton() == MouseEvent.BUTTON1 ) {
@@ -99,5 +99,5 @@
 
     protected void updateDrawPoints(boolean value) {
-        Layer active = Main.map.mapView.getActiveLayer();
+        Layer active = Main.getLayerManager().getActiveLayer();
         if (active instanceof PicLayerAbstract) {
             ((PicLayerAbstract)active).setDrawPoints(value);
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 31729)
+++ applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromFileAction.java	(revision 32329)
@@ -119,6 +119,6 @@
             // 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.map.mapView.getAllLayers().size();
-            for(Layer l : Main.map.mapView.getLayersOfType(PicLayerAbstract.class)) {
+            int newLayerPos = Main.getLayerManager().getLayers().size();
+            for(Layer l : Main.getLayerManager().getLayersOfType(PicLayerAbstract.class)) {
                 int pos = Main.map.mapView.getLayerPos(l);
                 if (pos < newLayerPos) newLayerPos = pos;
