Index: /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java
===================================================================
--- /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java	(revision 32287)
+++ /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java	(revision 32288)
@@ -75,19 +75,17 @@
         this.locatedImages.clear();
 
-        if (null != Main.map && null != Main.map.mapView) {
-            final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers();
-            final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]);
-
-            for (int index = 0; index < layers.length; index++) {
-                if (layers[index] instanceof GpxLayer
-                && null != ((GpxLayer) layers[index]).data
-                && !((GpxLayer) layers[index]).data.fromServer) {
-                    this.doAssociateLayer((GpxLayer) layers[index]);
-                }
-            }
-
-            for (IImageChangeListener listener : this.listeners) {
-                listener.onSelectedImageEntryChanged(this);
-            }
+        final Collection<Layer> layerCollection = Main.getLayerManager().getLayers();
+        final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]);
+
+        for (int index = 0; index < layers.length; index++) {
+            if (layers[index] instanceof GpxLayer
+            && null != ((GpxLayer) layers[index]).data
+            && !((GpxLayer) layers[index]).data.fromServer) {
+                this.doAssociateLayer((GpxLayer) layers[index]);
+            }
+        }
+
+        for (IImageChangeListener listener : this.listeners) {
+            listener.onSelectedImageEntryChanged(this);
         }
     }
Index: /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java
===================================================================
--- /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java	(revision 32287)
+++ /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java	(revision 32288)
@@ -1,5 +1,3 @@
 package org.insignificant.josm.plugins.imagewaypoint;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.io.File;
@@ -9,6 +7,4 @@
 import java.util.Iterator;
 import java.util.List;
-
-import javax.swing.filechooser.FileFilter;
 
 import org.openstreetmap.josm.Main;
@@ -23,20 +19,4 @@
 
 public final class ImageWayPointPlugin extends org.openstreetmap.josm.plugins.Plugin {
-    private static final class ImageFileFilter extends FileFilter {
-        @Override
-        public final boolean accept(final File file) {
-            return file.isDirectory()
-                || file.getName().toLowerCase().endsWith(".jpg")
-                || file.getName().toLowerCase().endsWith(".jpeg")
-                || file.getName().toLowerCase().endsWith(".png")
-                || file.getName().toLowerCase().endsWith(".gif");
-        }
-
-        @Override
-        public final String getDescription() {
-            return tr("Image files (*.jpg, *.jpeg, *.png, *.gif)");
-        }
-    }
-
     private final class ImageWaypointImporter extends FileImporter {
 
@@ -64,16 +44,13 @@
 
                 // add files to ImageEntries
-                ImageEntries.getInstance()
-                    .add(allFiles.toArray(new File[allFiles.size()]));
+                ImageEntries.getInstance().add(allFiles.toArray(new File[allFiles.size()]));
 
                 // check to see whether there's already an ImageWayPointLayer
                 boolean foundImageWayPointLayer = false;
-                if (null != Main.map && null != Main.map.mapView) {
-                    final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers();
-                    final Iterator<Layer> layerIterator = layerCollection.iterator();
-                    while (layerIterator.hasNext() && !foundImageWayPointLayer) {
-                        if (layerIterator.next() instanceof ImageWayPointLayer) {
-                            foundImageWayPointLayer = true;
-                        }
+                final Collection<Layer> layerCollection = Main.getLayerManager().getLayers();
+                final Iterator<Layer> layerIterator = layerCollection.iterator();
+                while (layerIterator.hasNext() && !foundImageWayPointLayer) {
+                    if (layerIterator.next() instanceof ImageWayPointLayer) {
+                        foundImageWayPointLayer = true;
                     }
                 }
