KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > eclipse > codegen > wizard > EclipseCodeGenWizard


1 package org.enhydra.kelp.eclipse.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 Administrator
14  *
15  * To change this generated comment edit the template variable "typecomment":
16  * Window>Preferences>Java>Templates.
17  * To enable and disable the creation of type comments go to
18  * Window>Preferences>Java>Code Generation.
19  */

20 public class EclipseCodeGenWizard extends CodeGenWizard {
21     private String JavaDoc prjName;
22     private String JavaDoc prjLocation;
23
24     /**
25      * Constructor for EclipseCodeGenWizard.
26      * @param cg
27      */

28     public EclipseCodeGenWizard(CodeGen cg) {
29         super(cg);
30     }
31
32     /**
33      * Constructor for EclipseCodeGenWizard.
34      * @throws GeneratorException
35      */

36     public EclipseCodeGenWizard() throws GeneratorException {
37         super();
38     }
39
40     /**
41      * Constructor for EclipseCodeGenWizard.
42      * @param name
43      */

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

74     public void back() {
75         super.back();
76
77         CodeGenDeck deck = (CodeGenDeck) getDeck();
78         if (deck.getPageIndex() == 0)
79             SetOptions();
80     }
81 }
82
Popular Tags