Changeset 15707 in osm for applications/editors/josm/plugins/wmsplugin
- Timestamp:
- 2009-06-06T22:25:31+02:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/wmsplugin
- Files:
-
- 3 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/build.xml
r15185 r15707 29 29 <attribute name="Plugin-Description" value="Display georeferenced images as background in JOSM (WMS servers, Yahoo, ...)."/> 30 30 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/WMSPlugin"/> 31 <attribute name="Plugin-Mainversion" value="16 10"/>31 <attribute name="Plugin-Mainversion" value="1646"/> 32 32 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 33 33 <attribute name="de_Plugin-Link" value="http://wiki.openstreetmap.org/wiki/DE:JOSM/Plugins/WMSPlugin"/> -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java
r15185 r15707 85 85 if (urlWithPatterns) { 86 86 String proj = Main.proj.toCode(); 87 if( proj.equals("EPSG:3785")) // don't use mercator code87 if(Main.proj instanceof org.openstreetmap.josm.data.projection.Mercator) // don't use mercator code directly 88 88 proj = "EPSG:4326"; 89 89 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
r15185 r15707 23 23 import javax.swing.JOptionPane; 24 24 import javax.swing.JSeparator; 25 import javax.swing.filechooser.FileFilter;26 25 27 26 import org.openstreetmap.josm.Main; 28 import org.openstreetmap.josm.actions. ExtensionFileFilter;27 import org.openstreetmap.josm.actions.DiskAccessAction; 29 28 import org.openstreetmap.josm.data.Bounds; 30 29 import org.openstreetmap.josm.data.coor.EastNorth; … … 295 294 } 296 295 public void actionPerformed(ActionEvent ev) { 297 File f = openFileDialog(false); 296 File f = DiskAccessAction.createAndOpenSaveFileChooser( 297 tr("Save WMS layer"), ".wms"); 298 298 try 299 299 { … … 322 322 } 323 323 public void actionPerformed(ActionEvent ev) { 324 File f = openFileDialog(true); 324 JFileChooser fc = DiskAccessAction.createAndOpenFileChooser(true, 325 false, tr("Load WMS layer")); 326 if(fc == null) return; 327 File f = fc.getSelectedFile(); 325 328 if (f == null) return; 326 329 try … … 359 362 } 360 363 } 361 362 protected static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple) {363 String curDir = Main.pref.get("lastDirectory");364 if (curDir.equals(""))365 curDir = ".";366 JFileChooser fc = new JFileChooser(new File(curDir));367 fc.setMultiSelectionEnabled(multiple);368 for (int i = 0; i < ExtensionFileFilter.filters.length; ++i)369 fc.addChoosableFileFilter(ExtensionFileFilter.filters[i]);370 fc.setAcceptAllFileFilterUsed(true);371 372 int answer = open ? fc.showOpenDialog(Main.parent) : fc.showSaveDialog(Main.parent);373 if (answer != JFileChooser.APPROVE_OPTION)374 return null;375 376 if (!fc.getCurrentDirectory().getAbsolutePath().equals(curDir))377 Main.pref.put("lastDirectory", fc.getCurrentDirectory().getAbsolutePath());378 379 if (!open) {380 File file = fc.getSelectedFile();381 if (file == null || (file.exists() && JOptionPane.YES_OPTION !=382 JOptionPane.showConfirmDialog(Main.parent, tr("File exists. Overwrite?"), tr("Overwrite"), JOptionPane.YES_NO_OPTION)))383 return null;384 }385 386 return fc;387 }388 389 public static File openFileDialog(boolean open) {390 JFileChooser fc = createAndOpenFileChooser(open, false);391 if (fc == null)392 return null;393 394 File file = fc.getSelectedFile();395 396 String fn = file.getPath();397 if (fn.indexOf('.') == -1) {398 FileFilter ff = fc.getFileFilter();399 if (ff instanceof ExtensionFileFilter)400 fn = "." + ((ExtensionFileFilter)ff).defaultExtension;401 else402 fn += ".osm";403 file = new File(fn);404 }405 return file;406 }407 364 }
Note:
See TracChangeset
for help on using the changeset viewer.