01: /*
02: * StartOctopusLoaderAction.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 StartOctopusLoaderAction extends AbstractAction {
19:
20: OctopusProjectFrame octopusProjectFrame;
21:
22: /**
23: * This method starts the LoaderGenerator application
24: */
25: public StartOctopusLoaderAction(
26: OctopusProjectFrame octopusProjectFrame, String label) {
27:
28: this .octopusProjectFrame = octopusProjectFrame;
29: putValue(NAME, label);
30: putValue(SMALL_ICON, new ImageIcon(getClass().getClassLoader()
31: .getResource(
32: // "org/webdocwf/util/loader/" + "wizard/images/Play16.gif")));
33: "org/webdocwf/util/loader/"
34: + "wizard/images/StartLoader.gif")));
35: putValue(SHORT_DESCRIPTION,
36: "Start the OctopusLoader application");
37: putValue(LONG_DESCRIPTION,
38: "Start the OctopusLoader application");
39: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('L', Toolkit
40: .getDefaultToolkit().getMenuShortcutKeyMask()));
41: putValue(MNEMONIC_KEY, new Integer('L'));
42: }
43:
44: /**
45: * This method check if the action is performed (event key pressed)
46: * @param e is event
47: */
48: public void actionPerformed(ActionEvent e) {
49: OctopusLoaderData initData = null;
50: String errorMsg = null;
51: try {
52: octopusProjectFrame.setActiveTab(1);
53: initData = octopusProjectFrame.getLoaderPanel()
54: .getOctopusLoaderInit();
55: } catch (Exception ex) {
56: ex.printStackTrace();
57: errorMsg = ex.getMessage();
58: }
59: octopusProjectFrame.getLoaderPanel().getTraceArea().setText("");
60: OctopusLoaderThread runOctopus = new OctopusLoaderThread(
61: initData, errorMsg, octopusProjectFrame
62: .getLoaderPanel().getTraceArea());
63: runOctopus.start();
64: }
65:
66: }
|