Ignore:
Timestamp:
2015-05-17T05:48:46+02:00 (6 years ago)
Author:
Don-vip
Message:

Consecutively calls to StringBuffer/StringBuilder .append should reuse the target object

Location:
trunk/src/org/openstreetmap/josm/plugins
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r8345 r8379  
    269269        //
    270270        StringBuilder sb = new StringBuilder();
    271         sb.append("<html>");
    272         sb.append(trn(
     271        sb.append("<html>")
     272          .append(trn(
    273273                "The following plugin is no longer necessary and has been deactivated:",
    274274                "The following plugins are no longer necessary and have been deactivated:",
    275                 removedPlugins.size()
    276         ));
    277         sb.append("<ul>");
     275                removedPlugins.size()))
     276          .append("<ul>");
    278277        for (DeprecatedPlugin depr: removedPlugins) {
    279278            sb.append("<li>").append(depr.name);
     
    283282            sb.append("</li>");
    284283        }
    285         sb.append("</ul>");
    286         sb.append("</html>");
     284        sb.append("</ul>")
     285          .append("</html>");
    287286        JOptionPane.showMessageDialog(
    288287                parent,
     
    462461    private static void alertMissingRequiredPlugin(Component parent, String plugin, Set<String> missingRequiredPlugin) {
    463462        StringBuilder sb = new StringBuilder();
    464         sb.append("<html>");
    465         sb.append(trn("Plugin {0} requires a plugin which was not found. The missing plugin is:",
     463        sb.append("<html>")
     464          .append(trn("Plugin {0} requires a plugin which was not found. The missing plugin is:",
    466465                "Plugin {0} requires {1} plugins which were not found. The missing plugins are:",
    467466                missingRequiredPlugin.size(),
    468467                plugin,
    469                 missingRequiredPlugin.size()
    470         ));
    471         sb.append(Utils.joinAsHtmlUnorderedList(missingRequiredPlugin));
    472         sb.append("</html>");
     468                missingRequiredPlugin.size()))
     469          .append(Utils.joinAsHtmlUnorderedList(missingRequiredPlugin))
     470          .append("</html>");
    473471        JOptionPane.showMessageDialog(
    474472                parent,
     
    757755    private static void alertMissingPluginInformation(Component parent, Collection<String> plugins) {
    758756        StringBuilder sb = new StringBuilder();
    759         sb.append("<html>");
    760         sb.append(trn("JOSM could not find information about the following plugin:",
     757        sb.append("<html>")
     758          .append(trn("JOSM could not find information about the following plugin:",
    761759                "JOSM could not find information about the following plugins:",
    762                 plugins.size()));
    763         sb.append(Utils.joinAsHtmlUnorderedList(plugins));
    764         sb.append(trn("The plugin is not going to be loaded.",
     760                plugins.size()))
     761          .append(Utils.joinAsHtmlUnorderedList(plugins))
     762          .append(trn("The plugin is not going to be loaded.",
    765763                "The plugins are not going to be loaded.",
    766                 plugins.size()));
    767         sb.append("</html>");
     764                plugins.size()))
     765          .append("</html>");
    768766        HelpAwareOptionPane.showOptionDialog(
    769767                parent,
     
    819817    private static void alertFailedPluginUpdate(Component parent, Collection<PluginInformation> plugins) {
    820818        StringBuilder sb = new StringBuilder();
    821         sb.append("<html>");
    822         sb.append(trn(
     819        sb.append("<html>")
     820          .append(trn(
    823821                "Updating the following plugin has failed:",
    824822                "Updating the following plugins has failed:",
    825                 plugins.size()
    826         )
    827         );
    828         sb.append("<ul>");
     823                plugins.size()))
     824          .append("<ul>");
    829825        for (PluginInformation pi: plugins) {
    830826            sb.append("<li>").append(pi.name).append("</li>");
    831827        }
    832         sb.append("</ul>");
    833         sb.append(trn(
     828        sb.append("</ul>")
     829          .append(trn(
    834830                "Please open the Preference Dialog after JOSM has started and try to update it manually.",
    835831                "Please open the Preference Dialog after JOSM has started and try to update them manually.",
    836                 plugins.size()
    837         ));
    838         sb.append("</html>");
     832                plugins.size()))
     833          .append("</html>");
    839834        HelpAwareOptionPane.showOptionDialog(
    840835                parent,
     
    11981193
    11991194        final StringBuilder msg = new StringBuilder();
    1200         msg.append("<html>");
    1201         msg.append(tr("An unexpected exception occurred that may have come from the ''{0}'' plugin.", plugin.getPluginInformation().name));
    1202         msg.append("<br>");
     1195        msg.append("<html>")
     1196           .append(tr("An unexpected exception occurred that may have come from the ''{0}'' plugin.", plugin.getPluginInformation().name))
     1197           .append("<br>");
    12031198        if (plugin.getPluginInformation().author != null) {
    1204             msg.append(tr("According to the information within the plugin, the author is {0}.", plugin.getPluginInformation().author));
    1205             msg.append("<br>");
    1206         }
    1207         msg.append(tr("Try updating to the newest version of this plugin before reporting a bug."));
    1208         msg.append("</html>");
     1199            msg.append(tr("According to the information within the plugin, the author is {0}.", plugin.getPluginInformation().author))
     1200               .append("<br>");
     1201        }
     1202        msg.append(tr("Try updating to the newest version of this plugin before reporting a bug."))
     1203           .append("</html>");
    12091204
    12101205        try {
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r8342 r8379  
    305305    public String getDescriptionAsHtml() {
    306306        StringBuilder sb = new StringBuilder();
    307         sb.append("<html><body>");
    308         sb.append(description == null ? tr("no description available") : description);
     307        sb.append("<html><body>")
     308          .append(description == null ? tr("no description available") : description);
    309309        if (link != null) {
    310310            sb.append(" <a href=\"").append(link).append("\">").append(tr("More info...")).append("</a>");
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r8338 r8379  
    114114            URL url = new URL(site);
    115115            StringBuilder sb = new StringBuilder();
    116             sb.append("site-");
    117             sb.append(url.getHost()).append("-");
     116            sb.append("site-")
     117              .append(url.getHost()).append("-");
    118118            if (url.getPort() != -1) {
    119119                sb.append(url.getPort()).append("-");
Note: See TracChangeset for help on using the changeset viewer.