Ticket #17915: tooltip.patch

File tooltip.patch, 2.5 KB (added by raykiddy, 4 years ago)
  • src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    diff --git a/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java b/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
    index 07cabc76a..8c4601232 100644
    a b import org.openstreetmap.josm.tools.CheckParameterUtil;  
    3434import org.openstreetmap.josm.tools.ImageProvider;
    3535import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
    3636import org.openstreetmap.josm.tools.Logging;
     37import org.openstreetmap.josm.tools.Platform;
    3738import org.openstreetmap.josm.tools.MultiMap;
    3839import org.openstreetmap.josm.tools.StreamUtils;
    3940import org.openstreetmap.josm.tools.Utils;
    public class ImageryInfo extends  
    705706
    706707    /**
    707708     * Returns a tool tip text for display.
    708      * @return The text
     709     * @return The text, which is a plain-text string for the Mac and HTML for other platforms.
    709710     * @since 8065
    710711     */
    711712    @Override
    712713    public String getToolTipText() {
    713714        StringBuilder res = new StringBuilder(getName());
    714         boolean html = false;
    715715        String dateStr = getDate();
    716716        if (dateStr != null && !dateStr.isEmpty()) {
    717717            res.append("<br>").append(tr("Date of imagery: {0}", dateStr));
    718             html = true;
    719718        }
    720719        if (category != null && category.getDescription() != null) {
    721720            res.append("<br>").append(tr("Imagery category: {0}", category.getDescription()));
    722             html = true;
    723721        }
    724722        if (bestMarked) {
    725723            res.append("<br>").append(tr("This imagery is marked as best in this region in other editors."));
    726             html = true;
    727724        }
    728725        if (overlay) {
    729726            res.append("<br>").append(tr("This imagery is an overlay."));
    730             html = true;
    731727        }
    732728        String desc = getDescription();
    733729        if (desc != null && !desc.isEmpty()) {
    734730            res.append("<br>").append(Utils.escapeReservedCharactersHTML(desc));
    735             html = true;
    736731        }
    737         if (html) {
    738             res.insert(0, "<html>").append("</html>");
     732        if (Platform.OSX.equals(Platform.determinePlatform())) {
     733            return res.toString().replaceAll("<br>", "\n");
     734        } else {
     735            if (res.length() > 0) {
     736                return res.insert(0, "<html>").append("</html>").toString();
     737            } else {
     738                return null;
     739            }
    739740        }
    740         return res.toString();
    741741    }
    742742
    743743    /**