1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.io.session;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.io.File;
|
---|
7 | import java.io.IOException;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.Main;
|
---|
10 | import org.openstreetmap.josm.actions.ExtensionFileFilter;
|
---|
11 | import org.openstreetmap.josm.actions.SessionLoadAction.Loader;
|
---|
12 | import org.openstreetmap.josm.gui.progress.ProgressMonitor;
|
---|
13 | import org.openstreetmap.josm.io.FileImporter;
|
---|
14 | import org.openstreetmap.josm.io.IllegalDataException;
|
---|
15 | import org.openstreetmap.josm.tools.Utils;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * File importer allowing to import session files (*.jos/joz files).
|
---|
19 | * @since 6245
|
---|
20 | */
|
---|
21 | public class SessionImporter extends FileImporter {
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The file filter used to load JOSM session files
|
---|
25 | */
|
---|
26 | public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter(
|
---|
27 | "jos,joz", "jos", tr("Session file (*.jos, *.joz)"));
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Constructs a new {@code SessionImporter}.
|
---|
31 | */
|
---|
32 | public SessionImporter() {
|
---|
33 | super(FILE_FILTER);
|
---|
34 | }
|
---|
35 |
|
---|
36 | @Override
|
---|
37 | public void importData(File file, ProgressMonitor progressMonitor) throws IOException, IllegalDataException {
|
---|
38 | boolean zip = Utils.hasExtension(file, "joz");
|
---|
39 | Main.worker.submit(new Loader(file, zip));
|
---|
40 | }
|
---|
41 | }
|
---|