01: /*
02: * StartOctopusGeneratorAction.java. Created on Apr 23, 2004.
03: */
04: package org.webdocwf.util.loader.wizard;
05:
06: import java.awt.Toolkit;
07: import java.awt.event.ActionEvent;
08:
09: import javax.swing.AbstractAction;
10: import javax.swing.ImageIcon;
11: import javax.swing.KeyStroke;
12:
13: /**
14: *
15: *
16: * @author Zoran Milakovic
17: */
18: public class StartOctopusGeneratorAction extends AbstractAction {
19:
20: OctopusProjectFrame octopusProjectFrame;
21:
22: /**
23: * This method starts the LoaderGenerator application
24: */
25: public StartOctopusGeneratorAction(
26: OctopusProjectFrame octopusProjectFrame, String label) {
27: this .octopusProjectFrame = octopusProjectFrame;
28: putValue(NAME, label);
29: putValue(SMALL_ICON, new ImageIcon(getClass().getClassLoader()
30: .getResource(
31: // "org/webdocwf/util/loader/" + "wizard/images/Play16.gif")));
32: "org/webdocwf/util/loader/"
33: + "wizard/images/StartGenerator.gif")));
34: putValue(SHORT_DESCRIPTION,
35: "Start the OctopusGenerator application");
36: putValue(LONG_DESCRIPTION,
37: "Start the OctopusGenerator application");
38: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('G', Toolkit
39: .getDefaultToolkit().getMenuShortcutKeyMask()));
40: putValue(MNEMONIC_KEY, new Integer('G'));
41: }
42:
43: /**
44: * This method check if the action is performed (event key pressed)
45: * @param e is event
46: */
47: public void actionPerformed(ActionEvent e) {
48: OctopusGeneratorData initData = null;
49: String errorMsg = null;
50: try {
51: octopusProjectFrame.setActiveTab(0);
52: initData = octopusProjectFrame.getGeneratorPanel()
53: .getOctopusGeneratorInit();
54: octopusProjectFrame.getGeneratorPanel().getTraceArea()
55: .setText("");
56: OctopusGeneratorThread runGenerator = new OctopusGeneratorThread(
57: initData, errorMsg, octopusProjectFrame
58: .getGeneratorPanel().getTraceArea());
59: runGenerator.start();
60: } catch (Exception ex) {
61: errorMsg = ex.getMessage();
62: }
63: }
64:
65: }
|