Last change
on this file since 10836 was 10407, checked in by Don-vip, 8 years ago |
sonar - squid:S2386 - Mutable fields should not be "public static"
|
-
Property svn:eol-style
set to
native
|
File size:
1.4 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.io;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.io.File;
|
---|
7 | import java.util.Iterator;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.actions.ExtensionFileFilter;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Dummy importer that adds the "All Formats"-Filter when opening files
|
---|
13 | */
|
---|
14 | public class AllFormatsImporter extends FileImporter {
|
---|
15 | /**
|
---|
16 | * Constructs a new {@code AllFormatsImporter}.
|
---|
17 | */
|
---|
18 | public AllFormatsImporter() {
|
---|
19 | super(new ExtensionFileFilter(getAllExtensions(), "", tr("All Formats")
|
---|
20 | + " (*.gpx *.osm *.nmea *.jpg ...)"));
|
---|
21 | }
|
---|
22 |
|
---|
23 | @Override
|
---|
24 | public boolean acceptFile(File pathname) {
|
---|
25 | return false;
|
---|
26 | }
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Builds list of all supported extensions by the registered FileImporters.
|
---|
30 | * @return String comma separated list of supported file extensions
|
---|
31 | */
|
---|
32 | private static String getAllExtensions() {
|
---|
33 | Iterator<FileImporter> imp = ExtensionFileFilter.getImporters().iterator();
|
---|
34 | StringBuilder ext = new StringBuilder();
|
---|
35 | while (imp.hasNext()) {
|
---|
36 | FileImporter fi = imp.next();
|
---|
37 | if (fi instanceof AllFormatsImporter) {
|
---|
38 | continue;
|
---|
39 | }
|
---|
40 | ext.append(fi.filter.getExtensions()).append(',');
|
---|
41 | }
|
---|
42 | // remove last comma
|
---|
43 | return ext.substring(0, ext.length()-1);
|
---|
44 | }
|
---|
45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.