source: subversion/applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/actions/ExportSigsAction.java

Last change on this file was 32533, checked in by donvip, 3 years ago

checkstyle

File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.plugins.trustosm.actions;
3
4import static org.openstreetmap.josm.actions.SaveActionBase.createAndOpenSaveFileChooser;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9import java.io.File;
10import java.io.IOException;
11
12import org.openstreetmap.josm.actions.DiskAccessAction;
13import org.openstreetmap.josm.plugins.trustosm.io.SigExporter;
14import org.openstreetmap.josm.tools.Shortcut;
15
16public class ExportSigsAction extends DiskAccessAction {
17
18    public ExportSigsAction() {
19        super(tr("Export sigs..."), "exportsigs", tr("Export all signatures to XML file."),
20                Shortcut.registerShortcut("file:exportsigs", tr("Export sigs to XML..."), KeyEvent.VK_X, Shortcut.ALT_CTRL));
21    }
22
23    public ExportSigsAction(String name, String iconName, String tooltip, Shortcut shortcut) {
24        super(name, iconName, tooltip, shortcut);
25    }
26
27    @Override
28    public void actionPerformed(ActionEvent e) {
29        if (!isEnabled())
30            return;
31        doSave();
32    }
33
34    public boolean doSave() {
35        File f = createAndOpenSaveFileChooser(tr("Save Signatures file"), "tosm");
36        if (f == null)
37            return false;
38        SigExporter exporter = new SigExporter();
39        try {
40            exporter.exportData(f, null);
41        } catch (IOException e) {
42            e.printStackTrace();
43            return false;
44        }
45        return true;
46    }
47
48}
Note: See TracBrowser for help on using the repository browser.