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 14121)
+++ /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java	(revision 14122)
@@ -16,14 +16,14 @@
     private static final class ImageReadyListener implements
         IImageReadyListener {
-    private final ImageEntries imageEntries;
-
-    public ImageReadyListener(final ImageEntries imageEntries) {
-        this.imageEntries = imageEntries;
-    }
-
-    public final void onImageReady(final ImageEntry imageEntry,
-        final Image image) {
-        this.imageEntries.setCurrentImage(imageEntry, image);
-    }
+        private final ImageEntries imageEntries;
+
+        public ImageReadyListener(final ImageEntries imageEntries) {
+            this.imageEntries = imageEntries;
+        }
+
+        public final void onImageReady(final ImageEntry imageEntry,
+            final Image image) {
+            this.imageEntries.setCurrentImage(imageEntry, image);
+        }
     }
 
@@ -39,73 +39,73 @@
 
     private ImageEntries() {
-    this.images = new ArrayList<ImageEntry>();
-    this.locatedImages = new ArrayList<ImageEntry>();
-    this.listeners = new ArrayList<IImageChangeListener>();
-    this.listener = new ImageReadyListener(this);
-
-    this.currentImageEntry = null;
-    this.currentImage = null;
+        this.images = new ArrayList<ImageEntry>();
+        this.locatedImages = new ArrayList<ImageEntry>();
+        this.listeners = new ArrayList<IImageChangeListener>();
+        this.listener = new ImageReadyListener(this);
+
+        this.currentImageEntry = null;
+        this.currentImage = null;
     }
 
     public static final ImageEntries getInstance() {
-    return ImageEntries.INSTANCE;
+        return ImageEntries.INSTANCE;
     }
 
     public final void addListener(final IImageChangeListener listener) {
-    this.listeners.add(listener);
+        this.listeners.add(listener);
     }
 
     public final void removeListener(final IImageChangeListener listener) {
-    this.listeners.remove(listener);
+        this.listeners.remove(listener);
     }
 
     public final void add(final File[] imageFiles) {
-    if (null != imageFiles) {
-        for (int index = 0; index < imageFiles.length; index++) {
-        this.images.add(new ImageEntry(imageFiles[index]));
-        }
-        this.associateAllLayers();
-    }
+        if (null != imageFiles) {
+            for (int index = 0; index < imageFiles.length; index++) {
+            this.images.add(new ImageEntry(imageFiles[index]));
+            }
+            this.associateAllLayers();
+        }
     }
 
     public final void associateAllLayers() {
-    for (int index = 0; index < this.images.size(); index++) {
-        this.images.get(index).setWayPoint(null);
-    }
-    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);
-        }
-    }
+        for (int index = 0; index < this.images.size(); index++) {
+            this.images.get(index).setWayPoint(null);
+        }
+        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);
+            }
+        }
     }
 
     private final void doAssociateLayer(final GpxLayer gpxLayer) {
-    if (null != gpxLayer && null != gpxLayer.data
+        if (null != gpxLayer && null != gpxLayer.data
         && !gpxLayer.data.fromServer) {
-        for (WayPoint wayPoint : gpxLayer.data.waypoints) {
-        final List<String> texts = this.getTextContentsFromWayPoint(wayPoint);
-
-        for (String text : texts) {
-            final ImageEntry image = this.findImageEntryWithFileName(text);
-            if (null != image) {
-            image.setWayPoint(wayPoint);
-            this.locatedImages.add(image);
-            }
-        }
-        }
-    }
+            for (WayPoint wayPoint : gpxLayer.data.waypoints) {
+                final List<String> texts = this.getTextContentsFromWayPoint(wayPoint);
+
+                for (String text : texts) {
+                    final ImageEntry image = this.findImageEntryWithFileName(text);
+                    if (null != image) {
+                    image.setWayPoint(wayPoint);
+                    this.locatedImages.add(image);
+                    }
+                }
+            }
+        }
     }
 
@@ -134,98 +134,96 @@
 
     private final ImageEntry findImageEntryWithFileName(final String fileName) {
-    ImageEntry foundimage = null;
-
-    for (int index = 0; index < this.images.size() && null == foundimage; index++) {
-        final ImageEntry image = this.images.get(index);
-        if (null == image.getWayPoint()
-            && image.getFileName().startsWith(fileName)) {
-        foundimage = image;
-        }
-    }
-
-    return foundimage;
+        ImageEntry foundimage = null;
+
+        for (int index = 0; index < this.images.size() && null == foundimage; index++) {
+            final ImageEntry image = this.images.get(index);
+            if (null == image.getWayPoint()
+                && image.getFileName().startsWith(fileName)) {
+            foundimage = image;
+            }
+        }
+
+        return foundimage;
     }
 
     private final void setCurrentImage(final ImageEntry imageEntry,
     final Image image) {
-    if (imageEntry == this.currentImageEntry) {
-        this.currentImage = image;
-    }
-
-    for (IImageChangeListener listener : this.listeners) {
-        listener.onSelectedImageEntryChanged(this);
-    }
+        if (imageEntry == this.currentImageEntry) {
+            this.currentImage = image;
+        }
+
+        for (IImageChangeListener listener : this.listeners) {
+            listener.onSelectedImageEntryChanged(this);
+        }
     }
 
     public final ImageEntry[] getImages() {
-    return this.locatedImages.toArray(new ImageEntry[this.locatedImages.size()]);
+        return this.locatedImages.toArray(new ImageEntry[this.locatedImages.size()]);
     }
 
     public final ImageEntry getCurrentImageEntry() {
-    return this.currentImageEntry;
+        return this.currentImageEntry;
     }
 
     public final Image getCurrentImage() {
-    return this.currentImage;
+        return this.currentImage;
     }
 
     public final boolean hasNext() {
-    return null != this.currentImageEntry
+        return null != this.currentImageEntry
         && this.locatedImages.indexOf(this.currentImageEntry) < this.locatedImages.size() - 1;
     }
 
     public final boolean hasPrevious() {
-    return null != this.currentImageEntry
+        return null != this.currentImageEntry
         && this.locatedImages.indexOf(this.currentImageEntry) > 0;
     }
 
     public final void next() {
-    if (null != this.currentImageEntry
+        if (null != this.currentImageEntry
         && this.locatedImages.indexOf(this.currentImageEntry) < this.locatedImages.size() - 1) {
-        this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) + 1));
-    }
+            this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) + 1));
+        }
     }
 
     public final void previous() {
-    if (null != this.currentImageEntry
+        if (null != this.currentImageEntry
         && this.locatedImages.indexOf(this.currentImageEntry) > 0) {
-        this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) - 1));
-    }
+            this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) - 1));
+        }
     }
 
     public final void rotateCurrentImageLeft() {
-    if (null != this.currentImageEntry) {
-        this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()
-        .rotateLeft());
-    }
-
-    this.setCurrentImageEntry(this.currentImageEntry);
+        if (null != this.currentImageEntry) {
+            this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()
+            .rotateLeft());
+        }
+
+        this.setCurrentImageEntry(this.currentImageEntry);
     }
 
     public final void rotateCurrentImageRight() {
-    if (null != this.currentImageEntry) {
-        this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()
-        .rotateRight());
-    }
-
-    this.setCurrentImageEntry(this.currentImageEntry);
+        if (null != this.currentImageEntry) {
+            this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()
+            .rotateRight());
+        }
+
+        this.setCurrentImageEntry(this.currentImageEntry);
     }
 
     public final void setCurrentImageEntry(final ImageEntry imageEntry) {
-    if (null == imageEntry || this.locatedImages.contains(imageEntry)) {
-        if (null != this.currentImageEntry) {
-        this.currentImageEntry.flush();
-        }
-
-        this.currentImageEntry = imageEntry;
-        this.currentImage = null;
-
-        for (IImageChangeListener listener : this.listeners) {
-        listener.onSelectedImageEntryChanged(this);
-        }
-
-        // now try to get the image
-        this.currentImageEntry.requestImage(this.listener);
-    }
+        if (null == imageEntry || this.locatedImages.contains(imageEntry)) {
+            if (null != this.currentImageEntry)
+                this.currentImageEntry.flush();
+
+            this.currentImageEntry = imageEntry;
+            this.currentImage = null;
+
+            for (IImageChangeListener listener : this.listeners)
+                listener.onSelectedImageEntryChanged(this);
+
+            if(imageEntry != null) // now try to get the image
+                this.currentImageEntry.requestImage(this.listener);
+        }
     }
 }
Index: /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointLayer.java
===================================================================
--- /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointLayer.java	(revision 14121)
+++ /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointLayer.java	(revision 14122)
@@ -20,50 +20,50 @@
 public final class ImageWayPointLayer extends Layer {
     private static final class ImageWayPointMouseListener extends MouseAdapter {
-    private final ImageWayPointLayer layer;
+        private final ImageWayPointLayer layer;
 
-    public ImageWayPointMouseListener(final ImageWayPointLayer layer) {
-        this.layer = layer;
-    }
+        public ImageWayPointMouseListener(final ImageWayPointLayer layer) {
+            this.layer = layer;
+        }
 
-    @Override
-    public final void mouseClicked(final MouseEvent event) {
-        if (MouseEvent.BUTTON1 == event.getButton() && this.layer.visible) {
-        final ImageEntry[] images = ImageEntries.getInstance()
-            .getImages();
+        @Override
+        public final void mouseClicked(final MouseEvent event) {
+            if (MouseEvent.BUTTON1 == event.getButton() && this.layer.visible) {
+                final ImageEntry[] images = ImageEntries.getInstance()
+                    .getImages();
 
-        if (null != images) {
-            boolean found = false;
-            // Note: the images are checked in the *reverse* order to
-            // which they're painted - this means than an image which
-            // partly obscures another will match the click first
-            for (int index = images.length - 1; !found && index >= 0; index--) {
-            final Rectangle bounds = images[index].getBounds(Main.map.mapView);
-            if (null != bounds && bounds.contains(event.getPoint())) {
-                found = true;
-                ImageEntries.getInstance()
-                .setCurrentImageEntry(images[index]);
-            }
+                if (null != images) {
+                    boolean found = false;
+                    // Note: the images are checked in the *reverse* order to
+                    // which they're painted - this means than an image which
+                    // partly obscures another will match the click first
+                    for (int index = images.length - 1; !found && index >= 0; index--) {
+                        final Rectangle bounds = images[index].getBounds(Main.map.mapView);
+                        if (null != bounds && bounds.contains(event.getPoint())) {
+                            found = true;
+                            ImageEntries.getInstance()
+                            .setCurrentImageEntry(images[index]);
+                        }
+                    }
+                }
             }
         }
-        }
-    }
     }
 
     private static final class ImageChangeListener implements
-        IImageChangeListener {
-    private final ImageWayPointLayer layer;
+    IImageChangeListener {
+        private final ImageWayPointLayer layer;
 
-    public ImageChangeListener(final ImageWayPointLayer layer) {
-        this.layer = layer;
-    }
+        public ImageChangeListener(final ImageWayPointLayer layer) {
+            this.layer = layer;
+        }
 
-    public final void onAvailableImageEntriesChanged(
+        public final void onAvailableImageEntriesChanged(
         final ImageEntries entries) {
-        Main.map.repaint();
-    }
+            Main.map.repaint();
+        }
 
-    public final void onSelectedImageEntryChanged(final ImageEntries entries) {
-        Main.map.repaint();
-    }
+        public final void onSelectedImageEntryChanged(final ImageEntries entries) {
+            Main.map.repaint();
+        }
     }
 
@@ -72,96 +72,96 @@
 
     public ImageWayPointLayer() {
-    super(tr("Imported Images"));
+        super(tr("Imported Images"));
 
-    Main.main.addLayer(this);
+        Main.main.addLayer(this);
 
-    this.layerMouseListener = new ImageWayPointMouseListener(this);
-    Main.map.mapView.addMouseListener(this.layerMouseListener);
+        this.layerMouseListener = new ImageWayPointMouseListener(this);
+        Main.map.mapView.addMouseListener(this.layerMouseListener);
 
-    this.imageChangeListener = new ImageChangeListener(this);
-    ImageEntries.getInstance().addListener(this.imageChangeListener);
+        this.imageChangeListener = new ImageChangeListener(this);
+        ImageEntries.getInstance().addListener(this.imageChangeListener);
     }
 
     @Override
     public final Icon getIcon() {
-    return ImageProvider.get("dialogs/imagewaypoint");
+        return ImageProvider.get("dialogs/imagewaypoint");
     }
 
     @Override
     public final Object getInfoComponent() {
-    return null;
+        return null;
     }
 
     @Override
     public final Component[] getMenuEntries() {
-    return new Component[0];
+        return new Component[0];
     }
 
     @Override
     public final String getToolTipText() {
-    // TODO
-    return "";
+        // TODO
+        return "";
     }
 
     @Override
     public final boolean isMergable(final Layer other) {
-    // TODO
-    return false;
+        // TODO
+        return false;
     }
 
     @Override
     public final void mergeFrom(final Layer from) {
-    // TODO not supported yet
+        // TODO not supported yet
     }
 
     @Override
     public final void paint(final Graphics graphics, final MapView mapView) {
-    final ImageEntry[] images = ImageEntries.getInstance().getImages();
+        final ImageEntry[] images = ImageEntries.getInstance().getImages();
 
-    if (null != images) {
-        final ImageEntry currentImage = ImageEntries.getInstance()
-        .getCurrentImageEntry();
+        if (null != images) {
+            final ImageEntry currentImage = ImageEntries.getInstance()
+            .getCurrentImageEntry();
 
-        for (int index = 0; index < images.length; index++) {
-        final Rectangle bounds = images[index].getBounds(mapView);
-        if (null != bounds) {
-            if (images[index] == currentImage) {
-            ImageEntry.SELECTED_ICON.paintIcon(mapView,
-                graphics,
-                bounds.x,
-                bounds.y);
-            } else {
-            ImageEntry.ICON.paintIcon(mapView,
-                graphics,
-                bounds.x,
-                bounds.y);
+            for (int index = 0; index < images.length; index++) {
+                final Rectangle bounds = images[index].getBounds(mapView);
+                if (null != bounds) {
+                    if (images[index] == currentImage) {
+                    ImageEntry.SELECTED_ICON.paintIcon(mapView,
+                        graphics,
+                        bounds.x,
+                        bounds.y);
+                    } else {
+                    ImageEntry.ICON.paintIcon(mapView,
+                        graphics,
+                        bounds.x,
+                        bounds.y);
+                    }
+                }
             }
         }
-        }
-    }
     }
 
     @Override
     public final void visitBoundingBox(final BoundingXYVisitor visitor) {
-    final ImageEntry[] images = ImageEntries.getInstance().getImages();
+        final ImageEntry[] images = ImageEntries.getInstance().getImages();
 
-    if (null != images) {
-        for (int index = 0; index < images.length; index++) {
-        final ImageEntry imageEntry = images[index];
+        if (null != images) {
+            for (int index = 0; index < images.length; index++) {
+                final ImageEntry imageEntry = images[index];
 
-        if (null != imageEntry.getWayPoint()
-            && null != imageEntry.getWayPoint().eastNorth) {
-            visitor.visit(imageEntry.getWayPoint().eastNorth);
+                if (null != imageEntry.getWayPoint()
+                && null != imageEntry.getWayPoint().eastNorth) {
+                    visitor.visit(imageEntry.getWayPoint().eastNorth);
+                }
+            }
         }
-        }
-    }
     }
 
     @Override
     public final void destroy() {
-    super.destroy();
+        super.destroy();
 
-    Main.map.mapView.removeMouseListener(this.layerMouseListener);
-    ImageEntries.getInstance().removeListener(this.imageChangeListener);
+        Main.map.mapView.removeMouseListener(this.layerMouseListener);
+        ImageEntries.getInstance().removeListener(this.imageChangeListener);
     }
 }
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 14121)
+++ /applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java	(revision 14122)
@@ -22,72 +22,72 @@
 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 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)");
-    }
+        @Override
+        public final String getDescription() {
+            return tr("Image files (*.jpg, *.jpeg, *.png, *.gif)");
+        }
     }
 
     private static final class LoadImagesAction extends JosmAction {
-    private static final long serialVersionUID = 4480306223276347301L;
+        private static final long serialVersionUID = 4480306223276347301L;
 
-    private final ImageWayPointPlugin plugin;
+        private final ImageWayPointPlugin plugin;
 
-    public LoadImagesAction(final ImageWayPointPlugin plugin) {
-        super(tr("Open images with ImageWayPoint"),
-        "imagewaypoint-open",
-        tr("Load set of images as a new layer."),
-        null,
-        false);
+        public LoadImagesAction(final ImageWayPointPlugin plugin) {
+            super(tr("Open images with ImageWayPoint"),
+            "imagewaypoint-open",
+            tr("Load set of images as a new layer."),
+            null,
+            false);
 
-        this.plugin = plugin;
-    }
+            this.plugin = plugin;
+        }
 
-    public final void actionPerformed(final ActionEvent actionEvent) {
-        final JFileChooser fileChooser = new JFileChooser(Main.pref.get("tagimages.lastdirectory"));
-        fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
-        fileChooser.setMultiSelectionEnabled(true);
-        fileChooser.setAcceptAllFileFilterUsed(false);
-        fileChooser.setFileFilter(new ImageFileFilter());
+        public final void actionPerformed(final ActionEvent actionEvent) {
+            final JFileChooser fileChooser = new JFileChooser(Main.pref.get("tagimages.lastdirectory"));
+            fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
+            fileChooser.setMultiSelectionEnabled(true);
+            fileChooser.setAcceptAllFileFilterUsed(false);
+            fileChooser.setFileFilter(new ImageFileFilter());
 
-        fileChooser.showOpenDialog(Main.parent);
+            fileChooser.showOpenDialog(Main.parent);
 
-        final File[] selectedFiles = fileChooser.getSelectedFiles();
-        if (null != selectedFiles && 0 != selectedFiles.length) {
-        Main.pref.put("tagimages.lastdirectory",
-            fileChooser.getCurrentDirectory().getPath());
+            final File[] selectedFiles = fileChooser.getSelectedFiles();
+            if (null != selectedFiles && 0 != selectedFiles.length) {
+                Main.pref.put("tagimages.lastdirectory",
+                    fileChooser.getCurrentDirectory().getPath());
 
-        // recursively find all files
-        final List<File> allFiles = new ArrayList<File>();
-        this.plugin.addFiles(allFiles, selectedFiles);
+                // recursively find all files
+                final List<File> allFiles = new ArrayList<File>();
+                this.plugin.addFiles(allFiles, selectedFiles);
 
-        // add files to ImageEntries
-        ImageEntries.getInstance()
-            .add(allFiles.toArray(new File[allFiles.size()]));
+                // add files to ImageEntries
+                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;
-            }
+                // 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;
+                        }
+                    }
+                }
+                if (!foundImageWayPointLayer) {
+                    new ImageWayPointLayer();
+                }
             }
         }
-        if (!foundImageWayPointLayer) {
-            new ImageWayPointLayer();
-        }
-        }
-    }
     }
 
@@ -103,21 +103,20 @@
     public final void mapFrameInitialized(final MapFrame oldFrame,
     final MapFrame newFrame) {
-    if (newFrame != null) {
-        newFrame.addToggleDialog(ImageWayPointDialog.getInstance()
-        .getDisplayComponent());
-    } else {
-        ImageEntries.getInstance().setCurrentImageEntry(null);
-    }
+        if (newFrame != null) {
+            newFrame.addToggleDialog(ImageWayPointDialog.getInstance()
+            .getDisplayComponent());
+        } else {
+            ImageEntries.getInstance().setCurrentImageEntry(null);
+        }
     }
 
     private void addFiles(List<File> allFiles, File[] selectedFiles) {
-    for (int index = 0; index < selectedFiles.length; index++) {
-        final File selectedFile = selectedFiles[index];
-        if (selectedFile.isDirectory()) {
-        this.addFiles(allFiles, selectedFile.listFiles());
-        } else if (selectedFile.getName().toLowerCase().endsWith(".jpg")) {
-        allFiles.add(selectedFile);
+        for (int index = 0; index < selectedFiles.length; index++) {
+            final File selectedFile = selectedFiles[index];
+            if (selectedFile.isDirectory())
+              this.addFiles(allFiles, selectedFile.listFiles());
+            else if (selectedFile.getName().toLowerCase().endsWith(".jpg"))
+              allFiles.add(selectedFile);
         }
     }
-    }
 }
