KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > jdev > codegen > wizard > JDevCodeGenWizard


1 package org.enhydra.kelp.jdev.codegen.wizard;
2
3 //import org.eclipse.core.resources.IWorkspaceRoot;
4
//import org.enhydra.kelp.eclipse.KelpPlugin;
5
import org.enhydra.tool.codegen.CodeGen;
6 import org.enhydra.tool.codegen.Generator;
7 import org.enhydra.tool.codegen.GeneratorException;
8 import org.enhydra.tool.codegen.GeneratorOption;
9 import org.enhydra.tool.codegen.wizard.CodeGenDeck;
10 import org.enhydra.tool.codegen.wizard.CodeGenWizard;
11
12 /**
13  * @author strale
14  *
15  */

16 public class JDevCodeGenWizard extends CodeGenWizard {
17     private String JavaDoc prjName;
18     private String JavaDoc prjLocation;
19
20     /**
21      * Constructor for JDevCodeGenWizard.
22      * @param cg
23      */

24     public JDevCodeGenWizard(CodeGen cg) {
25         super(cg);
26     }
27
28     /**
29      * Constructor for JDevCodeGenWizard.
30      * @throws GeneratorException
31      */

32     public JDevCodeGenWizard() throws GeneratorException {
33         super();
34     }
35
36     /**
37      * Constructor for JDevCodeGenWizard.
38      * @param name
39      */

40
41     public JDevCodeGenWizard(String JavaDoc name, String JavaDoc prjRootKelp) throws GeneratorException {//DACHA
42
super();
43
44         prjName = name;
45         prjLocation = prjRootKelp;
46         SetOptions();
47     }
48
49     private void SetOptions() {
50         int i = 0;
51
52         Generator[] generators = getGenerators();
53         GeneratorOption opt;
54         try {
55             for (i = 0; i < generators.length; i++) {
56                 opt = generators[i].getOptionSet().lookup("project");
57                 opt.setValue(prjName);
58                 opt = generators[i].getOptionSet().lookup("package");
59                 opt.setValue(prjName);
60                 opt = generators[i].getOptionSet().lookup("root");
61                 opt.setValue(prjLocation);
62             }
63         } catch (GeneratorException e) {
64         }
65     }
66
67     /**
68      * @see org.enhydra.tool.common.wizard.TBWizard#back()
69      */

70     public void back() {
71         super.back();
72
73         CodeGenDeck deck = (CodeGenDeck) getDeck();
74         if (deck.getPageIndex() == 0)
75             SetOptions();
76     }
77 }
78
Popular Tags