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.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 import java.util.Vector ; 51 import javax.swing.JOptionPane ; 52 import java.util.ResourceBundle ; 53 54 60 public class ServiceWizard extends AbstractCodeGenWizard { 61 62 private final String HELP_LINK = KelpInfo.getAddinHelpURL() 64 + "#appwizard"; 66 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 79 protected Wizard createWizard() { 80 ServiceWizard wizard = new ServiceWizard(); 81 82 return wizard; 83 } 84 85 91 public void update(Object source) { 92 setEnabled(true); 93 } 94 95 }; 96 97 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 118 public String getDisplayName() { 119 return ServiceUtil.getDisplayName(); 120 } 121 122 128 public String getHelpTopic() { 129 return HELP_LINK; 130 } 131 132 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 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 175 public String [] getSteps() { 176 String [] array = new String [0]; 177 return array; 178 } 179 180 } 181 | Popular Tags |