Ignore:
Timestamp:
2016-06-16T23:10:09+02:00 (9 years ago)
Author:
donvip
Message:

fix warnings

Location:
applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java

    r30737 r32288  
    7575        this.locatedImages.clear();
    7676
    77         if (null != Main.map && null != Main.map.mapView) {
    78             final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers();
    79             final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]);
    80 
    81             for (int index = 0; index < layers.length; index++) {
    82                 if (layers[index] instanceof GpxLayer
    83                 && null != ((GpxLayer) layers[index]).data
    84                 && !((GpxLayer) layers[index]).data.fromServer) {
    85                     this.doAssociateLayer((GpxLayer) layers[index]);
    86                 }
    87             }
    88 
    89             for (IImageChangeListener listener : this.listeners) {
    90                 listener.onSelectedImageEntryChanged(this);
    91             }
     77        final Collection<Layer> layerCollection = Main.getLayerManager().getLayers();
     78        final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]);
     79
     80        for (int index = 0; index < layers.length; index++) {
     81            if (layers[index] instanceof GpxLayer
     82            && null != ((GpxLayer) layers[index]).data
     83            && !((GpxLayer) layers[index]).data.fromServer) {
     84                this.doAssociateLayer((GpxLayer) layers[index]);
     85            }
     86        }
     87
     88        for (IImageChangeListener listener : this.listeners) {
     89            listener.onSelectedImageEntryChanged(this);
    9290        }
    9391    }
  • applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java

    r32287 r32288  
    11package org.insignificant.josm.plugins.imagewaypoint;
    2 
    3 import static org.openstreetmap.josm.tools.I18n.tr;
    42
    53import java.io.File;
     
    97import java.util.Iterator;
    108import java.util.List;
    11 
    12 import javax.swing.filechooser.FileFilter;
    139
    1410import org.openstreetmap.josm.Main;
     
    2319
    2420public final class ImageWayPointPlugin extends org.openstreetmap.josm.plugins.Plugin {
    25     private static final class ImageFileFilter extends FileFilter {
    26         @Override
    27         public final boolean accept(final File file) {
    28             return file.isDirectory()
    29                 || file.getName().toLowerCase().endsWith(".jpg")
    30                 || file.getName().toLowerCase().endsWith(".jpeg")
    31                 || file.getName().toLowerCase().endsWith(".png")
    32                 || file.getName().toLowerCase().endsWith(".gif");
    33         }
    34 
    35         @Override
    36         public final String getDescription() {
    37             return tr("Image files (*.jpg, *.jpeg, *.png, *.gif)");
    38         }
    39     }
    40 
    4121    private final class ImageWaypointImporter extends FileImporter {
    4222
     
    6444
    6545                // add files to ImageEntries
    66                 ImageEntries.getInstance()
    67                     .add(allFiles.toArray(new File[allFiles.size()]));
     46                ImageEntries.getInstance().add(allFiles.toArray(new File[allFiles.size()]));
    6847
    6948                // check to see whether there's already an ImageWayPointLayer
    7049                boolean foundImageWayPointLayer = false;
    71                 if (null != Main.map && null != Main.map.mapView) {
    72                     final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers();
    73                     final Iterator<Layer> layerIterator = layerCollection.iterator();
    74                     while (layerIterator.hasNext() && !foundImageWayPointLayer) {
    75                         if (layerIterator.next() instanceof ImageWayPointLayer) {
    76                             foundImageWayPointLayer = true;
    77                         }
     50                final Collection<Layer> layerCollection = Main.getLayerManager().getLayers();
     51                final Iterator<Layer> layerIterator = layerCollection.iterator();
     52                while (layerIterator.hasNext() && !foundImageWayPointLayer) {
     53                    if (layerIterator.next() instanceof ImageWayPointLayer) {
     54                        foundImageWayPointLayer = true;
    7855                    }
    7956                }
Note: See TracChangeset for help on using the changeset viewer.