Ignore:
Timestamp:
2014-01-19T20:59:05+01:00 (6 years ago)
Author:
simon04
Message:

fix #7686 - Shorten long search expression for display purposes (in dialogs, tooltips)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r6586 r6742  
    5656
    5757    public static final int DEFAULT_SEARCH_HISTORY_SIZE = 15;
     58    /** Maximum number of characters before the search expression is shortened for display purposes. */
     59    public static final int MAX_LENGTH_SEARCH_EXPRESSION_DISPLAY = 100;
    5860
    5961    private static final String SEARCH_EXPRESSION = "searchExpression";
     
    321323                    new ToolbarPreferences.ActionDefinition(Main.main.menu.search);
    322324            aDef.getParameters().put(SEARCH_EXPRESSION, initialValues);
    323             aDef.setName(initialValues.text); // Display search expression as tooltip instead of generic one
     325            aDef.setName(Utils.shortenString(initialValues.text, MAX_LENGTH_SEARCH_EXPRESSION_DISPLAY)); // Display search expression as tooltip instead of generic one
    324326            // parametrized action definition is now composed
    325327            ActionParser actionParser = new ToolbarPreferences.ActionParser(null);
     
    588590        if (foundMatches == 0) {
    589591            String msg = null;
     592            final String text = Utils.shortenString(s.text, MAX_LENGTH_SEARCH_EXPRESSION_DISPLAY);
    590593            if (s.mode == SearchMode.replace) {
    591                 msg = tr("No match found for ''{0}''", s.text);
     594                msg = tr("No match found for ''{0}''", text);
    592595            } else if (s.mode == SearchMode.add) {
    593                 msg = tr("Nothing added to selection by searching for ''{0}''", s.text);
     596                msg = tr("Nothing added to selection by searching for ''{0}''", text);
    594597            } else if (s.mode == SearchMode.remove) {
    595                 msg = tr("Nothing removed from selection by searching for ''{0}''", s.text);
     598                msg = tr("Nothing removed from selection by searching for ''{0}''", text);
    596599            } else if (s.mode == SearchMode.in_selection) {
    597                 msg = tr("Nothing found in selection by searching for ''{0}''", s.text);
     600                msg = tr("Nothing found in selection by searching for ''{0}''", text);
    598601            }
    599602            Main.map.statusLine.setHelpText(msg);
Note: See TracChangeset for help on using the changeset viewer.