KickJava   Java API By Example, From Geeks To Geeks.

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


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.Constants;
39 import org.enhydra.kelp.common.ResUtil;
40 import org.enhydra.kelp.common.node.OtterProject;
41 import org.enhydra.kelp.common.node.OtterNodeFactory;
42 import org.enhydra.kelp.common.node.OtterFolderNode;
43 import org.enhydra.kelp.common.swing.KelpIconSet;
44 import org.enhydra.kelp.common.codegen.Enhydra3AppUtil;
45 import org.enhydra.kelp.common.codegen.CodeGenException;
46 import org.enhydra.kelp.jbuilder.node.PrimeProject;
47 import org.enhydra.kelp.jbuilder.node.PrimeProject;
48 import org.enhydra.kelp.jbuilder.wizard.AbstractCodeGenWizard;
49
50 // Standard imports
51
import javax.swing.JOptionPane JavaDoc;
52 import java.util.Vector JavaDoc;
53 import java.util.ResourceBundle JavaDoc;
54
55 /**
56  * Class declaration
57  *
58  *
59  * @author Paul Mahar
60  */

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

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

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

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

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

113     public String JavaDoc getHelpTopic() {
114         return HELP_LINK;
115     }
116
117     public String JavaDoc getDisplayName() {
118         return Enhydra3AppUtil.getDisplayName();
119     }
120
121     public WizardPage invokeWizard(WizardHost host) {
122         WizardPage page = null;
123         OtterProject otterProject = null;
124         Enhydra3AppUtil util = null;
125
126         try {
127             KelpInfo.verifyIDEClassPath();
128             otterProject = initProject(host);
129         } catch (Exception JavaDoc e) {
130             JOptionPane.showMessageDialog(host.getDialogParent(),
131                                           e.getMessage(),
132                                           ResUtil.format(res.getString("_0_Wizard"), Enhydra3AppUtil.getDisplayName()),
133                                           JOptionPane.ERROR_MESSAGE);
134         }
135         if (otterProject != null) {
136             try {
137                 util = new Enhydra3AppUtil(otterProject);
138                 page = invokeCodeGenWizard(host, util);
139             } catch (CodeGenException e) {
140                 JOptionPane.showMessageDialog(host.getDialogParent(),
141                                               e.getMessage(),
142                                               ResUtil.format(res.getString("_0_Wizard"), Enhydra3AppUtil.getDisplayName()),
143                                               JOptionPane.ERROR_MESSAGE);
144             }
145         }
146         return page;
147     }
148
149     /**
150      * Method declaration
151      *
152      *
153      * @return
154      */

155     public String JavaDoc[] getSteps() {
156         Vector JavaDoc steps = new Vector JavaDoc();
157         String JavaDoc[] array = new String JavaDoc[0];
158
159         steps.addElement(res.getString("readmeEn1"));
160         steps.addElement(res.getString("readmeEn2"));
161         steps.addElement(res.getString("readmeEn3"));
162         steps.addElement(res.getString("readmeEn4"));
163         steps.addElement(res.getString("readmeEn5"));
164         array = (String JavaDoc[]) steps.toArray(array);
165         steps.removeAllElements();
166         return array;
167     }
168
169 }
170
Popular Tags