KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > jbuilder > wizard > WebAppWizard


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  * Paul Mahar
21  *
22  */

23 package org.enhydra.kelp.jbuilder.wizard;
24
25 // ToolBox imports
26
import org.enhydra.tool.ToolBoxInfo;
27
28 // JBuilder imports
29
import com.borland.jbuilder.node.JBProject;
30 import com.borland.primetime.wizard.Wizard;
31 import com.borland.primetime.wizard.WizardAction;
32 import com.borland.primetime.wizard.WizardHost;
33 import com.borland.primetime.wizard.WizardManager;
34 import com.borland.primetime.wizard.WizardPage;
35
36 // Kelp imports
37
import org.enhydra.kelp.KelpInfo;
38 import org.enhydra.kelp.common.ResUtil;
39 import org.enhydra.kelp.common.Constants;
40 import org.enhydra.kelp.common.node.OtterFolderNode;
41 import org.enhydra.kelp.common.node.OtterNodeFactory;
42 import org.enhydra.kelp.common.node.OtterProject;
43 import org.enhydra.kelp.common.swing.KelpIconSet;
44 import org.enhydra.kelp.common.codegen.WebAppUtil;
45 import org.enhydra.kelp.common.codegen.CodeGenException;
46 import org.enhydra.kelp.jbuilder.node.PrimeProject;
47 import org.enhydra.kelp.jbuilder.wizard.AbstractCodeGenWizard;
48
49 // Standard imports
50
import java.util.Vector JavaDoc;
51 import javax.swing.JOptionPane JavaDoc;
52 import java.util.ResourceBundle JavaDoc;
53
54 /**
55  * Class declaration
56  *
57  *
58  * @author Paul Mahar
59  */

60 public class WebAppWizard extends AbstractCodeGenWizard {
61
62     // string not to be resourced
63
private final String JavaDoc HELP_LINK = KelpInfo.getAddinHelpURL(); // nores
64

65     //
66
public static WizardAction WIZARD_EnhydraAppWizard = new WizardAction(WebAppUtil.getDisplayName(),
67             'X',
68             ResUtil.format(res.getString("Creates_a_new_0_"), WebAppUtil.getDisplayName()),
69             KelpIconSet.getSmallIcon(), KelpIconSet.getLargeIcon(), true,
70             Constants.ENHYDRA) {
71
72         /**
73          * Method declaration
74          *
75          *
76          * @return
77          */

78         protected Wizard createWizard() {
79             WebAppWizard wizard = new WebAppWizard();
80
81             return wizard;
82         }
83
84         /**
85          * Method declaration
86          *
87          *
88          * @param source
89          */

90         public void update(Object JavaDoc source) {
91             setEnabled(true);
92         }
93
94     };
95
96     /**
97      * Method declaration
98      *
99      *
100      * @param majorVersion
101      * @param minorVersion
102      */

103     public static void initOpenTool(byte majorVersion, byte minorVersion) {
104         WizardManager.registerWizardAction(WIZARD_EnhydraAppWizard);
105     }
106
107     /**
108      * Method declaration
109      *
110      *
111      * @return
112      */

113     public String JavaDoc getDisplayName() {
114         return WebAppUtil.getDisplayName();
115     }
116
117     /**
118      * Method declaration
119      *
120      *
121      * @return
122      */

123     public String JavaDoc getHelpTopic() {
124         return HELP_LINK;
125     }
126
127     /**
128      * Method declaration
129      *
130      *
131      * @param host
132      *
133      * @return
134      */

135     public WizardPage invokeWizard(WizardHost host) {
136         WizardPage page = null;
137         OtterProject otterProject = null;
138         WebAppUtil util = null;
139
140         try {
141             KelpInfo.verifyIDEClassPath();
142             otterProject = initProject(host);
143         } catch (Exception JavaDoc e) {
144             JOptionPane.showMessageDialog(host.getDialogParent(),
145                                           e.getMessage(),
146                                           ResUtil.format(res.getString("_0_Wizard"), WebAppUtil.getDisplayName()),
147                                           JOptionPane.ERROR_MESSAGE);
148         }
149         if (otterProject != null) {
150             try {
151                 util = new WebAppUtil(otterProject);
152                 page = invokeCodeGenWizard(host, util);
153             } catch (CodeGenException e) {
154                 JOptionPane.showMessageDialog(host.getDialogParent(),
155                                               e.getMessage(),
156                                               ResUtil.format(res.getString("_0_Wizard"), WebAppUtil.getDisplayName()),
157                                               JOptionPane.ERROR_MESSAGE);
158             }
159         }
160         return page;
161     }
162
163     /**
164      *
165      * Method declaration
166      *
167      *
168      * @return
169      */

170     public String JavaDoc[] getSteps() {
171         Vector JavaDoc steps = new Vector JavaDoc();
172         String JavaDoc[] array = new String JavaDoc[0];
173
174         steps.addElement(res.getString("readmeWeb1"));
175         steps.addElement(res.getString("readmeWeb2"));
176         steps.addElement(res.getString("readmeWeb3"));
177         steps.addElement(res.getString("readmeWeb4"));
178         steps.addElement(res.getString("readmeWeb5"));
179         array = (String JavaDoc[]) steps.toArray(array);
180         steps.removeAllElements();
181         return array;
182     }
183
184 }
185
Popular Tags