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

Last change on this file since 1180 was 1169, checked in by stoecker, 15 years ago

removed usage of tab stops

  • Property svn:eol-style set to native
File size: 1.3 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.gui.layer.Layer;
10import org.openstreetmap.josm.gui.layer.GpxLayer;
11import org.openstreetmap.josm.gui.layer.OsmDataLayer;
12import org.openstreetmap.josm.tools.Shortcut;
13
14/**
15 * Export the data as an OSM xml file.
16 *
17 * @author imi
18 */
19public class SaveAction extends SaveActionBase {
20
21 /**
22 * Construct the action with "Save" as label.
23 * @param layer Save this layer.
24 */
25 public SaveAction(Layer layer) {
26 super(tr("Save"), "save", tr("Save the current data."),
27 Shortcut.registerShortcut("system:save", tr("File: {0}", tr("Save")), KeyEvent.VK_S, Shortcut.GROUP_MENU), layer);
28 }
29
30 @Override public File getFile(Layer layer) {
31 if (layer instanceof OsmDataLayer) {
32 File f = ((OsmDataLayer)layer).associatedFile;
33 if (f != null) {
34 return f;
35 }
36 }
37 if (layer instanceof GpxLayer) {
38 File f = ((GpxLayer)layer).data.storageFile;
39 if (f != null) {
40 return f;
41 }
42 }
43 return openFileDialog(layer);
44 }
45}
Note: See TracBrowser for help on using the repository browser.