Ignore:
Timestamp:
2016-01-05T15:34:45+01:00 (8 years ago)
Author:
simon04
Message:

Refactoring (make Help a JosmAction)

File:
1 edited

Legend:

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

    r8510 r9320  
    77import java.awt.Point;
    88import java.awt.event.ActionEvent;
     9import java.awt.event.KeyEvent;
    910
    10 import javax.swing.AbstractAction;
    1111import javax.swing.SwingUtilities;
    1212
     
    1515import org.openstreetmap.josm.gui.help.HelpUtil;
    1616import org.openstreetmap.josm.io.OnlineResource;
    17 import org.openstreetmap.josm.tools.ImageProvider;
     17import org.openstreetmap.josm.tools.Shortcut;
    1818
    1919/**
     
    2121 * @since 155
    2222 */
    23 public class HelpAction extends AbstractAction {
     23public class HelpAction extends JosmAction {
    2424
    2525    /**
     
    2727     */
    2828    public HelpAction() {
    29         super(tr("Help"));
    30         new ImageProvider("help").getResource().getImageIcon(this);
    31         putValue("toolbar", "help");
     29        this(true);
     30    }
     31
     32    private HelpAction(boolean shortcut) {
     33        super(tr("Help"), "help", null,
     34                shortcut ? Shortcut.registerShortcut("system:help", tr("Help"), KeyEvent.VK_F1, Shortcut.DIRECT) : null,
     35                true);
    3236        setEnabled(!Main.isOffline(OnlineResource.JOSM_WEBSITE));
     37    }
     38
     39    /**
     40     * Constructs a new {@code HelpAction} without assigning a shortcut.
     41     * @return a new {@code HelpAction}
     42     */
     43    public static HelpAction createWithoutShortcut() {
     44        return new HelpAction(false);
    3345    }
    3446
Note: See TracChangeset for help on using the changeset viewer.