01: package org.enhydra.jawe.base.controller.actions;
02:
03: import java.awt.event.ActionEvent;
04:
05: import javax.swing.JOptionPane;
06:
07: import org.enhydra.jawe.ActionBase;
08: import org.enhydra.jawe.JaWEComponent;
09: import org.enhydra.jawe.JaWEManager;
10: import org.enhydra.jawe.ResourceManager;
11: import org.enhydra.jawe.Utils;
12: import org.enhydra.jawe.base.controller.JaWEFrame;
13:
14: /**
15: * @author Sasa Bojanic
16: */
17: public class PackageReferredDocument extends ActionBase {
18:
19: public PackageReferredDocument(JaWEComponent jawecomponent) {
20: super (jawecomponent);
21: }
22:
23: public void enableDisableAction() {
24: if (getPackage() != null) {
25: String doc = getPackage().getPackageHeader()
26: .getDocumentation();
27: if (doc.trim().length() > 0) {
28: setEnabled(true);
29: } else {
30: setEnabled(false);
31: }
32: } else {
33: setEnabled(false);
34: }
35: }
36:
37: public void actionPerformed(ActionEvent e) {
38: if (getPackage() == null)
39: return;
40: String doc = getPackage().getPackageHeader().getDocumentation();
41: boolean ok = Utils.showExternalDocument(doc);
42: if (!ok) {
43: JaWEFrame jf = JaWEManager.getInstance()
44: .getJaWEController().getJaWEFrame();
45: JOptionPane
46: .showMessageDialog(
47: jf,
48: doc
49: + ": "
50: + ResourceManager
51: .getLanguageDependentString("InformationFileNotReadable"),
52: jf.getAppTitle(),
53: JOptionPane.INFORMATION_MESSAGE);
54: }
55: }
56:
57: }
|