Ticket #1915: context_help_menu.diff

File context_help_menu.diff, 1.4 KB (added by sanna, 17 years ago)

silly diff of how I got context sensitive menu help working

  • src/org/openstreetmap/josm/actions/HelpAction.java

     
    133133    private String contextSensitiveHelp(Object c) {
    134134        if (c instanceof Helpful)
    135135            return ((Helpful)c).helpTopic();
    136         if (c instanceof JMenu)
    137             return "Menu/"+((JMenu)c).getText();
     136       /* if (c instanceof JMenu)
     137            return "Menu/"+((JMenu)c).getText();*/
    138138        if (c instanceof AbstractButton) {
    139139            AbstractButton b = (AbstractButton)c;
    140140            if (b.getClientProperty("help") != null)
  • src/org/openstreetmap/josm/gui/MainMenu.java

     
    163163    public void add(JMenu menu, int mnemonicKey, String shortName) {
    164164        Shortcut.registerShortcut("menu:" + shortName, tr("Menu: {0}", menu.getText()), mnemonicKey,
    165165                Shortcut.GROUP_MNEMONIC).setMnemonic(menu);
     166       
     167        char initialChar = shortName.charAt(0);
     168        String helpText = Character.toUpperCase(initialChar)+shortName.substring(1);
     169
     170        menu.putClientProperty("help", "Menu/"+helpText);
    166171        add(menu);
    167172    }
    168173