|
Lines 30-41
Link Here
|
| 30 |
import org.eclipse.core.runtime.SubProgressMonitor; |
30 |
import org.eclipse.core.runtime.SubProgressMonitor; |
| 31 |
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; |
31 |
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; |
| 32 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
32 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
|
|
33 |
import org.eclipse.jface.preference.IPreferenceStore; |
| 33 |
import org.eclipse.jface.resource.ImageDescriptor; |
34 |
import org.eclipse.jface.resource.ImageDescriptor; |
| 34 |
import org.eclipse.jface.viewers.IStructuredSelection; |
35 |
import org.eclipse.jface.viewers.IStructuredSelection; |
| 35 |
import org.eclipse.jface.wizard.Wizard; |
36 |
import org.eclipse.jface.wizard.Wizard; |
| 36 |
import org.eclipse.swt.graphics.Image; |
37 |
import org.eclipse.swt.graphics.Image; |
|
|
38 |
import org.eclipse.tptp.wsdm.tooling.editor.internal.Activator; |
| 37 |
import org.eclipse.tptp.wsdm.tooling.editor.mrt.internal.ManageableResourceTypeEditorPlugin; |
39 |
import org.eclipse.tptp.wsdm.tooling.editor.mrt.internal.ManageableResourceTypeEditorPlugin; |
| 38 |
import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages; |
40 |
import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages; |
|
|
41 |
import org.eclipse.tptp.wsdm.tooling.preferences.internal.Axis2ServerLocationPreferencePage; |
| 39 |
import org.eclipse.tptp.wsdm.tooling.util.internal.EclipseUtils; |
42 |
import org.eclipse.tptp.wsdm.tooling.util.internal.EclipseUtils; |
| 40 |
import org.eclipse.ui.INewWizard; |
43 |
import org.eclipse.ui.INewWizard; |
| 41 |
import org.eclipse.ui.IWorkbench; |
44 |
import org.eclipse.ui.IWorkbench; |
|
Lines 55-60
Link Here
|
| 55 |
|
58 |
|
| 56 |
private GenerationOptionsPage _generationOptionsPage; |
59 |
private GenerationOptionsPage _generationOptionsPage; |
| 57 |
|
60 |
|
|
|
61 |
private Axis2ServerLocationPage _axis2ServerLocationPage; |
| 62 |
|
| 58 |
private String _projectName; |
63 |
private String _projectName; |
| 59 |
|
64 |
|
| 60 |
private boolean _overwrite; |
65 |
private boolean _overwrite; |
|
Lines 73-78
Link Here
|
| 73 |
|
78 |
|
| 74 |
private DescriptorHelper _helper; |
79 |
private DescriptorHelper _helper; |
| 75 |
|
80 |
|
|
|
81 |
private String _serverLocation; |
| 82 |
|
| 83 |
private boolean _isAxis2Project; |
| 84 |
private boolean updatePreference; |
| 85 |
|
| 86 |
java.net.URI _projectLocation; |
| 87 |
|
| 88 |
/** |
| 89 |
* Class that creates the Code Generation Wizard to create new Project |
| 90 |
* @param codeGenerationDelegate |
| 91 |
*/ |
| 76 |
public NewProjectWizard(CodeGenerationDelegate codeGenerationDelegate) |
92 |
public NewProjectWizard(CodeGenerationDelegate codeGenerationDelegate) |
| 77 |
{ |
93 |
{ |
| 78 |
setWindowTitle(Messages.HOOKUP_WIZARD_TXT7); |
94 |
setWindowTitle(Messages.HOOKUP_WIZARD_TXT7); |
|
Lines 85-90
Link Here
|
| 85 |
{ |
101 |
{ |
| 86 |
_generationOptionsPage = new GenerationOptionsPage(); |
102 |
_generationOptionsPage = new GenerationOptionsPage(); |
| 87 |
addPage(_generationOptionsPage); |
103 |
addPage(_generationOptionsPage); |
|
|
104 |
|
| 105 |
_axis2ServerLocationPage = new Axis2ServerLocationPage(); |
| 106 |
addPage(_axis2ServerLocationPage); |
| 88 |
|
107 |
|
| 89 |
// TODO AME why is this hardcoded here? why is it getting reloaded? |
108 |
// TODO AME why is this hardcoded here? why is it getting reloaded? |
| 90 |
Image imgTP = EclipseUtils.loadImage(PlatformUI.getWorkbench() |
109 |
Image imgTP = EclipseUtils.loadImage(PlatformUI.getWorkbench() |
|
Lines 99-112
Link Here
|
| 99 |
{ |
118 |
{ |
| 100 |
try |
119 |
try |
| 101 |
{ |
120 |
{ |
| 102 |
monitor.beginTask("Working: ", 6); |
121 |
monitor.beginTask(Messages.CODE_GEN_START, 6); |
| 103 |
|
122 |
|
|
|
123 |
if(_isAxis2Project) |
| 124 |
{ |
| 125 |
try |
| 126 |
{ |
| 127 |
// Step 1: Validate the server path |
| 128 |
monitor.subTask(Messages.CODE_GEN_VALIDATE_SLOCATION); |
| 129 |
// Step 2 : Update the Preferences, if needed |
| 130 |
if(updatePreference) |
| 131 |
{ |
| 132 |
IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); |
| 133 |
store.setValue(Axis2ServerLocationPreferencePage.SERVER_LOCATION_PREFERENCE_KEY,_serverLocation); |
| 134 |
} |
| 135 |
} |
| 136 |
catch(Exception e) |
| 137 |
{ |
| 138 |
throw new RuntimeException(e); |
| 139 |
} |
| 140 |
} |
| 104 |
try |
141 |
try |
| 105 |
{ |
142 |
{ |
| 106 |
// TODO AME externalize string |
143 |
monitor.subTask(Messages.CODE_GEN_STEP1); |
| 107 |
monitor.subTask("Initializing Code Generation"); |
|
|
| 108 |
_helper = _codeGenerationDelegate.run(new SubProgressMonitor( |
144 |
_helper = _codeGenerationDelegate.run(new SubProgressMonitor( |
| 109 |
monitor, 1)); |
145 |
monitor, 1)); |
|
|
146 |
// Step 3 : Copy the axis2 files for CodeGeneration |
| 147 |
String[] axis2files = _axis2ServerLocationPage.getAxis2Files(); |
| 148 |
if(_isAxis2Project) |
| 149 |
_helper.addAdditionalJars(_serverLocation, axis2files); |
| 110 |
monitor.worked(1); |
150 |
monitor.worked(1); |
| 111 |
} |
151 |
} |
| 112 |
catch (Exception e) |
152 |
catch (Exception e) |
|
Lines 119-126
Link Here
|
| 119 |
|
159 |
|
| 120 |
try |
160 |
try |
| 121 |
{ |
161 |
{ |
| 122 |
// TODO AME externalize string |
162 |
monitor.subTask(Messages.CODE_GEN_STEP2); |
| 123 |
monitor.subTask("Merging WSDL"); |
|
|
| 124 |
_mergedWsdlDocuments = _helper.getWsdlDocuments(_baseAddress); |
163 |
_mergedWsdlDocuments = _helper.getWsdlDocuments(_baseAddress); |
| 125 |
monitor.worked(1); |
164 |
monitor.worked(1); |
| 126 |
} |
165 |
} |
|
Lines 131-145
Link Here
|
| 131 |
|
170 |
|
| 132 |
try |
171 |
try |
| 133 |
{ |
172 |
{ |
| 134 |
// TODO AME externalize string |
173 |
monitor.subTask(Messages.CODE_GEN_STEP3); |
| 135 |
monitor.subTask("Creating project"); |
|
|
| 136 |
runProjectizer(monitor); |
174 |
runProjectizer(monitor); |
| 137 |
monitor.worked(1); |
175 |
monitor.worked(1); |
| 138 |
} |
176 |
} |
| 139 |
catch (Exception e) |
177 |
catch (Exception e) |
| 140 |
{ |
178 |
{ |
| 141 |
throw new InvocationTargetException(new Exception( |
179 |
throw new InvocationTargetException(new Exception( |
| 142 |
"Code generation failed, see Error Log", e)); |
180 |
Messages.CODE_GEN_FAILED_ERROR, e)); |
| 143 |
} |
181 |
} |
| 144 |
} |
182 |
} |
| 145 |
finally |
183 |
finally |
|
Lines 161-167
Link Here
|
| 161 |
_overwrite = _generationOptionsPage.isOverwrite(); |
199 |
_overwrite = _generationOptionsPage.isOverwrite(); |
| 162 |
_projectName = _generationOptionsPage.getProjectName(); |
200 |
_projectName = _generationOptionsPage.getProjectName(); |
| 163 |
_baseAddress = _generationOptionsPage.getBaseAddress(); |
201 |
_baseAddress = _generationOptionsPage.getBaseAddress(); |
| 164 |
|
202 |
_isAxis2Project = _generationOptionsPage.isAxis2Project(); |
|
|
203 |
|
| 204 |
_projectLocation = _generationOptionsPage.getProjectLocationURI(); |
| 205 |
|
| 206 |
if(_isAxis2Project) |
| 207 |
{ |
| 208 |
_serverLocation = _axis2ServerLocationPage.getServerLocation(); |
| 209 |
updatePreference = _axis2ServerLocationPage.isUpdatePreference(); |
| 210 |
} |
| 211 |
|
| 165 |
IRunnableWithProgress runnable = new IRunnableWithProgress() |
212 |
IRunnableWithProgress runnable = new IRunnableWithProgress() |
| 166 |
{ |
213 |
{ |
| 167 |
public void run(IProgressMonitor monitor) |
214 |
public void run(IProgressMonitor monitor) |
|
Lines 178-191
Link Here
|
| 178 |
} |
225 |
} |
| 179 |
catch (Exception e) |
226 |
catch (Exception e) |
| 180 |
{ |
227 |
{ |
| 181 |
// TODO AME externalize string |
|
|
| 182 |
e.printStackTrace(); |
228 |
e.printStackTrace(); |
| 183 |
handle("Code generation failed, see Error Log", e); |
229 |
handle(Messages.CODE_GEN_FAILED_ERROR, e); |
| 184 |
} |
230 |
} |
| 185 |
|
231 |
|
| 186 |
return false; |
232 |
return false; |
| 187 |
} |
233 |
} |
| 188 |
|
234 |
|
|
|
235 |
|
| 189 |
/* |
236 |
/* |
| 190 |
* (non-Javadoc) |
237 |
* (non-Javadoc) |
| 191 |
* |
238 |
* |
|
Lines 234-255
Link Here
|
| 234 |
|
281 |
|
| 235 |
data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR, |
282 |
data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR, |
| 236 |
new SubProgressMonitor(monitor, 1)); |
283 |
new SubProgressMonitor(monitor, 1)); |
| 237 |
// TODO AME externalize string |
284 |
|
| 238 |
monitor.subTask("Running Analyzer"); |
285 |
monitor.subTask(Messages.CODE_GEN_SUBTASK1); |
| 239 |
data = _analyzer.analyze(data); |
286 |
data = _analyzer.analyze(data); |
| 240 |
monitor.worked(1); |
287 |
monitor.worked(1); |
| 241 |
|
288 |
|
| 242 |
data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR, |
289 |
data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR, |
| 243 |
new SubProgressMonitor(monitor, 1)); |
290 |
new SubProgressMonitor(monitor, 1)); |
| 244 |
// TODO AME externalize string |
291 |
|
| 245 |
monitor.subTask("Running Synthesizer"); |
292 |
monitor.subTask(Messages.CODE_GEN_SUBTASK2); |
| 246 |
data = _synthesizer.synthesize(data); |
293 |
data = _synthesizer.synthesize(data); |
| 247 |
monitor.worked(1); |
294 |
monitor.worked(1); |
| 248 |
|
295 |
|
| 249 |
data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR, |
296 |
data.addParameter(EclipseConfigurationData.PROGRESS_MONITOR, |
| 250 |
new SubProgressMonitor(monitor, 1)); |
297 |
new SubProgressMonitor(monitor, 1)); |
| 251 |
// TODO AME externalize string |
298 |
|
| 252 |
monitor.subTask("Running Projectizer"); |
299 |
monitor.subTask(Messages.CODE_GEN_SUBTASK3); |
| 253 |
_projectizer.projectize(data); |
300 |
_projectizer.projectize(data); |
| 254 |
monitor.worked(1); |
301 |
monitor.worked(1); |
| 255 |
} |
302 |
} |
|
Lines 272-275
Link Here
|
| 272 |
} |
319 |
} |
| 273 |
LOG.log(status); |
320 |
LOG.log(status); |
| 274 |
} |
321 |
} |
|
|
322 |
|
| 275 |
} |
323 |
} |