1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.gui.action;
21
22 import java.awt.event.ActionEvent;
23
24 import javax.help.HelpBroker;
25 import javax.help.HelpSet;
26 import javax.help.Map;
27 import javax.swing.AbstractAction;
28 import javax.swing.Action;
29
30 import org.xnap.XNap;
31 import org.xnap.gui.StatusBar;
32 import org.xnap.gui.util.HelpManager;
33 import org.xnap.gui.util.IconHelper;
34
35 /***
36 * Provides an action that shows the about dialog.
37 */
38 public class HelpDialogAction extends AbstractAction
39 {
40
41
42
43
44
45 private String name;
46 private HelpSet hs;
47
48
49
50 /***
51 * Constructs a new HelpDialogAction.
52 *
53 * @param name name of the manual, e.g "XNap Handbook"
54 * @param helpset the corresponding helpset
55 */
56 public HelpDialogAction(String name, HelpSet helpset)
57 {
58 this.name = name;
59 this.hs = helpset;
60
61 putValue(Action.NAME, name + "...");
62 putValue(IconHelper.XNAP_ICON, "contents.png");
63 putValue(Action.SHORT_DESCRIPTION, XNap.tr("Shows the help dialog."));
64
65 setEnabled(HelpManager.getMainHelpSet() != null);
66 }
67
68
69
70 public void actionPerformed(ActionEvent event)
71 {
72 StatusBar.setText(XNap.tr("Opening {0}", name));
73 HelpBroker hb = HelpManager.getMainHelpBroker();
74 try {
75 Map.ID id = Map.ID.create(null, hs);
76 hb.setCurrentID(id);
77 hb.setDisplayed(true);
78 }
79 catch (Exception e) {
80 }
81 }
82 }
83
84
85
86