source: josm/trunk/src/org/openstreetmap/josm/gui/help/ContextSensitiveHelpAction.java@ 2715

Last change on this file since 2715 was 2715, checked in by stoecker, 14 years ago

fixed #3772, #4139 - fixed help browser - the external start never worked for official releases, the blocking of helpbrowser for dialogs will be fixed after Java 1.6 switch

File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.help;
3
4import java.awt.event.ActionEvent;
5import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
6
7import javax.swing.AbstractAction;
8import static org.openstreetmap.josm.tools.I18n.tr;
9
10import org.openstreetmap.josm.tools.ImageProvider;
11
12/**
13 * This is the standard help action to be used with help buttons for
14 * context sensitive help
15 *
16 */
17public class ContextSensitiveHelpAction extends AbstractAction {
18
19 /** the help topic */
20 private String helpTopic;
21
22 /**
23 * Sets the help topic
24 *
25 * @param relativeHelpTopic the relative help topic
26 */
27 public void setHelpTopic(String relativeHelpTopic) {
28 if (relativeHelpTopic == null)
29 relativeHelpTopic = "/";
30 this.helpTopic = relativeHelpTopic;
31 }
32
33 /**
34 * Creates a help topic for the root help topic
35 *
36 */
37 public ContextSensitiveHelpAction() {
38 this(ht("/"));
39 }
40
41 /**
42 *
43 * @param helpTopic
44 */
45 public ContextSensitiveHelpAction(String helpTopic) {
46 putValue(SHORT_DESCRIPTION, tr("Show help information"));
47 putValue(NAME, tr("Help"));
48 putValue(SMALL_ICON, ImageProvider.get("help"));
49 this.helpTopic = helpTopic;
50 }
51
52 public void actionPerformed(ActionEvent e) {
53 if (helpTopic != null) {
54 HelpBrowser.setUrlForHelpTopic(helpTopic);
55 }
56 }
57}
Note: See TracBrowser for help on using the repository browser.