1 23 package org.enhydra.kelp.jbuilder.wizard; 24 25 import org.enhydra.tool.ToolBoxInfo; 27 28 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 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 import java.util.Vector ; 51 import javax.swing.JOptionPane ; 52 import java.util.ResourceBundle ; 53 54 60 public class WebAppWizard extends AbstractCodeGenWizard { 61 62 private final String HELP_LINK = KelpInfo.getAddinHelpURL(); 65 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 78 protected Wizard createWizard() { 79 WebAppWizard wizard = new WebAppWizard(); 80 81 return wizard; 82 } 83 84 90 public void update(Object source) { 91 setEnabled(true); 92 } 93 94 }; 95 96 103 public static void initOpenTool(byte majorVersion, byte minorVersion) { 104 WizardManager.registerWizardAction(WIZARD_EnhydraAppWizard); 105 } 106 107 113 public String getDisplayName() { 114 return WebAppUtil.getDisplayName(); 115 } 116 117 123 public String getHelpTopic() { 124 return HELP_LINK; 125 } 126 127 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 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 170 public String [] getSteps() { 171 Vector steps = new Vector (); 172 String [] array = new String [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 []) steps.toArray(array); 180 steps.removeAllElements(); 181 return array; 182 } 183 184 } 185 | Popular Tags |