- Timestamp:
- 2021-08-02T19:18:47+02:00 (3 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r17862 r18116 36 36 import org.openstreetmap.josm.tools.Logging; 37 37 import org.openstreetmap.josm.tools.MultiMap; 38 import org.openstreetmap.josm.tools.PlatformManager; 38 39 import org.openstreetmap.josm.tools.StreamUtils; 39 40 import org.openstreetmap.josm.tools.Utils; … … 705 706 } 706 707 707 708 708 /** 709 709 * Returns a tool tip text for display. … … 713 713 @Override 714 714 public String getToolTipText() { 715 boolean htmlSupported = PlatformManager.getPlatform().isHtmlSupportedInMenuTooltips(); 715 716 StringBuilder res = new StringBuilder(getName()); 716 717 boolean html = false; 717 718 String dateStr = getDate(); 718 719 if (dateStr != null && !dateStr.isEmpty()) { 719 res.append("<br>").append(tr("Date of imagery: {0}", dateStr)); 720 html = true; 720 html = addNewLineInTooltip(res, tr("Date of imagery: {0}", dateStr), htmlSupported); 721 721 } 722 722 if (category != null && category.getDescription() != null) { 723 res.append("<br>").append(tr("Imagery category: {0}", category.getDescription())); 724 html = true; 723 html = addNewLineInTooltip(res, tr("Imagery category: {0}", category.getDescription()), htmlSupported); 725 724 } 726 725 if (bestMarked) { 727 res.append("<br>").append(tr("This imagery is marked as best in this region in other editors.")); 728 html = true; 726 html = addNewLineInTooltip(res, tr("This imagery is marked as best in this region in other editors."), htmlSupported); 729 727 } 730 728 if (overlay) { 731 res.append("<br>").append(tr("This imagery is an overlay.")); 732 html = true; 729 html = addNewLineInTooltip(res, tr("This imagery is an overlay."), htmlSupported); 733 730 } 734 731 String desc = getDescription(); 735 732 if (desc != null && !desc.isEmpty()) { 736 res.append("<br>").append(Utils.escapeReservedCharactersHTML(desc)); 737 html = true; 733 html = addNewLineInTooltip(res, desc, htmlSupported); 738 734 } 739 735 if (html) { … … 741 737 } 742 738 return res.toString(); 739 } 740 741 private static boolean addNewLineInTooltip(StringBuilder res, String line, boolean htmlSupported) { 742 if (htmlSupported) { 743 res.append("<br>").append(Utils.escapeReservedCharactersHTML(line)); 744 } else { 745 res.append('\n').append(line); 746 } 747 return htmlSupported; 743 748 } 744 749 -
trunk/src/org/openstreetmap/josm/tools/PlatformHook.java
r17779 r18116 234 234 235 235 /** 236 * Determines if HTML rendering is supported in menu tooltips. 237 * @return {@code true} if HTML rendering is supported in menu tooltips 238 * @since 18116 239 */ 240 default boolean isHtmlSupportedInMenuTooltips() { 241 return true; 242 } 243 244 /** 236 245 * Returns extended modifier key used as the appropriate accelerator key for menu shortcuts. 237 246 * It is advised everywhere to use {@link Toolkit#getMenuShortcutKeyMask()} to get the cross-platform modifier, but: -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r17826 r18116 27 27 import java.util.Objects; 28 28 import java.util.concurrent.ExecutionException; 29 30 import javax.swing.UIManager; 29 31 30 32 import org.openstreetmap.josm.data.Preferences; … … 95 97 checkExpiredJava(javaCallback); 96 98 checkWebStartMigration(webStartCallback); 99 } 100 101 @Override 102 public boolean isHtmlSupportedInMenuTooltips() { 103 // See #17915 - JDK-8164935 104 // "Mac" is the native LAF, "Aqua" is Quaqua. Both use native menus with native tooltips. 105 String laf = UIManager.getLookAndFeel().getID(); 106 return !("true".equals(Utils.getSystemProperty("apple.laf.useScreenMenuBar")) 107 && ("Aqua".equals(laf) || laf.contains("Mac"))); 97 108 } 98 109 -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r17676 r18116 21 21 import javax.swing.JMenu; 22 22 import javax.swing.KeyStroke; 23 import javax.swing.UIManager;24 23 import javax.swing.text.JTextComponent; 25 24 … … 640 639 .filter(text -> !text.isEmpty()); 641 640 642 final String laf = UIManager.getLookAndFeel().getID(); 643 // "Mac" is the native LAF, "Aqua" is Quaqua. Both use native menus with native tooltips. 644 final boolean canHtml = !(PlatformManager.isPlatformOsx() && (laf.contains("Mac") || laf.contains("Aqua"))); 641 final boolean canHtml = PlatformManager.getPlatform().isHtmlSupportedInMenuTooltips(); 645 642 646 643 StringBuilder result = new StringBuilder(48); … … 664 661 return result.toString(); 665 662 } 666 667 663 }
Note:
See TracChangeset
for help on using the changeset viewer.