KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > webdocwf > util > loader > wizard > StartOctopusGeneratorAction


1 /*
2  * StartOctopusGeneratorAction.java. Created on Apr 23, 2004.
3  */

4 package org.webdocwf.util.loader.wizard;
5
6 import java.awt.Toolkit JavaDoc;
7 import java.awt.event.ActionEvent JavaDoc;
8
9 import javax.swing.AbstractAction JavaDoc;
10 import javax.swing.ImageIcon JavaDoc;
11 import javax.swing.KeyStroke JavaDoc;
12
13 /**
14  *
15  *
16  * @author Zoran Milakovic
17  */

18 public class StartOctopusGeneratorAction extends AbstractAction JavaDoc {
19
20     OctopusProjectFrame octopusProjectFrame;
21     /**
22      * This method starts the LoaderGenerator application
23      */

24     public StartOctopusGeneratorAction(OctopusProjectFrame octopusProjectFrame, String JavaDoc label) {
25         this.octopusProjectFrame = octopusProjectFrame;
26         putValue(NAME, label);
27         putValue(
28             SMALL_ICON,
29             new ImageIcon JavaDoc(
30                 getClass().getClassLoader().getResource(
31 // "org/webdocwf/util/loader/" + "wizard/images/Play16.gif")));
32
"org/webdocwf/util/loader/" + "wizard/images/StartGenerator.gif")));
33         putValue(SHORT_DESCRIPTION, "Start the OctopusGenerator application");
34         putValue(LONG_DESCRIPTION, "Start the OctopusGenerator application");
35         putValue(
36             ACCELERATOR_KEY,
37             KeyStroke.getKeyStroke('G', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
38         putValue(MNEMONIC_KEY, new Integer JavaDoc('G'));
39     }
40
41     /**
42      * This method check if the action is performed (event key pressed)
43      * @param e is event
44      */

45     public void actionPerformed(ActionEvent JavaDoc e) {
46         OctopusGeneratorData initData = null;
47         String JavaDoc errorMsg = null;
48         try {
49             octopusProjectFrame.setActiveTab(0);
50             initData = octopusProjectFrame.getGeneratorPanel().getOctopusGeneratorInit();
51             octopusProjectFrame.getGeneratorPanel().getTraceArea().setText("");
52             OctopusGeneratorThread runGenerator =
53                 new OctopusGeneratorThread(
54                     initData,
55                     errorMsg,
56                     octopusProjectFrame.getGeneratorPanel().getTraceArea());
57             runGenerator.start();
58         } catch (Exception JavaDoc ex) {
59             errorMsg = ex.getMessage();
60         }
61     }
62
63 }
64
Popular Tags