KickJava   Java API By Example, From Geeks To Geeks.

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


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.ServiceUtil;
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 ServiceWizard extends AbstractCodeGenWizard {
61
62     // string not to be resourced
63
private final String JavaDoc HELP_LINK = KelpInfo.getAddinHelpURL()
64                                            + "#appwizard"; // nores
65

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

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

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

104     public static void initOpenTool(byte majorVersion, byte minorVersion) {
105         if (KelpInfo.isToolBoxInClassPath()) {
106            if (! ToolBoxInfo.isEnhydra3()) {
107               WizardManager.registerWizardAction(WIZARD_EnhydraServiceWizard);
108             }
109         }
110     }
111
112     /**
113      * Method declaration
114      *
115      *
116      * @return
117      */

118     public String JavaDoc getDisplayName() {
119         return ServiceUtil.getDisplayName();
120     }
121
122     /**
123      * Method declaration
124      *
125      *
126      * @return
127      */

128     public String JavaDoc getHelpTopic() {
129         return HELP_LINK;
130     }
131
132     /**
133      * Method declaration
134      *
135      *
136      * @param host
137      *
138      * @return
139      */

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

175     public String JavaDoc[] getSteps() {
176         String JavaDoc[] array = new String JavaDoc[0];
177         return array;
178     }
179
180 }
181
Popular Tags