Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 150385 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (+16 lines)
Lines 167-172 Link Here
167
     </objectContribution>
167
     </objectContribution>
168
   </extension>
168
   </extension>
169
   
169
   
170
    <extension
171
      point="org.eclipse.ui.preferencePages">
172
       <page
173
             class="org.eclipse.tptp.wsdm.tooling.preferences.internal.WsdmToolingPreferencePage"
174
             id="org.eclipse.tptp.wsdm.tooling.preferences"
175
             name="Tooling for Web Services Distributed Management">
176
       </page>
177
      <page
178
            category="org.eclipse.tptp.wsdm.tooling.preferences"
179
            class="org.eclipse.tptp.wsdm.tooling.preferences.internal.Axis2ServerLocationPreferencePage"
180
            id="org.eclipse.tptp.wsdm.tooling.preferences.axis2serverlocation"
181
            name="Axis2 Server Location">
182
         MRT Preferences Page
183
      </page>
184
   </extension> 
185
  
170
   <extension
186
   <extension
171
         point="org.eclipse.ui.startup">
187
         point="org.eclipse.ui.startup">
172
      <startup
188
      <startup
(-)src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/Messages.java (-2 / +19 lines)
Lines 125-132 Link Here
125
	public static String CODE_GEN_DIR_LOCATION;
125
	public static String CODE_GEN_DIR_LOCATION;
126
	public static String MRT_CODE_GEN;
126
	public static String MRT_CODE_GEN;
127
	public static String MRT_CODE_GEN_TEXT;
127
	public static String MRT_CODE_GEN_TEXT;
128
128
	public static String CODE_GEN_AXIS2_LOCATION;
129
129
	public static String CODE_GEN_UPDATE_PREF;
130
	public static String CODE_GEN_START;
131
	public static String CODE_GEN_STEP1;
132
	public static String CODE_GEN_STEP2;
133
	public static String CODE_GEN_STEP3;
134
	public static String CODE_GEN_FAILED_ERROR;
135
	public static String CODE_GEN_SUBTASK1;
136
	public static String CODE_GEN_SUBTASK2;
137
	public static String CODE_GEN_SUBTASK3;
138
	public static String CODE_GEN_PROJECTIZER;
139
	public static String CODE_GEN_ERROR_AXIS2;
140
	public static String FAILED_TO_INITIALIZE_MUSE_DESCRIPTOR_ERROR_;
141
	public static String CODE_GEN_VALIDATE_SLOCATION;
142
	public static String CODEGEN_PREF_SERVERLOC;
143
	public static String CODE_GEN_AXIS2_PROJECT_DIR;
144
	public static String CODE_GEN_AXIS2_LOCATION_ERROR;
145
	public static String CODE_GEN_AXIS2_INSTAL_LOC_ERROR;
146
	
130
	static
147
	static
131
	{
148
	{
132
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
149
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
(-)src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties (-2 / +18 lines)
Lines 120-124 Link Here
120
CODE_GEN_DIR_LOCATION = Select the location directory.
120
CODE_GEN_DIR_LOCATION = Select the location directory.
121
MRT_CODE_GEN = Code Generation
121
MRT_CODE_GEN = Code Generation
122
MRT_CODE_GEN_TEXT = You can generate code after the creation of the MRT
122
MRT_CODE_GEN_TEXT = You can generate code after the creation of the MRT
123
123
CODE_GEN_AXIS2_LOCATION = Axis2 Server Installation Location
124
124
CODE_GEN_UPDATE_PREF = Update Preferences
125
CODE_GEN_START = Working: 
126
CODE_GEN_STEP1 = Initializing Code Generation
127
CODE_GEN_STEP2 = Merging WSDL
128
CODE_GEN_STEP3 = Creating project
129
CODE_GEN_FAILED_ERROR = Code generation failed, see Error Log
130
CODE_GEN_SUBTASK1 = Running Analyzer
131
CODE_GEN_SUBTASK2 = Running Synthesizer
132
CODE_GEN_SUBTASK3 = Running Projectizer
133
CODE_GEN_PROJECTIZER = Projectizer: 
134
CODE_GEN_ERROR_AXIS2 = Invalid Axis2 Server Location
135
FAILED_TO_INITIALIZE_MUSE_DESCRIPTOR_ERROR_ = IWAT0682E Failed to initialize muse descriptor
136
CODE_GEN_VALIDATE_SLOCATION = Validating the Server Location 
137
CODEGEN_PREF_SERVERLOC = Please specify Axis2 server location:
138
CODE_GEN_AXIS2_PROJECT_DIR = Axis2 Server directory must be specified
139
CODE_GEN_AXIS2_LOCATION_ERROR = Invalid Axis2 Server location path
140
CODE_GEN_AXIS2_INSTAL_LOC_ERROR = Invalid Axis2 Server Installation Path
(-)src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/MRTCodeGenerationDelegate.java (-4 / +4 lines)
Lines 12-18 Link Here
12
12
13
package org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional;
13
package org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional;
14
14
15
import java.io.File;
16
import java.util.ArrayList;
15
import java.util.ArrayList;
17
import java.util.HashMap;
16
import java.util.HashMap;
18
import java.util.List;
17
import java.util.List;
Lines 87-97 Link Here
87
	public DescriptorHelper run(SubProgressMonitor progressMonitor)
86
	public DescriptorHelper run(SubProgressMonitor progressMonitor)
88
			throws Exception
87
			throws Exception
89
	{
88
	{
90
		File ddFile = createDDFile();
89
		IFile ddFile = createDDFile();
91
		return new DescriptorHelper(ddFile);
90
		return new DescriptorHelper(ddFile);
92
	}
91
	}
93
92
94
	private File createDDFile()
93
	private IFile createDDFile()
95
	{
94
	{
96
		_ddFilePath = createDDFilePath();
95
		_ddFilePath = createDDFilePath();
97
96
Lines 133-139 Link Here
133
132
134
			IFile file = EclipseUtils.getIFile(ResourcesPlugin.getWorkspace()
133
			IFile file = EclipseUtils.getIFile(ResourcesPlugin.getWorkspace()
135
					.getRoot(), fileURI.toString());
134
					.getRoot(), fileURI.toString());
136
			return file.getLocation().toFile();
135
			//return file.getLocation().toFile();
136
			return file;
137
		}
137
		}
138
		catch (Exception exception)
138
		catch (Exception exception)
139
		{
139
		{
(-)src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/DescriptorHelper.java (-1 / +69 lines)
Lines 13-28 Link Here
13
package org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional;
13
package org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional;
14
14
15
import java.io.File;
15
import java.io.File;
16
16
import java.io.IOException;
17
import java.util.Collections;
17
import javax.xml.namespace.QName;
18
import javax.xml.namespace.QName;
18
19
19
import org.apache.muse.core.descriptor.DescriptorConstants;
20
import org.apache.muse.core.descriptor.DescriptorConstants;
20
import org.apache.muse.util.xml.XmlUtils;
21
import org.apache.muse.util.xml.XmlUtils;
22
import org.apache.ws.muse.descriptor.AdditionalJarsType;
23
import org.apache.ws.muse.descriptor.DescriptorPackage;
24
import org.apache.ws.muse.descriptor.DocumentRoot;
25
import org.apache.ws.muse.descriptor.RootType;
21
import org.eclipse.core.resources.IFile;
26
import org.eclipse.core.resources.IFile;
22
import org.eclipse.core.resources.IWorkspace;
27
import org.eclipse.core.resources.IWorkspace;
23
import org.eclipse.core.resources.IWorkspaceRoot;
28
import org.eclipse.core.resources.IWorkspaceRoot;
24
import org.eclipse.core.resources.ResourcesPlugin;
29
import org.eclipse.core.resources.ResourcesPlugin;
25
import org.eclipse.core.runtime.IPath;
30
import org.eclipse.core.runtime.IPath;
31
import org.eclipse.emf.common.util.URI;
32
import org.eclipse.emf.ecore.resource.Resource;
33
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
34
import org.eclipse.tptp.wsdm.tooling.editor.dde.util.internal.DdeUtil;
35
import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages;
36
import org.eclipse.tptp.wsdm.tooling.util.internal.MyDescriptorResourceFactoryImpl;
37
import org.eclipse.tptp.wsdm.tooling.util.internal.WsdmToolingLog;
26
import org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal.NewMrtWizard;
38
import org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal.NewMrtWizard;
27
import org.w3c.dom.Document;
39
import org.w3c.dom.Document;
28
import org.w3c.dom.Element;
40
import org.w3c.dom.Element;
Lines 87-92 Link Here
87
	 * useless "Pair" class.
99
	 * useless "Pair" class.
88
	 */
100
	 */
89
	private Object[][] _instances;
101
	private Object[][] _instances;
102
	
103
	private IFile ddIFile;
90
104
91
	/**
105
	/**
92
	 * A do-something constructor. Take a file, if that file is null, then load
106
	 * A do-something constructor. Take a file, if that file is null, then load
Lines 101-106 Link Here
101
	public DescriptorHelper(IFile descriptorFile) throws Exception
115
	public DescriptorHelper(IFile descriptorFile) throws Exception
102
	{
116
	{
103
		this(new File(descriptorFile.getLocation().toString()));
117
		this(new File(descriptorFile.getLocation().toString()));
118
		ddIFile = descriptorFile;
104
	}
119
	}
105
120
106
	/**
121
	/**
Lines 357-360 Link Here
357
	{
372
	{
358
		return fileName.substring(0, fileName.lastIndexOf(".")) + MRT_EXTN;
373
		return fileName.substring(0, fileName.lastIndexOf(".")) + MRT_EXTN;
359
	}
374
	}
375
	
376
	/**
377
	 * Adds the additional jar files to Descriptor file.
378
	 *  
379
	 * @param serverLocation
380
	 * 			Parent directory of Axis2-lib folder.
381
	 * 
382
	 * @param axis2files
383
	 * 			Axis2 jar files path.
384
	 */
385
	public void addAdditionalJars(String serverLocation, String[] axis2files)
386
	{
387
		DocumentRoot root = DdeUtil.getDocRoot(ddIFile);
388
		RootType rootType = root.getRoot();
389
		AdditionalJarsType additionalJars = rootType.getAdditionalJars();
390
		for(int i = 0 ; i < axis2files.length ; i++ )
391
			additionalJars.getJarPath().add(serverLocation + File.separator + axis2files[i]);
392
		rootType.setAdditionalJars(additionalJars);
393
		root.setRoot(rootType);
394
		save(root);
395
	}
396
	
397
	private void save(DocumentRoot root)
398
	{
399
		ensureMusePackagePresent();
400
		URI ddFileURI = URI.createPlatformResourceURI(ddIFile.getFullPath().toString());
401
		ResourceSetImpl rsImpl = new ResourceSetImpl();
402
		rsImpl.getResourceFactoryRegistry().getExtensionToFactoryMap()
403
		.put(Resource.Factory.Registry.DEFAULT_EXTENSION,
404
				new MyDescriptorResourceFactoryImpl());
405
		rsImpl.getPackageRegistry().put(DescriptorPackage.eNS_URI,
406
		DescriptorPackage.eINSTANCE);
407
		Resource ddRes = rsImpl.getResource(ddFileURI, true);
408
		ddRes.getContents().remove(0);
409
		ddRes.getContents().add(root);
410
		try 
411
		{
412
			ddRes.save(Collections.EMPTY_MAP);
413
		} 
414
		catch (IOException e) 
415
		{
416
			e.printStackTrace();
417
		}
418
	}
419
	
420
	private void ensureMusePackagePresent()
421
	{
422
		// Ensure EMF knows about Muse descriptor
423
		if (DescriptorPackage.eINSTANCE == null)
424
		{
425
			WsdmToolingLog.logError(Messages.FAILED_TO_INITIALIZE_MUSE_DESCRIPTOR_ERROR_, new Throwable());
426
		}
427
	} 	
360
}
428
}
(-)src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationOptionsPage.java (-2 / +36 lines)
Lines 110-115 Link Here
110
	private Map _servicePorts;
110
	private Map _servicePorts;
111
	private Map _servicePaths;
111
	private Map _servicePaths;
112
112
113
	private boolean axis2Project;
114
	
113
	/**
115
	/**
114
	 * For cheatsheet purpose only This constructor will be used in cheatsheet
116
	 * For cheatsheet purpose only This constructor will be used in cheatsheet
115
	 * only
117
	 * only
Lines 184-194 Link Here
184
		page.setLayoutData(gd);
186
		page.setLayoutData(gd);
185
187
186
		Label projectizerLabel = new Label(page, SWT.NONE);
188
		Label projectizerLabel = new Label(page, SWT.NONE);
187
		projectizerLabel.setText("Projectizer: ");
189
		projectizerLabel.setText(Messages.CODE_GEN_PROJECTIZER);
188
		_projectizerCombo = makeProjectizerCombo(page);
190
		_projectizerCombo = makeProjectizerCombo(page);
189
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
191
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
190
		data.widthHint = 50;
192
		data.widthHint = 50;
191
		_projectizerCombo.setLayoutData(data);
193
		_projectizerCombo.setLayoutData(data);
194
		_projectizerCombo.addListener(SWT.Modify, comboChangeListener);
192
195
193
		Label blankLabel = new Label(page, SWT.NONE);
196
		Label blankLabel = new Label(page, SWT.NONE);
194
		blankLabel.setText(" ");
197
		blankLabel.setText(" ");
Lines 517-522 Link Here
517
		}
520
		}
518
	};
521
	};
519
522
523
	private Listener comboChangeListener = new Listener() {
524
		public void handleEvent(Event e) {
525
		   	dialogChanged();
526
		}
527
	};
528
	
520
	void setLocationForSelection()
529
	void setLocationForSelection()
521
	{
530
	{
522
		// _locationArea.updateProjectName(getProjectNameFieldValue());
531
		// _locationArea.updateProjectName(getProjectNameFieldValue());
Lines 608-614 Link Here
608
			updateStatus(Messages.HOOKUP_WIZARD_ERROR_2);
617
			updateStatus(Messages.HOOKUP_WIZARD_ERROR_2);
609
			return;
618
			return;
610
		}
619
		}
611
620
		
621
		canFlipToNextPage();
622
		
612
		updateStatus(null, DialogPage.NONE);
623
		updateStatus(null, DialogPage.NONE);
613
	}
624
	}
614
625
Lines 738-743 Link Here
738
		}
749
		}
739
		return baseAddress;
750
		return baseAddress;
740
	}
751
	}
752
	
753
	/**
754
	 * Checks to see if the Next Page can be enabled or not.
755
	 */
756
	public boolean canFlipToNextPage(){
757
		if(isPageComplete() && _projectizerCombo.getText().indexOf("Axis")!=-1)
758
		{
759
			axis2Project = true;
760
			((Axis2ServerLocationPage)this.getNextPage()).makePageComplete(false);
761
			return true;
762
		}
763
		((Axis2ServerLocationPage)this.getNextPage()).makePageComplete(true);
764
		axis2Project = false;
765
		return false;
766
	}
767
768
	/**
769
	 * Returns whether the new Project to be created is a Axis2 project
770
	 * @return
771
	 */
772
	public boolean isAxis2Project(){
773
		return axis2Project;
774
	}	
741
}
775
}
742
776
743
// Not used currently
777
// Not used currently
(-)src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/NewProjectWizard.java (-18 / +66 lines)
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
}
(-)src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/Axis2ServerLocationPage.java (+241 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 * 	Balan Subramanian (bsubram@us.ibm.com)
10
 *     IBM Corporation - initial API and implementation
11
 *******************************************************************************/
12
13
package org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional;
14
15
import java.io.File;
16
17
import org.eclipse.jface.preference.IPreferenceStore;
18
import org.eclipse.jface.wizard.WizardPage;
19
import org.eclipse.osgi.util.TextProcessor;
20
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.events.ModifyEvent;
22
import org.eclipse.swt.events.ModifyListener;
23
import org.eclipse.swt.events.SelectionAdapter;
24
import org.eclipse.swt.events.SelectionEvent;
25
import org.eclipse.swt.layout.GridData;
26
import org.eclipse.swt.layout.GridLayout;
27
import org.eclipse.swt.widgets.Button;
28
import org.eclipse.swt.widgets.Composite;
29
import org.eclipse.swt.widgets.DirectoryDialog;
30
import org.eclipse.swt.widgets.Label;
31
import org.eclipse.swt.widgets.Text;
32
import org.eclipse.tptp.wsdm.tooling.editor.internal.Activator;
33
import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages;
34
import org.eclipse.tptp.wsdm.tooling.preferences.internal.Axis2ServerLocationPreferencePage;
35
36
/**
37
 * This is Wizard Page to show the Axis2 server location details
38
 *
39
 */
40
public class Axis2ServerLocationPage extends WizardPage
41
{
42
	
43
	private Text _serverNameField;
44
	private Button _browseButton;
45
	private Button _preferenceUpdate;
46
	private final String[] axis2files = {"lib/axis2-adb-1.1.1.jar",
47
			"lib/axis2-codegen-1.1.1.jar","lib/axis2-java2wsdl-1.1.1.jar"};
48
49
	/**
50
	 * Instantiates the class.
51
	 */
52
	public Axis2ServerLocationPage() 
53
	{
54
		super("wizardPage");
55
		setTitle(Messages.HOOKUP_WIZARD_TXT1);
56
		setDescription(Messages.HOOKUP_WIZARD_TXT2);
57
	}
58
59
	/**
60
	 *  Creates wizard controls.
61
	 */
62
	public void createControl(Composite parent) 
63
	{
64
		Composite page = new Composite(parent, SWT.NULL);
65
		GridLayout layout = new GridLayout(1, false);
66
		page.setLayout(layout);
67
		createPageControls(page);
68
		//dialogChanged();
69
		setControl(page);
70
	}
71
72
	private void createPageControls(Composite page) 
73
	{
74
		Composite column = new Composite(page, SWT.NULL);
75
		GridLayout layout = new GridLayout(2, false);
76
		column.setLayout(layout);
77
		createServerLocationColumn(column);
78
	}
79
80
	private void createServerLocationColumn(Composite parent) 
81
	{
82
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
83
		data.horizontalSpan = 2;
84
        // new server location label
85
        Label serverLabel = new Label(parent, SWT.NONE);
86
        serverLabel.setText(Messages.CODE_GEN_AXIS2_LOCATION);
87
        serverLabel.setFont(parent.getFont());
88
        serverLabel.setLayoutData(data);
89
90
		// server location entry field
91
        data = new GridData(GridData.FILL_HORIZONTAL);
92
        data.widthHint = 350;
93
        data.horizontalSpan = 1;
94
        _serverNameField = new Text(parent, SWT.BORDER);
95
        _serverNameField.setLayoutData(data);
96
        _serverNameField.setFont(parent.getFont());
97
        _serverNameField.addModifyListener(new ModifyListener()
98
		{
99
			public void modifyText(ModifyEvent e)
100
			{
101
				boolean pageCompleted = true;
102
				String errorMsg = validateLocation(); 
103
				if(errorMsg == null)
104
				{
105
					setErrorMessage(errorMsg);
106
					pageCompleted = true;
107
				}
108
				else
109
				{
110
					setErrorMessage(errorMsg);
111
					pageCompleted = false;
112
				}
113
				makePageComplete(pageCompleted);
114
			}
115
		});
116
        
117
        _serverNameField.setText(getPreferenceServerLocation());
118
119
        // browse button
120
		_browseButton = new Button(parent, SWT.PUSH);
121
		_browseButton.setText(Messages.HOOKUP_WIZARD_TXT5);
122
		_browseButton.addSelectionListener(new SelectionAdapter() 
123
		{
124
			public void widgetSelected(SelectionEvent event) 
125
			{
126
				handleLocationBrowseButtonPressed();
127
			}
128
		});
129
		
130
		// server location entry field
131
        data = new GridData(GridData.FILL_HORIZONTAL);
132
        //data.widthHint = 350;
133
        data.horizontalSpan = 2;
134
        _preferenceUpdate = new Button(parent, SWT.CHECK);
135
        _preferenceUpdate.setText(Messages.CODE_GEN_UPDATE_PREF);
136
        _preferenceUpdate.setLayoutData(data);
137
        _preferenceUpdate.setFont(parent.getFont());		
138
	}
139
	
140
	private String getPreferenceServerLocation() 
141
	{
142
		IPreferenceStore store = Activator.getPlugin().getPreferenceStore();
143
		String location = store.getString(Axis2ServerLocationPreferencePage.SERVER_LOCATION_PREFERENCE_KEY).trim();
144
		if(location != null && !location.equals(""))
145
			return location;
146
		return "";
147
	}
148
149
	private void handleLocationBrowseButtonPressed() 
150
	{
151
152
		String selectedDirectory = null;
153
154
		DirectoryDialog dialog = new DirectoryDialog(_serverNameField.getShell());
155
		dialog.setMessage(Messages.CODE_GEN_DIR_LOCATION);
156
		//dialog.setFilterPath(dirName);
157
		selectedDirectory = dialog.open();
158
		
159
		if (selectedDirectory != null)
160
			updateLocationField(selectedDirectory);
161
162
	}
163
	
164
	private void updateLocationField(String selectedPath) 
165
	{
166
		_serverNameField.setText(TextProcessor.process(selectedPath));
167
	}
168
169
	/**
170
	 * Returns the server location.
171
	 * @return
172
	 */
173
	public String getServerLocation() 
174
	{
175
		return _serverNameField.getText();
176
	}
177
178
	/**
179
	 * Checks to see if Update Preferences checkbox is selected
180
	 * @return
181
	 */
182
	public boolean isUpdatePreference()
183
	{
184
		return _preferenceUpdate.getSelection();
185
	}
186
	
187
	private String validateLocation()
188
	{
189
		String locationFieldContents = _serverNameField.getText();
190
		if (locationFieldContents.length() == 0)
191
			return(Messages.CODE_GEN_AXIS2_PROJECT_DIR);
192
		
193
		java.io.File newPath = new java.io.File(_serverNameField.getText());
194
		if (!newPath.exists())
195
			return(Messages.CODE_GEN_AXIS2_LOCATION_ERROR);
196
		
197
		if(newPath.exists())
198
		{
199
			// Step 2 : Check for Axis2 installation libraries
200
			boolean found = true;
201
			
202
			for(int i = 0 ; i < axis2files.length ; i++)
203
			{
204
				File axisFile = new File(locationFieldContents+ File.separator+axis2files[i]);
205
				if(axisFile.exists())
206
					continue;
207
				else
208
				{
209
					found = false;
210
					break;
211
				}
212
			}
213
			if(!found)
214
			{
215
				return Messages.CODE_GEN_AXIS2_INSTAL_LOC_ERROR;
216
			}
217
		}
218
		return null;
219
	}
220
	
221
	/**
222
	 * Returns the Axis2 files
223
	 * @return
224
	 */
225
	public String[] getAxis2Files()
226
	{
227
		return axis2files;
228
	}
229
230
	/**
231
	 * Method to Set the Wizard page to complete state
232
	 * @param validPage 
233
	 */
234
	public void makePageComplete(boolean completePage)
235
	{
236
		if(completePage)
237
			setPageComplete(true);
238
		else
239
			setPageComplete(false);		
240
	}
241
}
(-)src/org/eclipse/tptp/wsdm/tooling/preferences/internal/Axis2ServerLocationPreferencePage.java (+150 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 * 	Balan Subramanian (bsubram@us.ibm.com)
10
 *     IBM Corporation - initial API and implementation
11
 *******************************************************************************/
12
13
package org.eclipse.tptp.wsdm.tooling.preferences.internal;
14
15
import org.eclipse.jface.preference.IPreferenceStore;
16
import org.eclipse.jface.preference.PreferencePage;
17
import org.eclipse.jface.resource.ImageDescriptor;
18
import org.eclipse.osgi.util.TextProcessor;
19
import org.eclipse.swt.SWT;
20
import org.eclipse.swt.events.SelectionAdapter;
21
import org.eclipse.swt.events.SelectionEvent;
22
import org.eclipse.swt.layout.GridData;
23
import org.eclipse.swt.layout.GridLayout;
24
import org.eclipse.swt.widgets.Button;
25
import org.eclipse.swt.widgets.Composite;
26
import org.eclipse.swt.widgets.Control;
27
import org.eclipse.swt.widgets.DirectoryDialog;
28
import org.eclipse.swt.widgets.Label;
29
import org.eclipse.swt.widgets.Text;
30
import org.eclipse.tptp.wsdm.tooling.editor.internal.Activator;
31
import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages;
32
import org.eclipse.ui.IWorkbench;
33
import org.eclipse.ui.IWorkbenchPreferencePage;
34
35
/**
36
 * The class is used to create the Preference page for the MRT Editor.
37
 * It is used to set Axis2 Server Location.
38
 *
39
 */
40
public class Axis2ServerLocationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage 
41
{
42
43
	private Text _serverLocation;
44
	
45
	private Button _browseButton;
46
	
47
	public static final String SERVER_LOCATION_PREFERENCE_KEY = "MRT_CODE_GEN.AXIS2_SERVER_LOCATION";
48
	
49
	/**
50
	 * 
51
	 */
52
	public Axis2ServerLocationPreferencePage() 
53
	{
54
		init();
55
	}
56
57
	/**
58
	 * 
59
	 * @param title
60
	 */
61
	public Axis2ServerLocationPreferencePage(String title) 
62
	{
63
		super(title);
64
		init();
65
	}
66
67
	public Axis2ServerLocationPreferencePage(String title, ImageDescriptor image) 
68
	{
69
		super(title, image);
70
		init();
71
	}
72
73
	protected Control createContents(Composite parent) 
74
	{
75
		Composite composite = new Composite(parent, SWT.NONE);
76
		GridLayout layout = new GridLayout();
77
		layout.numColumns = 2;
78
		composite.setLayout(layout);
79
		
80
		GridData data = new GridData();
81
		data.horizontalSpan = 2;
82
		data.grabExcessHorizontalSpace = true;
83
		Label label = new Label(composite, SWT.NONE);
84
		label.setLayoutData(data);
85
		String labelText = Messages.CODEGEN_PREF_SERVERLOC;
86
		label.setText(labelText);
87
		
88
		IPreferenceStore store = Activator.getPlugin().getPreferenceStore();
89
		String ss = store.getString(SERVER_LOCATION_PREFERENCE_KEY);
90
		data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
91
		data.grabExcessHorizontalSpace = true;
92
		data.horizontalSpan = 1;
93
		data.widthHint = 240;
94
	
95
		_serverLocation = new Text(composite, SWT.BORDER);
96
		_serverLocation.setLayoutData(data);
97
		
98
		String runtime = "";
99
		if (runtime != null || runtime.length() > 0)
100
			_serverLocation.setText(ss);
101
		else
102
			_serverLocation.setText("");
103
		
104
		_browseButton = new Button(composite, SWT.PUSH);
105
		_browseButton.setText(Messages.HOOKUP_WIZARD_TXT5);
106
		_browseButton.addSelectionListener(new SelectionAdapter() 
107
		{
108
			public void widgetSelected(SelectionEvent event) 
109
			{
110
				handleLocationBrowseButtonPressed();
111
			}
112
		});		
113
		return composite;
114
	}
115
116
	public void init(IWorkbench workbench) 
117
	{
118
	}
119
	
120
	private void handleLocationBrowseButtonPressed() 
121
	{
122
		String selectedDirectory = null;
123
		DirectoryDialog dialog = new DirectoryDialog(_serverLocation.getShell());
124
		dialog.setMessage(Messages.CODE_GEN_DIR_LOCATION);
125
		selectedDirectory = dialog.open();
126
		
127
		if (selectedDirectory != null)
128
			_serverLocation.setText(TextProcessor.process(selectedDirectory));
129
	}
130
		
131
	protected void performDefaults() 
132
	{
133
		super.performDefaults();
134
		IPreferenceStore store = Activator.getPlugin().getPreferenceStore();
135
		String defaultValue = store.getDefaultString(SERVER_LOCATION_PREFERENCE_KEY);
136
		_serverLocation.setText(defaultValue);
137
    }
138
139
	protected void performApply()
140
	{
141
		IPreferenceStore store = Activator.getPlugin().getPreferenceStore();
142
		store.setValue(SERVER_LOCATION_PREFERENCE_KEY,_serverLocation.getText());
143
	}
144
145
	private void init()
146
	{
147
		IPreferenceStore store = Activator.getPlugin().getPreferenceStore();
148
		store.setDefault(SERVER_LOCATION_PREFERENCE_KEY,"");
149
	}
150
}
(-)src/org/eclipse/tptp/wsdm/tooling/preferences/internal/WsdmToolingPreferencePage.java (+43 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 * 	Balan Subramanian (bsubram@us.ibm.com)
10
 *     IBM Corporation - initial API and implementation
11
 *******************************************************************************/
12
13
package org.eclipse.tptp.wsdm.tooling.preferences.internal;
14
15
import org.eclipse.jface.preference.FieldEditorPreferencePage;
16
import org.eclipse.tptp.wsdm.tooling.editor.internal.Activator;
17
import org.eclipse.ui.IWorkbench;
18
import org.eclipse.ui.IWorkbenchPreferencePage;
19
20
/**
21
 * Parent category for WSDM Tooling preferences. 
22
 */
23
24
public class WsdmToolingPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage
25
{
26
27
	public WsdmToolingPreferencePage() 
28
	{
29
        super(FieldEditorPreferencePage.GRID);
30
        setPreferenceStore(Activator.getPlugin().getPreferenceStore());
31
        //setDescription("Tooling for Web Services Distributed Management");
32
    }
33
34
    protected void createFieldEditors() 
35
    {
36
        // Do nothing
37
    }
38
39
    public void init(IWorkbench workbench) 
40
    {
41
    	// do nothing
42
    }    
43
}

Return to bug 150385