Changeset 32848 in osm for applications/editors/josm


Ignore:
Timestamp:
2016-08-20T04:27:57+02:00 (8 years ago)
Author:
donvip
Message:

fix more warnings

Location:
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java

    r32846 r32848  
    1717import javax.swing.JScrollPane;
    1818import javax.swing.event.HyperlinkEvent;
    19 import javax.swing.event.HyperlinkListener;
    2019
    2120import org.openstreetmap.josm.Main;
     
    9392                        msgLabel.setEditable(false);
    9493                        msgLabel.setOpaque(false);
    95                         msgLabel.addHyperlinkListener(new HyperlinkListener() {
    96                             @Override
    97                             public void hyperlinkUpdate(HyperlinkEvent hle) {
    98                                 if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) {
    99                                     if (hle.getURL() == null || hle.getURL().toString().isEmpty()) {
    100                                         return;
    101                                     }
    102                                     System.out.println("URL: "+ hle.getURL());
    103                                     if (!hle.getURL().toString().startsWith("http")) {
    104                                         mRuian.performAction(hle.getURL().toString());
    105                                     } else {
    106                                         String ret = OpenBrowser.displayUrl(hle.getURL().toString());
    107                                         if (ret != null) {
    108                                             PointInfoUtils.showNotification(ret, "error");
    109                                         }
     94                        msgLabel.addHyperlinkListener(hle -> {
     95                            if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) {
     96                                if (hle.getURL() == null || hle.getURL().toString().isEmpty()) {
     97                                    return;
     98                                }
     99                                System.out.println("URL: "+ hle.getURL());
     100                                if (!hle.getURL().toString().startsWith("http")) {
     101                                    mRuian.performAction(hle.getURL().toString());
     102                                } else {
     103                                    String ret = OpenBrowser.displayUrl(hle.getURL().toString());
     104                                    if (ret != null) {
     105                                        PointInfoUtils.showNotification(ret, "error");
    110106                                    }
    111107                                }
     
    127123            new Thread(infoTask).start();
    128124        } catch (Exception e) {
    129             e.printStackTrace();
     125            Main.error(e);
    130126        }
    131127    }
  • applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/PointInfoPlugin.java

    r32845 r32848  
    1313public class PointInfoPlugin extends Plugin {
    1414
     15    /**
     16     * Constructs a new {@code PointInfoPlugin}.
     17     * @param info plugin information
     18     */
    1519    public PointInfoPlugin(PluginInformation info) {
    1620        super(info);
  • applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/PointInfoUtils.java

    r32846 r32848  
    99import org.openstreetmap.josm.gui.Notification;
    1010
    11 public abstract class PointInfoUtils {
     11public final class PointInfoUtils {
     12
     13    private PointInfoUtils() {
     14        // Hide default constructor for utilities classes
     15    }
    1216
    1317    /**
     
    1923        Notification note = new Notification(message);
    2024
    21         if (type.equals("info"))
     25        if ("info".equals(type))
    2226            note.setIcon(JOptionPane.INFORMATION_MESSAGE);
    23         else if (type.equals("warning"))
     27        else if ("warning".equals(type))
    2428            note.setIcon(JOptionPane.WARNING_MESSAGE);
    25         else if (type.equals("error"))
     29        else if ("error".equals(type))
    2630            note.setIcon(JOptionPane.ERROR_MESSAGE);
    2731        else
     
    4044    public static String formatCoordinates(double lat, double lon) {
    4145
    42         String r = "";
    4346        DecimalFormatSymbols symbols = new DecimalFormatSymbols();
    4447        symbols.setDecimalSeparator('.');
     
    4649        DecimalFormat df = new DecimalFormat("#.00000", symbols);
    4750
    48         r = "(" + df.format(lat) + ", " + df.format(lon) + ")";
    49         return r;
     51        return "(" + df.format(lat) + ", " + df.format(lon) + ")";
    5052    }
    5153}
  • applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ruian/AddrPlaces.java

    r32845 r32848  
    218218
    219219    public String getVzdalenost() {
    220         DecimalFormat df = new DecimalFormat("0.00");
    221         return df.format(m_vzdalenost) + "m";
     220        return new DecimalFormat("0.00").format(m_vzdalenost) + "m";
    222221    }
    223222}
  • applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ruian/RuianModule.java

    r32846 r32848  
    1414public class RuianModule {
    1515
    16     private String m_text = "";
    1716    private String URL = "http://josm.poloha.net/pointInfo/v4/index.php";
    1817
  • applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ruian/RuianRecord.java

    r32846 r32848  
    128128        m_katastr_kraj_kod = 0;
    129129        m_katastr_kraj = "";
    130 
    131130    }
    132131
    133132    /**
    134133     * Parse given JSON string and fill variables with RUIAN data
    135      *
     134     * @param jsonStr JSON string
    136135     */
    137136    public void parseJSON(String jsonStr) {
     
    663662
    664663        if (m_objekt_ruian_id == 0 &&
    665                 m_parcela_ruian_id == 0 &&
    666                 m_adresni_mista.size() == 0 &&
    667                 m_ulice_ruian_id == 0 &&
    668                 m_katastr_ruian_id == 0)
     664            m_parcela_ruian_id == 0 &&
     665            m_adresni_mista.size() == 0 &&
     666            m_ulice_ruian_id == 0 &&
     667            m_katastr_ruian_id == 0)
    669668            return "";
    670669
     
    769768
    770769        // Reported errors
    771         if (m_objekt_ruian_id > 0 && !m_err_user.equals("")) {
     770        if (m_objekt_ruian_id > 0 && !m_err_user.isEmpty()) {
    772771            r.append("<i><u>Nahlášený problém</u></i>");
    773772            r.append("&nbsp;&nbsp;<a href=" + url_ruian_error + m_objekt_ruian_id + ">"+ icon_ext_link +"</a><br/>");
     
    778777            r.append("<b>Typ problému: </b>" + m_err_type);
    779778            r.append("<br/>");
    780             if (!m_err_note.equals("")) {
     779            if (!m_err_note.isEmpty()) {
    781780                r.append("<b>Poznámka: </b>" + m_err_note);
    782781                r.append("<br/>");
     
    842841
    843842        // Near address places
    844         if (m_adresni_mista.size() > 0 && m_objekt_ruian_id == 0) {
     843        if (!m_adresni_mista.isEmpty() && m_objekt_ruian_id == 0) {
    845844            String x, x_name;
    846845            r.append("<i><u>Adresní místa v okolí</u></i><br/>");
     
    886885        }
    887886
    888         if (m_so_bez_geometrie.size() > 0) {
     887        if (!m_so_bez_geometrie.isEmpty()) {
    889888            r.append("<i><u>Budovy bez geometrie v okolí</u></i><br/>");
    890889            r.append("<table>");
     
    922921        String[] parts = ruianDate.split("\\.");
    923922        try {
    924             int day = Integer.valueOf(parts[0]);
    925             int month = Integer.valueOf(parts[1]);
    926             int year = Integer.valueOf(parts[2]);
     923            int day = Integer.parseInt(parts[0]);
     924            int month = Integer.parseInt(parts[1]);
     925            int year = Integer.parseInt(parts[2]);
    927926            r = Integer.toString(year) + "-" + String.format("%02d", month) + "-" + String.format("%02d", day);
    928927        } catch (Exception e) {
     
    940939     */
    941940    String tagToString(String k, String v) {
    942         String r = "\"" + k + "\"=\"" + v + "\"\n";
    943         return r;
     941        return "\"" + k + "\"=\"" + v + "\"\n";
    944942    }
    945943
     
    977975        if (keyType.startsWith("ghost") && !m_so_bez_geometrie.isEmpty()) {
    978976            String[] key = keyType.split(":");
    979             int i = Integer.valueOf(key[1]);
     977            int i = Integer.parseInt(key[1]);
    980978            System.out.println("Ghost ID: " + i);
    981979
     
    10981096        if (cmd.startsWith("tags.create-on-place")) {
    10991097            String[] key = cmd.split(":");
    1100             int i = Integer.valueOf(key[1]);
     1098            int i = Integer.parseInt(key[1]);
    11011099            node = new Node(m_adresni_mista.get(i).getPosition());
    11021100        } else {
Note: See TracChangeset for help on using the changeset viewer.