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

Last change on this file since 1047 was 1047, checked in by cbrill, 16 years ago

[Cleanup] Remove unused imports and unused variables, part 2

This cleanup does not include static imports for translation

  • Property svn:eol-style set to native
File size: 1.1 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: 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.