Ticket #3760: preset_tooltip.patch
| File preset_tooltip.patch, 3.2 KB (added by , 16 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
70 70 public String name; 71 71 public String name_context; 72 72 public String locale_name; 73 public final static String OPTIONAL_TOOLTIP_TEXT = "Optional tooltip text"; 73 74 74 75 public static abstract class Item { 75 76 protected void initAutoCompletionField(AutoCompletingTextField field, String key) { … … 517 518 public void setDisplayName() { 518 519 putValue(Action.NAME, getName()); 519 520 putValue("toolbar", "tagging_" + getRawName()); 520 putValue(SHORT_DESCRIPTION, (group != null ?521 tr("Use preset ''{0}'' of group ''{1}''", getLocaleName(), group.getName()) :522 tr("Use preset ''{0}''", getLocaleName())));523 521 } 524 522 525 523 public String getLocaleName() { -
src/org/openstreetmap/josm/gui/tagging/TaggingPresetMenu.java
20 20 public JMenu menu = null; // set by TaggingPresetPreferences 21 21 public void setDisplayName() { 22 22 putValue(Action.NAME, getName()); 23 putValue(SHORT_DESCRIPTION, (group != null ? 24 tr("Preset group ''{0}'' of group ''{1}''", getLocaleName(), group.getName()) : 25 tr("Preset group ''{0}''", getLocaleName()))); 23 /** Tooltips should be shown for the toolbar buttons, but not in the menu. */ 24 putValue(OPTIONAL_TOOLTIP_TEXT, (group != null ? 25 tr("Preset group {1} / {0}", getLocaleName(), group.getName()) : 26 tr("Preset group {0}", getLocaleName()))); 26 27 putValue("toolbar", "tagginggroup_" + getRawName()); 27 28 } 28 29 public void setIcon(String iconName) { -
src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
50 50 import javax.swing.tree.TreePath; 51 51 52 52 import org.openstreetmap.josm.Main; 53 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 53 54 import org.openstreetmap.josm.tools.GBC; 54 55 import org.openstreetmap.josm.tools.ImageProvider; 55 56 … … 492 493 for (String s : getToolString()) { 493 494 if (s.equals("|")) 494 495 control.addSeparator(); 495 else 496 control.add(getAction(s)); 496 else { 497 Action a = getAction(s); 498 JButton b = control.add(a); 499 String tt = (String) a.getValue(TaggingPreset.OPTIONAL_TOOLTIP_TEXT); 500 if (tt != null) { 501 b.setToolTipText(tt); 502 } 503 } 497 504 } 498 505 control.setVisible(control.getComponentCount() != 0); 499 506 }
