Ignore:
Timestamp:
2014-10-18T23:07:52+02:00 (10 years ago)
Author:
donvip
Message:

[josm_plugins] fix Java 7 / unused code warnings

Location:
applications/editors/josm/plugins/NanoLog/src/nanolog
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/NanoLog/src/nanolog/Correlator.java

    r30701 r30737  
    11package nanolog;
    22
     3import static org.openstreetmap.josm.tools.I18n.tr;
     4
    35import java.text.ParseException;
    4 import java.util.*;
     6import java.util.ArrayList;
     7import java.util.Collections;
     8import java.util.List;
     9
    510import javax.swing.JOptionPane;
     11
    612import org.openstreetmap.josm.Main;
    713import org.openstreetmap.josm.data.coor.EastNorth;
    814import org.openstreetmap.josm.data.coor.LatLon;
    9 import org.openstreetmap.josm.data.gpx.*;
     15import org.openstreetmap.josm.data.gpx.GpxData;
     16import org.openstreetmap.josm.data.gpx.GpxTrack;
     17import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
     18import org.openstreetmap.josm.data.gpx.WayPoint;
    1019import org.openstreetmap.josm.tools.Geometry;
    11 import static org.openstreetmap.josm.tools.I18n.tr;
    1220import org.openstreetmap.josm.tools.date.PrimaryDateParser;
    1321
     
    2432     */
    2533    public static long crudeMatch( List<NanoLogEntry> entries, GpxData data ) {
    26         List<NanoLogEntry> sortedEntries = new ArrayList<NanoLogEntry>(entries);
     34        List<NanoLogEntry> sortedEntries = new ArrayList<>(entries);
    2735        PrimaryDateParser dateParser = new PrimaryDateParser();
    2836        Collections.sort(sortedEntries);
     
    7280     */
    7381    public static void correlate( List<NanoLogEntry> entries, GpxData data, long offset ) {
    74         List<NanoLogEntry> sortedEntries = new ArrayList<NanoLogEntry>(entries);
     82        List<NanoLogEntry> sortedEntries = new ArrayList<>(entries);
    7583        //int ret = 0;
    7684        PrimaryDateParser dateParser = new PrimaryDateParser();
  • applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogLayer.java

    r30701 r30737  
    11package nanolog;
    22
    3 import java.awt.*;
    4 import java.awt.event.*;
    5 import java.io.*;
     3import static org.openstreetmap.josm.tools.I18n.tr;
     4
     5import java.awt.Color;
     6import java.awt.Graphics2D;
     7import java.awt.Point;
     8import java.awt.event.ActionEvent;
     9import java.awt.event.MouseAdapter;
     10import java.awt.event.MouseEvent;
     11import java.io.BufferedReader;
     12import java.io.File;
     13import java.io.FileInputStream;
     14import java.io.IOException;
     15import java.io.InputStreamReader;
    616import java.text.ParseException;
    717import java.text.SimpleDateFormat;
    8 import java.util.*;
     18import java.util.ArrayList;
     19import java.util.Collections;
     20import java.util.Date;
     21import java.util.HashSet;
    922import java.util.List;
    10 import java.util.regex.*;
    11 import javax.swing.*;
     23import java.util.Set;
     24import java.util.regex.Matcher;
     25import java.util.regex.Pattern;
     26
     27import javax.swing.Action;
     28import javax.swing.Icon;
     29import javax.swing.JOptionPane;
     30
    1231import org.openstreetmap.josm.Main;
    13 import org.openstreetmap.josm.actions.*;
     32import org.openstreetmap.josm.actions.JosmAction;
     33import org.openstreetmap.josm.actions.RenameLayerAction;
    1434import org.openstreetmap.josm.data.Bounds;
    1535import org.openstreetmap.josm.data.coor.EastNorth;
     
    1838import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    1939import org.openstreetmap.josm.gui.MapView;
    20 import org.openstreetmap.josm.gui.dialogs.*;
    21 import org.openstreetmap.josm.gui.layer.*;
    22 import static org.openstreetmap.josm.tools.I18n.tr;
     40import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     41import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
     42import org.openstreetmap.josm.gui.layer.GpxLayer;
     43import org.openstreetmap.josm.gui.layer.JumpToMarkerActions;
     44import org.openstreetmap.josm.gui.layer.Layer;
    2345import org.openstreetmap.josm.tools.ImageProvider;
    2446
     
    3254    private List<NanoLogEntry> log;
    3355    private int selectedEntry;
    34     private final Set<NanoLogLayerListener> listeners = new HashSet<NanoLogLayerListener>();
     56    private final Set<NanoLogLayerListener> listeners = new HashSet<>();
    3557    private NLLMouseAdapter mouseListener;
    36    
     58
    3759    public NanoLogLayer( List<NanoLogEntry> entries ) {
    3860        super(tr("NanoLog"));
    39         log = new ArrayList<NanoLogEntry>(entries);
     61        log = new ArrayList<>(entries);
    4062        selectedEntry = -1;
    4163        mouseListener = new NLLMouseAdapter();
     
    5072        super.destroy();
    5173    }
    52    
     74
    5375    public NanoLogLayer( File file ) throws IOException {
    5476        this(readNanoLog(file));
     
    7698        return Collections.unmodifiableList(log);
    7799    }
    78    
     100
    79101    public static List<NanoLogEntry> readNanoLog( File file ) throws IOException {
    80102        final Pattern NANOLOG_LINE = Pattern.compile("(.+?)\\t(.+?)(?:\\s*\\{\\{(-?\\d+\\.\\d+),\\s*(-?\\d+\\.\\d+)(?:,\\s*(\\d+))?\\}\\})?");
    81103        final SimpleDateFormat fmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SS");
    82         List<NanoLogEntry> result = new ArrayList<NanoLogEntry>();
     104        List<NanoLogEntry> result = new ArrayList<>();
    83105        BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8"));
    84106        while( r.ready() ) {
     
    301323        Main.map.mapView.repaint();
    302324    }
    303    
     325
    304326    private class CorrelateEntries extends JosmAction {
    305327        private boolean toZero;
     
    328350        }
    329351    }
    330    
     352
    331353    private class SaveLayer extends JosmAction {
    332354
  • applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogPanel.java

    r30701 r30737  
    2020/**
    2121 * NanoLog Panel. Displays the selected log item, along with surrounding 30-50 lines.
    22  * 
     22 *
    2323 * @author zverik
    2424 */
     
    2626    private JList<String> logPanel;
    2727    private LogListModel listModel;
    28    
     28
    2929    public NanoLogPanel() {
    3030        super(tr("NanoLog"), "nanolog", tr("Open NanoLog panel"), null, 150, false);
    31        
     31
    3232        listModel = new LogListModel();
    33         logPanel = new JList<String>(listModel);
     33        logPanel = new JList<>(listModel);
    3434        createLayout(logPanel, true, null);
    3535    }
    3636
    3737    public void updateMarkers() {
    38         List<NanoLogEntry> entries = new ArrayList<NanoLogEntry>();
     38        List<NanoLogEntry> entries = new ArrayList<>();
    3939        for( NanoLogLayer l : Main.map.mapView.getLayersOfType(NanoLogLayer.class) ) {
    4040            entries.addAll(l.getEntries());
     
    7474        }
    7575    }
    76    
     76
    7777    private class LogListModel extends AbstractListModel<String> {
    7878        private List<NanoLogEntry> entries;
    7979        private final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss");
    8080
    81         public int getSize() {
     81        @Override
     82                public int getSize() {
    8283            return entries.size();
    8384        }
    8485
    85         public String getElementAt( int index ) {
     86        @Override
     87                public String getElementAt( int index ) {
    8688            return TIME_FORMAT.format(entries.get(index).getTime()) + " " + entries.get(index).getMessage();
    8789        }
Note: See TracChangeset for help on using the changeset viewer.