01: package org.enhydra.jawe.base.controller.actions;
02:
03: import java.awt.event.ActionEvent;
04: import java.net.URL;
05:
06: import javax.help.HelpBroker;
07: import javax.help.HelpSet;
08:
09: import org.enhydra.jawe.ActionBase;
10: import org.enhydra.jawe.JaWEComponent;
11: import org.enhydra.jawe.ResourceManager;
12: import org.enhydra.jawe.misc.PFLocale;
13:
14: /**
15: * Class that realizes <B>help manual</B> action.
16: */
17: public class HelpManual extends ActionBase {
18:
19: private HelpSet hs = null;
20: private HelpBroker hb = null;
21:
22: public HelpManual(JaWEComponent jawecomponent) {
23: super (jawecomponent);
24: createHelp();
25: }
26:
27: public void enableDisableAction() {
28: }
29:
30: public void actionPerformed(ActionEvent e) {
31: if (hb != null) {
32: hb.setDisplayed(true);
33: }
34:
35: }
36:
37: public void createHelp() {
38: String defHelpSetName = "jhelpset.hs";
39: PFLocale pfl = new PFLocale(ResourceManager.getChoosenLocale());
40: String helpSetName = "jhelpset_" + pfl.getLocaleString()
41: + ".hs";
42: ClassLoader loader = getClass().getClassLoader();
43:
44: try {
45: URL url = HelpSet.findHelpSet(loader, helpSetName);
46: if (url == null) {
47: url = HelpSet.findHelpSet(loader, defHelpSetName);
48: }
49: if (url != null) {
50: hs = new HelpSet(loader, url);
51: }
52: } catch (Exception ex) {
53: ex.printStackTrace();
54: }
55:
56: if (hs != null) {
57: hb = hs.createHelpBroker();
58: }
59: setEnabled(hs != null && hb != null);
60: }
61:
62: }
|