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

Last change on this file since 3083 was 3083, checked in by bastiK, 15 years ago

added svn:eol-style=native to source files

  • Property svn:eol-style set to native
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.