Last change
on this file since 693 was 693, checked in by stoecker, 16 years ago |
Save dialog now distinguish between OSM and GPX. Saving OSM layer as GPX is still possible. Closes #836
|
-
Property svn:eol-style
set to
native
|
File size:
1.1 KB
|
Line | |
---|
1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.actions;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.awt.event.InputEvent;
|
---|
7 | import java.awt.event.KeyEvent;
|
---|
8 | import java.io.File;
|
---|
9 |
|
---|
10 | import org.openstreetmap.josm.gui.layer.Layer;
|
---|
11 | import org.openstreetmap.josm.gui.layer.GpxLayer;
|
---|
12 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Export the data as an OSM xml file.
|
---|
16 | *
|
---|
17 | * @author imi
|
---|
18 | */
|
---|
19 | public 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."), KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK, layer);
|
---|
27 | }
|
---|
28 |
|
---|
29 | @Override public File getFile(Layer layer) {
|
---|
30 | if (layer instanceof OsmDataLayer) {
|
---|
31 | File f = ((OsmDataLayer)layer).associatedFile;
|
---|
32 | if (f != null) {
|
---|
33 | return f;
|
---|
34 | }
|
---|
35 | }
|
---|
36 | if (layer instanceof GpxLayer) {
|
---|
37 | File f = ((GpxLayer)layer).data.storageFile;
|
---|
38 | if (f != null) {
|
---|
39 | return f;
|
---|
40 | }
|
---|
41 | }
|
---|
42 | return openFileDialog(layer);
|
---|
43 | }
|
---|
44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.