source: josm/trunk/src/org/openstreetmap/josm/actions/SaveAction.java@ 2017

Last change on this file since 2017 was 2017, checked in by Gubaer, 15 years ago

removed OptionPaneUtil
cleanup of deprecated Layer API
cleanup of deprecated APIs in OsmPrimitive and Way
cleanup of imports

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.actions;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.KeyEvent;
7import java.io.File;
8
9import org.openstreetmap.josm.Main;
10import org.openstreetmap.josm.gui.ExtendedDialog;
11import org.openstreetmap.josm.gui.layer.GpxLayer;
12import org.openstreetmap.josm.gui.layer.Layer;
13import org.openstreetmap.josm.tools.Shortcut;
14
15/**
16 * Export the data as an OSM xml file.
17 *
18 * @author imi
19 */
20public class SaveAction extends SaveActionBase {
21
22 /**
23 * Construct the action with "Save" as label.
24 * @param layer Save this layer.
25 */
26 public SaveAction() {
27 super(tr("Save"), "save", tr("Save the current data."),
28 Shortcut.registerShortcut("system:save", tr("File: {0}", tr("Save")), KeyEvent.VK_S, Shortcut.GROUP_MENU));
29 }
30
31 @Override public File getFile(Layer layer) {
32 File f = layer.getAssociatedFile();
33 if(f != null && ! f.exists()) {
34 f=null;
35 }
36 if(f != null && layer instanceof GpxLayer && 1 !=
37 new ExtendedDialog(Main.parent, tr("Overwrite"),
38 tr("File {0} exists. Overwrite?", f.getName()),
39 new String[] {tr("Overwrite"), tr("Cancel")},
40 new String[] {"save_as.png", "cancel.png"}).getValue()) {
41 f = null;
42 }
43 return f == null ? openFileDialog(layer) : f;
44 }
45}
Note: See TracBrowser for help on using the repository browser.