01: package org.enhydra.kelp.eclipse.codegen.wizard;
02:
03: //import org.eclipse.core.resources.IWorkspaceRoot;
04: //import org.enhydra.kelp.eclipse.KelpPlugin;
05: import org.enhydra.tool.codegen.CodeGen;
06: import org.enhydra.tool.codegen.Generator;
07: import org.enhydra.tool.codegen.GeneratorException;
08: import org.enhydra.tool.codegen.GeneratorOption;
09: 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 prjName;
22: private String 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 name, String prjRootKelp)
46: throws GeneratorException {//DACHA
47: super ();
48:
49: prjName = name;
50: prjLocation = prjRootKelp;
51: SetOptions();
52: }
53:
54: private void SetOptions() {
55: int i = 0;
56:
57: Generator[] generators = getGenerators();
58: GeneratorOption opt;
59: try {
60: for (i = 0; i < generators.length; i++) {
61: opt = generators[i].getOptionSet().lookup("project");
62: opt.setValue(prjName);
63: opt = generators[i].getOptionSet().lookup("package");
64: opt.setValue(prjName);
65: opt = generators[i].getOptionSet().lookup("root");
66: opt.setValue(prjLocation);
67: }
68: } catch (GeneratorException e) {
69: }
70: }
71:
72: /**
73: * @see org.enhydra.tool.common.wizard.TBWizard#back()
74: */
75: public void back() {
76: super .back();
77:
78: CodeGenDeck deck = (CodeGenDeck) getDeck();
79: if (deck.getPageIndex() == 0)
80: SetOptions();
81: }
82: }
|