Ignore:
Timestamp:
2016-06-16T20:07:17+02:00 (3 years ago)
Author:
Don-vip
Message:

sonar - squid:S2386 - Mutable fields should not be "public static"

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java

    r10386 r10407  
    3434     * @since 4869
    3535     */
    36     public static final ArrayList<FileImporter> importers;
     36    private static final ArrayList<FileImporter> importers;
    3737
    3838    /**
     
    4040     * @since 4869
    4141     */
    42     public static final ArrayList<FileExporter> exporters;
     42    private static final ArrayList<FileExporter> exporters;
    4343
    4444    // add some file types only if the relevant classes are there.
     
    140140
    141141    /**
     142     * Adds a new file importer at the end of the global list. This importer will be evaluated after core ones.
     143     * @param importer new file importer
     144     * @since 10407
     145     */
     146    public static void addImporter(FileImporter importer) {
     147        if (importer != null) {
     148            importers.add(importer);
     149        }
     150    }
     151
     152    /**
     153     * Adds a new file importer at the beginning of the global list. This importer will be evaluated before core ones.
     154     * @param importer new file importer
     155     * @since 10407
     156     */
     157    public static void addImporterFirst(FileImporter importer) {
     158        if (importer != null) {
     159            importers.add(0, importer);
     160        }
     161    }
     162
     163    /**
     164     * Adds a new file exporter at the end of the global list. This exporter will be evaluated after core ones.
     165     * @param exporter new file exporter
     166     * @since 10407
     167     */
     168    public static void addExporter(FileExporter exporter) {
     169        if (exporter != null) {
     170            exporters.add(exporter);
     171        }
     172    }
     173
     174    /**
     175     * Adds a new file exporter at the beginning of the global list. This exporter will be evaluated before core ones.
     176     * @param exporter new file exporter
     177     * @since 10407
     178     */
     179    public static void addExporterFirst(FileExporter exporter) {
     180        if (exporter != null) {
     181            exporters.add(0, exporter);
     182        }
     183    }
     184
     185    /**
     186     * Returns the list of file importers.
     187     * @return unmodifiable list of file importers
     188     * @since 10407
     189     */
     190    public static List<FileImporter> getImporters() {
     191        return Collections.unmodifiableList(importers);
     192    }
     193
     194    /**
     195     * Returns the list of file exporters.
     196     * @return unmodifiable list of file exporters
     197     * @since 10407
     198     */
     199    public static List<FileExporter> getExporters() {
     200        return Collections.unmodifiableList(exporters);
     201    }
     202
     203    /**
    142204     * Updates the {@link AllFormatsImporter} that is contained in the importers list. If
    143205     * you do not use the importers variable directly, you don’t need to call this.
  • trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java

    r10318 r10407  
    8585            return;
    8686
    87         for (FileExporter exporter : ExtensionFileFilter.exporters) {
     87        for (FileExporter exporter : ExtensionFileFilter.getExporters()) {
    8888            if (exporter.acceptFile(file, layer)) {
    8989                try {
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r10242 r10407  
    238238            FileImporter chosenImporter = null;
    239239            if (fileFilter != null) {
    240                 for (FileImporter importer : ExtensionFileFilter.importers) {
     240                for (FileImporter importer : ExtensionFileFilter.getImporters()) {
    241241                    if (fileFilter.equals(importer.filter)) {
    242242                        chosenImporter = importer;
     
    291291                List<File> urlFiles = new LinkedList<>();
    292292                FILES: for (File f : files) {
    293                     for (FileImporter importer : ExtensionFileFilter.importers) {
     293                    for (FileImporter importer : ExtensionFileFilter.getImporters()) {
    294294                        if (importer.acceptFile(f)) {
    295295                            importerMap.put(importer, f);
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r10318 r10407  
    9393            boolean exported = false;
    9494            boolean canceled = false;
    95             for (FileExporter exporter : ExtensionFileFilter.exporters) {
     95            for (FileExporter exporter : ExtensionFileFilter.getExporters()) {
    9696                if (exporter.acceptFile(file, layer)) {
    9797                    exporter.exportData(file, layer);
Note: See TracChangeset for help on using the changeset viewer.