Ignore:
Timestamp:
2006-10-08T17:29:58+02:00 (20 years ago)
Author:
imi
Message:
  • added online help system
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/actions/JosmAction.java

    r113 r155  
    1818        /**
    1919         * Construct the action as menu action entry.
    20          * 
     20         *
    2121         * @param name          Name of the action (entry name in menu)
    2222         * @param iconName      Name of the icon (without extension)
     
    3333        public JosmAction(String name, String iconName, String tooltip, int shortCut, int modifier) {
    3434                super(name, ImageProvider.get(iconName));
     35                setHelpId();
    3536                putValue(SHORT_DESCRIPTION, "<html>"+tooltip+" <font size='-2'>"+ShortCutLabel.name(shortCut, modifier)+"</font>&nbsp;</html>");
    36                 //Main.panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(shortCut, name);
    37         //Main.panel.getActionMap().put(name, this);
    3837        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(shortCut, modifier), name);
    3938        Main.contentPane.getActionMap().put(name, this);
     
    4140
    4241        public JosmAction() {
     42                setHelpId();
     43        }
     44
     45
     46        private void setHelpId() {
     47                String helpId = "Action/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1);
     48                if (helpId.endsWith("Action"))
     49                        helpId = helpId.substring(0, helpId.length()-6);
     50                putValue("help", helpId);
    4351        }
    4452}
Note: See TracChangeset for help on using the changeset viewer.