KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > monitor > view > DesignerAction


1 /*
2  * (c) Rob Gordon 2005
3  */

4 package org.oddjob.monitor.view;
5
6 import java.awt.event.ActionEvent JavaDoc;
7 import java.io.File JavaDoc;
8
9 import javax.swing.AbstractAction JavaDoc;
10 import javax.swing.Action JavaDoc;
11
12 import org.apache.log4j.Logger;
13 import org.oddjob.designer.OddjobDesigner;
14 import org.oddjob.monitor.OddjobExplorer;
15 import org.oddjob.monitor.Standards;
16
17 /**
18  * The action that corresponds to the Oddjob Designer action.
19  *
20  */

21 public class DesignerAction extends AbstractAction JavaDoc {
22     private static final long serialVersionUID = 0;
23     
24     private static final Logger logger = Logger.getLogger(DesignerAction.class);
25     private final OddjobExplorer explorer;
26     private File JavaDoc config;
27     
28     public DesignerAction(OddjobExplorer explorer) {
29         putValue(Action.NAME, "Oddjob Designer");
30         this.explorer = explorer;
31         putValue(Action.MNEMONIC_KEY, Standards.DESIGNER_MNEMONIC_KEY);
32     }
33
34     public void setConfig(File JavaDoc file) {
35         config = file;
36     }
37     
38     /*
39      * (non-Javadoc)
40      *
41      * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
42      */

43     public void actionPerformed(ActionEvent JavaDoc e) {
44         try {
45             OddjobDesigner d = new OddjobDesigner();
46             d.setDir(explorer.getDir());
47             d.setFile(config);
48             d.setExplorer(explorer);
49             Thread JavaDoc t = new Thread JavaDoc(d);
50             t.start();
51         }
52         catch (Exception JavaDoc ex) {
53             logger.warn("Oddjob Designer faild to launch!", ex);
54         }
55         
56     }
57 }
Popular Tags