Index: applications/editors/josm/plugins/agpifoj/build.xml
===================================================================
--- applications/editors/josm/plugins/agpifoj/build.xml	(revision 16782)
+++ applications/editors/josm/plugins/agpifoj/build.xml	(revision 16784)
@@ -34,5 +34,5 @@
                 <attribute name="Plugin-Early" value="false"/>
                 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/AgPifoJ"/>
-                <attribute name="Plugin-Mainversion" value="1815"/>
+                <attribute name="Plugin-Mainversion" value="1893"/>
                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
             </manifest>
Index: applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java
===================================================================
--- applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java	(revision 16782)
+++ applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java	(revision 16784)
@@ -121,5 +121,7 @@
             if (cancelled) {
                 return;
-            }
+            }            
+            progressMonitor.subTask(tr("Read photos..."));
+            progressMonitor.setTicksCount(files.size());
 
             progressMonitor.subTask(tr("Read photos..."));
@@ -154,5 +156,7 @@
             layer = new AgpifojLayer(data);
             files.clear();
-            progressMonitor.setErrorMessage(errorMessage);
+            if (errorMessage != null && ! errorMessage.trim().equals("")) {
+            	progressMonitor.setErrorMessage(errorMessage);
+            }
         }
 
@@ -194,4 +198,5 @@
                             errorMessage += tr("Found null file in directory {0}\n", f.getPath());
                         }
+                        progressMonitor.finishTask();
                     } else {
                     	errorMessage += tr("Error while getting files from directory {0}\n", f.getPath());
@@ -264,6 +269,6 @@
 
         return new Component[] {
-                new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
-                new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
+                new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this)),
+                new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this)),
                 new JMenuItem(new RenameLayerAction(null, this)),
                 new JSeparator(),
@@ -323,5 +328,5 @@
         }
 
-        name = l.name;
+        setName(l.getName());
 
     }
@@ -471,5 +476,5 @@
                     return;
                 }
-                if (visible)
+                if (isVisible())
                     Main.map.mapView.repaint();
             }
@@ -479,5 +484,5 @@
                     return;
                 }
-                if (!visible) {
+                if (!isVisible()) {
                     return;
                 }
Index: applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojPlugin.java
===================================================================
--- applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojPlugin.java	(revision 16782)
+++ applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojPlugin.java	(revision 16784)
@@ -82,4 +82,5 @@
      * an alternative Painter.
      */
+    @Override
     public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
         if (newFrame != null) {
Index: applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java
===================================================================
--- applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java	(revision 16782)
+++ applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java	(revision 16784)
@@ -59,4 +59,5 @@
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
 import org.openstreetmap.josm.gui.ExtendedDialog;
+import org.openstreetmap.josm.gui.OptionPaneUtil;
 import org.openstreetmap.josm.gui.layer.GpxLayer;
 import org.openstreetmap.josm.gui.layer.Layer;
@@ -147,6 +148,10 @@
                             cbGpx.setSelectedIndex(i);
                             if (!sel.getName().equals(wrapper.name)) {
-                                JOptionPane.showMessageDialog(Main.parent,
-                                        tr("File {0} is loaded yet under the name \"{1}\"", sel.getName(), wrapper.name));
+                                OptionPaneUtil.showMessageDialog(
+                                		Main.parent,
+                                        tr("File {0} is loaded yet under the name \"{1}\"", sel.getName(), wrapper.name),
+                                        tr("Error"),
+                                        JOptionPane.ERROR_MESSAGE
+                                        );
                             }
                             return;
@@ -167,9 +172,19 @@
                 } catch (SAXException x) {
                     x.printStackTrace();
-                    JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing {0}",sel.getName())+": "+x.getMessage());
+                    OptionPaneUtil.showMessageDialog(
+                    		Main.parent, 
+                    		tr("Error while parsing {0}",sel.getName())+": "+x.getMessage(),
+                    		tr("Error"),
+                    		JOptionPane.ERROR_MESSAGE
+                    		);
                     return;
                 } catch (IOException x) {
                     x.printStackTrace();
-                    JOptionPane.showMessageDialog(Main.parent, tr("Could not read \"{0}\"",sel.getName())+"\n"+x.getMessage());
+                    OptionPaneUtil.showMessageDialog(
+                    		Main.parent, 
+                    		tr("Could not read \"{0}\"",sel.getName())+"\n"+x.getMessage(),
+                    		tr("Error"),
+                    		JOptionPane.ERROR_MESSAGE
+                    		);
                     return;
                 }
@@ -371,5 +386,10 @@
             boolean isOk = false;
             while (! isOk) {
-                int answer = JOptionPane.showConfirmDialog(Main.parent, panel, tr("Synchronize time from a photo of the GPS receiver"), JOptionPane.OK_CANCEL_OPTION);
+                int answer = OptionPaneUtil.showConfirmationDialog(
+                		Main.parent, panel, 
+                		tr("Synchronize time from a photo of the GPS receiver"), 
+                		JOptionPane.OK_CANCEL_OPTION,
+                		JOptionPane.QUESTION_MESSAGE
+                		);
                 if (answer == JOptionPane.CANCEL_OPTION) {
                     return;
@@ -382,5 +402,5 @@
                             - dateFormat.parse(tfGpsTime.getText()).getTime();
                 } catch(ParseException e) {
-                    JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing the date.\n"
+                    OptionPaneUtil.showMessageDialog(Main.parent, tr("Error while parsing the date.\n"
                             + "Please use the requested format"),
                             tr("Invalid date"), JOptionPane.ERROR_MESSAGE );
@@ -415,5 +435,5 @@
             Layer cur = iterLayer.next();
             if (cur instanceof GpxLayer) {
-                gpxLst.add(new GpxDataWrapper(((GpxLayer) cur).name,
+                gpxLst.add(new GpxDataWrapper(((GpxLayer) cur).getName(),
                                               ((GpxLayer) cur).data,
                                               ((GpxLayer) cur).data.storageFile));
@@ -566,5 +586,5 @@
 
             if (item == null || ! (item instanceof GpxDataWrapper)) {
-                JOptionPane.showMessageDialog(Main.parent, tr("You should select a GPX track"),
+                OptionPaneUtil.showMessageDialog(Main.parent, tr("You should select a GPX track"),
                                               tr("No selected GPX track"), JOptionPane.ERROR_MESSAGE );
                 continue;
@@ -579,5 +599,5 @@
             Float timezoneValue = parseTimezone(tfTimezone.getText().trim());
             if (timezoneValue == null) {
-                JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing timezone.\nExpected format: {0}", "+H:MM"),
+                OptionPaneUtil.showMessageDialog(Main.parent, tr("Error while parsing timezone.\nExpected format: {0}", "+H:MM"),
                         tr("Invalid timezone"), JOptionPane.ERROR_MESSAGE);
                 continue;
@@ -592,5 +612,5 @@
                     delta = Long.parseLong(deltaText);
                 } catch(NumberFormatException nfe) {
-                    JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing offset.\nExpected format: {0}", "number"),
+                    OptionPaneUtil.showMessageDialog(Main.parent, tr("Error while parsing offset.\nExpected format: {0}", "number"),
                             tr("Invalid offset"), JOptionPane.ERROR_MESSAGE);
                     continue;
@@ -671,5 +691,5 @@
         // no images found, exit
         if(autoImgs.size() <= 0) {
-            JOptionPane.showMessageDialog(Main.parent,
+            OptionPaneUtil.showMessageDialog(Main.parent,
                 tr("The selected photos don't contain time information."),
                 tr("Photos don't contain time information"), JOptionPane.WARNING_MESSAGE);
@@ -707,5 +727,5 @@
         // No GPX timestamps found, exit
         if(firstGPXDate < 0) {
-            JOptionPane.showMessageDialog(Main.parent,
+            OptionPaneUtil.showMessageDialog(Main.parent,
                 tr("The selected GPX track doesn't contain timestamps. Please select another one."),
                 tr("GPX Track has no time information"), JOptionPane.WARNING_MESSAGE);
@@ -804,5 +824,5 @@
         sldTimezone = new JSlider(-24, 24, 0);
         sldTimezone.setPaintLabels(true);
-        Hashtable labelTable = new Hashtable();
+        Hashtable<Integer,JLabel> labelTable = new Hashtable<Integer, JLabel>();
         labelTable.put(-24, new JLabel("-12:00"));
         labelTable.put(-12, new JLabel( "-6:00"));
@@ -844,5 +864,5 @@
             sldSeconds.setValue(offset%60);
         } catch(Exception e) {
-            JOptionPane.showMessageDialog(Main.parent,
+            OptionPaneUtil.showMessageDialog(Main.parent,
                 tr("An error occurred while trying to match the photos to the GPX track."
                     +" You can adjust the sliders to manually match the photos."),
