Index: applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
===================================================================
--- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java	(revision 14121)
+++ applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java	(revision 15707)
@@ -25,8 +25,7 @@
 import javax.swing.JOptionPane;
 import javax.swing.JSeparator;
-import javax.swing.filechooser.FileFilter;
 
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.actions.ExtensionFileFilter;
+import org.openstreetmap.josm.actions.DiskAccessAction;
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
 import org.openstreetmap.josm.data.projection.Lambert;
@@ -46,5 +45,5 @@
 public class WMSLayer extends Layer {
 
-    Component[] component = null;  
+    Component[] component = null;
 
     public int lambertZone = -1;
@@ -54,23 +53,23 @@
 
     protected ArrayList<GeorefImage> images = new ArrayList<GeorefImage>();
-    
+
     protected final int serializeFormatVersion = 2;
-    
+
     private ArrayList<EastNorthBound> dividedBbox = new ArrayList<EastNorthBound>();
-    
+
     private CacheControl cacheControl = null;
-    
+
     private String location = "";
 
     private String codeCommune = "";
-    
+
     private EastNorthBound communeBBox = new EastNorthBound(new EastNorth(0,0), new EastNorth(0,0));
-    
+
     private boolean isRaster = false;
-    
+
     private EastNorth rasterMin;
-    
+
     private EastNorth rasterCenter;
-    
+
     private double rasterRatio;
 
@@ -81,5 +80,5 @@
         this(tr("Blank Layer"), "", -1);
     }
-    
+
     public WMSLayer(String location, String codeCommune, int lambertZone) {
         super(buildName(location, codeCommune));
@@ -90,5 +89,5 @@
         CadastrePlugin.pluginUsed = true;
     }
-    
+
     private static String buildName(String location, String codeCommune) {
         String ret = new String(location.toUpperCase());
@@ -138,5 +137,5 @@
 
     /**
-     * 
+     *
      * @param b      the original bbox, usually the current bbox on screen
      * @param factor 1 = source bbox 1:1
@@ -202,5 +201,5 @@
     public void paint(Graphics g, final MapView mv) {
         for (GeorefImage img : images)
-            img.paint((Graphics2D) g, mv, CadastrePlugin.backgroundTransparent, 
+            img.paint((Graphics2D) g, mv, CadastrePlugin.backgroundTransparent,
                     CadastrePlugin.transparency, CadastrePlugin.drawBoundaries);
     }
@@ -244,7 +243,7 @@
         return null;
     }
-    
+
     public boolean isOverlapping(Bounds bounds) {
-        GeorefImage georefImage = 
+        GeorefImage georefImage =
             new GeorefImage(new BufferedImage(1,1,BufferedImage.TYPE_INT_RGB ), // not really important
             Main.proj.latlon2eastNorth(bounds.min),
@@ -262,5 +261,5 @@
         }
     }
-    
+
     public void saveNewCache() {
         if (CacheControl.cacheEnabled) {
@@ -270,5 +269,5 @@
         }
     }
-    
+
     public CacheControl getCacheControl() {
         if (cacheControl == null)
@@ -276,5 +275,5 @@
         return cacheControl;
     }
-    
+
     public class SaveWmsAction extends AbstractAction {
         private static final long serialVersionUID = 1L;
@@ -285,5 +284,6 @@
 
         public void actionPerformed(ActionEvent ev) {
-            File f = openFileDialog(false);
+            File f = DiskAccessAction.createAndOpenSaveFileChooser(
+            tr("Save WMS layer"), ".wms");
             try {
                 FileOutputStream fos = new FileOutputStream(f);
@@ -311,7 +311,9 @@
 
         public void actionPerformed(ActionEvent ev) {
-            File f = openFileDialog(true);
-            if (f == null)
-                return;
+            JFileChooser fc = DiskAccessAction.createAndOpenFileChooser(true,
+            false, tr("Load WMS layer"));
+            if(fc == null) return;
+            File f = fc.getSelectedFile();
+            if (f == null) return;
             try {
                 FileInputStream fis = new FileInputStream(f);
@@ -342,51 +344,4 @@
     }
 
-    protected static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple) {
-        String curDir = Main.pref.get("lastDirectory");
-        if (curDir.equals(""))
-            curDir = ".";
-        JFileChooser fc = new JFileChooser(new File(curDir));
-        fc.setMultiSelectionEnabled(multiple);
-        for (int i = 0; i < ExtensionFileFilter.filters.length; ++i)
-            fc.addChoosableFileFilter(ExtensionFileFilter.filters[i]);
-        fc.setAcceptAllFileFilterUsed(true);
-
-        int answer = open ? fc.showOpenDialog(Main.parent) : fc.showSaveDialog(Main.parent);
-        if (answer != JFileChooser.APPROVE_OPTION)
-            return null;
-
-        if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir))
-            Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());
-
-        if (!open) {
-            File file = fc.getSelectedFile();
-            if (file == null
-                    || (file.exists() && JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog(Main.parent,
-                            tr("File exists. Overwrite?"), tr("Overwrite"), JOptionPane.YES_NO_OPTION)))
-                return null;
-        }
-
-        return fc;
-    }
-
-    public static File openFileDialog(boolean open) {
-        JFileChooser fc = createAndOpenFileChooser(open, false);
-        if (fc == null)
-            return null;
-
-        File file = fc.getSelectedFile();
-
-        String fn = file.getPath();
-        if (fn.indexOf('.') == -1) {
-            FileFilter ff = fc.getFileFilter();
-            if (ff instanceof ExtensionFileFilter)
-                fn = "." + ((ExtensionFileFilter) ff).defaultExtension;
-            else
-                fn += ".osm";
-            file = new File(fn);
-        }
-        return file;
-    }
-
     /**
      * Convert the eastNorth input coordinates to raster coordinates.
@@ -434,5 +389,5 @@
     /**
      * Set the eastNorth position in rasterMin which is the 0,0 coordinate (bottom left corner).
-     * The bounds width is the raster width and height is calculate on a fixed image ratio. 
+     * The bounds width is the raster width and height is calculate on a fixed image ratio.
      * @param bounds
      */
@@ -470,5 +425,5 @@
             img.resize(rasterCenter, proportion);
     }
-    
+
     public void rotate(double angle) {
         this.rasterMin = rasterMin.rotate(rasterCenter, angle);
@@ -476,5 +431,5 @@
             img.rotate(rasterCenter, angle);
     }
-    
+
     /**
      * Repaint the LayerList dialog.
@@ -491,5 +446,5 @@
         }
     }
-    
+
     /**
      * Called by CacheControl when a new cache file is created on disk
@@ -503,5 +458,5 @@
         oos.writeInt(this.lambertZone);
         oos.writeBoolean(this.isRaster);
-        if (this.isRaster) { 
+        if (this.isRaster) {
             oos.writeObject(this.rasterMin);
             oos.writeObject(this.rasterCenter);
@@ -514,5 +469,5 @@
         }
     }
-    
+
     /**
      * Called by CacheControl when a cache file is read from disk
@@ -532,5 +487,5 @@
         this.lambertZone = ois.readInt();
         this.isRaster = ois.readBoolean();
-        if (this.isRaster) { 
+        if (this.isRaster) {
             this.rasterMin = (EastNorth) ois.readObject();
             this.rasterCenter = (EastNorth) ois.readObject();
