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.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 import javax.swing.JOptionPane ; 52 import java.util.Vector ; 53 import java.util.ResourceBundle ; 54 55 61 public class Enhydra3AppWizard extends AbstractCodeGenWizard { 62 63 private final String HELP_LINK = KelpInfo.getAddinHelpURL(); 66 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 78 protected Wizard createWizard() { 79 Enhydra3AppWizard wizard = new Enhydra3AppWizard(); 80 81 return wizard; 82 } 83 84 89 public void update(Object source) { 90 setEnabled(true); 91 } 92 93 }; 94 95 102 public static void initOpenTool(byte majorVersion, byte minorVersion) { 103 WizardManager.registerWizardAction(WIZARD_Enhydra3AppWizard); 104 } 105 106 113 public String getHelpTopic() { 114 return HELP_LINK; 115 } 116 117 public String 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 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 155 public String [] getSteps() { 156 Vector steps = new Vector (); 157 String [] array = new String [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 []) steps.toArray(array); 165 steps.removeAllElements(); 166 return array; 167 } 168 169 } 170 | Popular Tags |