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 200193 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jst/ws/internal/creation/ui/extension/ServiceRootFragment.java (-2 / +4 lines)
Lines 12-17 Link Here
12
 * 20060131 121071   rsinha@ca.ibm.com - Rupam Kuehner     
12
 * 20060131 121071   rsinha@ca.ibm.com - Rupam Kuehner     
13
 * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
13
 * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
14
 * 20060331   128827 kathy@ca.ibm.com - Kathy Chan
14
 * 20060331   128827 kathy@ca.ibm.com - Kathy Chan
15
 * 20071212	  200193 gilberta@ca.ibm.com - Gilbert Andrews
15
 *******************************************************************************/
16
 *******************************************************************************/
16
17
17
package org.eclipse.jst.ws.internal.creation.ui.extension;
18
package org.eclipse.jst.ws.internal.creation.ui.extension;
Lines 98-107 Link Here
98
		
99
		
99
		//Mappings from framework to framework commands
100
		//Mappings from framework to framework commands
100
  	registry.addMapping( PreServiceDevelopCommand.class, "WebService", PreServiceAssembleCommand.class );
101
  	registry.addMapping( PreServiceDevelopCommand.class, "WebService", PreServiceAssembleCommand.class );
101
		registry.addMapping( PreServiceDevelopCommand.class, "Project", PreServiceAssembleCommand.class );
102
	registry.addMapping( PreServiceDevelopCommand.class, "Project", PreServiceAssembleCommand.class );
102
  	registry.addMapping( PreServiceDevelopCommand.class, "Module", PreServiceAssembleCommand.class );
103
  	registry.addMapping( PreServiceDevelopCommand.class, "Module", PreServiceAssembleCommand.class );
103
		registry.addMapping( PreServiceDevelopCommand.class, "EarProject", PreServiceAssembleCommand.class );
104
	registry.addMapping( PreServiceDevelopCommand.class, "EarProject", PreServiceAssembleCommand.class );
104
  	registry.addMapping( PreServiceDevelopCommand.class, "Ear", PreServiceAssembleCommand.class );
105
  	registry.addMapping( PreServiceDevelopCommand.class, "Ear", PreServiceAssembleCommand.class );
106
  	registry.addMapping( PreServiceDevelopCommand.class, "InitialProject", PreServiceAssembleCommand.class );
105
  	registry.addMapping( PreServiceDevelopCommand.class, "Context", PreServiceAssembleCommand.class );
107
  	registry.addMapping( PreServiceDevelopCommand.class, "Context", PreServiceAssembleCommand.class );
106
		
108
		
107
    registry.addMapping( PreServiceDevelopCommand.class, "Context", PreServiceDeployCommand.class );
109
    registry.addMapping( PreServiceDevelopCommand.class, "Context", PreServiceDeployCommand.class );
(-)src/org/eclipse/jst/ws/internal/creation/ui/extension/PreServiceDevelopCommand.java (-1 / +37 lines)
Lines 16-37 Link Here
16
 * 20070123   167487 makandre@ca.ibm.com - Andrew Mak
16
 * 20070123   167487 makandre@ca.ibm.com - Andrew Mak
17
 * 20070403   173654 kathy@ca.ibm.com - Kathy Chan
17
 * 20070403   173654 kathy@ca.ibm.com - Kathy Chan
18
 * 20070509   182274 kathy@ca.ibm.com - Kathy Chan
18
 * 20070509   182274 kathy@ca.ibm.com - Kathy Chan
19
 * 20071212	  200193 gilberta@ca.ibm.com - Gilbert Andrews
20
 * 20071220   213640 kathy@ca.ibm.com - Kathy Chan
19
 *******************************************************************************/
21
 *******************************************************************************/
20
22
21
package org.eclipse.jst.ws.internal.creation.ui.extension;
23
package org.eclipse.jst.ws.internal.creation.ui.extension;
22
24
25
import java.io.IOException;
26
23
import org.eclipse.core.resources.IProject;
27
import org.eclipse.core.resources.IProject;
24
import org.eclipse.core.resources.ResourcesPlugin;
28
import org.eclipse.core.resources.ResourcesPlugin;
29
import org.eclipse.core.runtime.CoreException;
25
import org.eclipse.core.runtime.IAdaptable;
30
import org.eclipse.core.runtime.IAdaptable;
26
import org.eclipse.core.runtime.IProgressMonitor;
31
import org.eclipse.core.runtime.IProgressMonitor;
27
import org.eclipse.core.runtime.IStatus;
32
import org.eclipse.core.runtime.IStatus;
28
import org.eclipse.core.runtime.Status;
33
import org.eclipse.core.runtime.Status;
34
import org.eclipse.jst.ws.internal.common.J2EEUtils;
29
import org.eclipse.jst.ws.internal.consumption.command.common.CreateFacetedProjectCommand;
35
import org.eclipse.jst.ws.internal.consumption.command.common.CreateFacetedProjectCommand;
30
import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
36
import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
31
import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
37
import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
38
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
32
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceRuntimeDescriptor;
39
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceRuntimeDescriptor;
33
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
40
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
34
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
41
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
42
import org.eclipse.osgi.util.NLS;
43
import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
35
import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
44
import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
36
import org.eclipse.wst.common.environment.IEnvironment;
45
import org.eclipse.wst.common.environment.IEnvironment;
37
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
46
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
Lines 57-62 Link Here
57
  private String			moduleType_;
66
  private String			moduleType_;
58
  private String			earProject_;
67
  private String			earProject_;
59
  private String            ear_;
68
  private String            ear_;
69
  private IProject			initialProject_;
60
	
70
	
61
  private IWebService       webService_;
71
  private IWebService       webService_;
62
  private String            j2eeLevel_;
72
  private String            j2eeLevel_;
Lines 166-172 Link Here
166
		        	}      
176
		        	}      
167
		        }
177
		        }
168
		  }
178
		  }
169
	  }
179
	  
180
	  
181
		  if(initialProject_ != null && FacetUtils.isJavaProject(initialProject_)){
182
			  J2EEUtils.addJavaProjectAsUtilityJar(initialProject_, project, monitor);
183
			  try{
184
		  		String uri = initialProject_.getName() + ".jar";
185
		  		J2EEUtils.addJAROrModuleDependency(project, uri);
186
			  } catch (CoreException ce){
187
				  String errorMessage = NLS.bind(ConsumptionUIMessages.MSG_ERROR_MODULE_DEPENDENCY, new String[]{project.getName(), initialProject_.getName()});
188
				  IStatus errorStatus = StatusUtils.errorStatus(errorMessage);
189
				  environment.getStatusHandler().reportError(errorStatus);
190
			  } catch (IOException ioe){
191
				  String errorMessage = NLS.bind(ConsumptionUIMessages.MSG_ERROR_MODULE_DEPENDENCY, new String[]{project.getName(), initialProject_.getName()});
192
				  IStatus errorStatus = StatusUtils.errorStatus(errorMessage);
193
				  environment.getStatusHandler().reportError(errorStatus);					
194
			  }		
195
		  }
196
	}
170
	  return status;
197
	  return status;
171
198
172
  }
199
  }
Lines 288-292 Link Here
288
    client_ = genProxy;  
315
    client_ = genProxy;  
289
  }	
316
  }	
290
	
317
	
318
  public void setInitialProject(IProject initialProject)
319
  {
320
	  initialProject_ = initialProject;  
321
  }	
322
    
323
  public IProject getInitialProject()
324
  {
325
	  return initialProject_;  
326
  }	
291
327
292
}
328
}
(-)src/org/eclipse/jst/ws/internal/creation/ui/extension/PreServiceAssembleCommand.java (+30 lines)
Lines 14-31 Link Here
14
 * 20060524   141925 kathy@ca.ibm.com - Kathy Chan
14
 * 20060524   141925 kathy@ca.ibm.com - Kathy Chan
15
 * 20060529   141422 kathy@ca.ibm.com - Kathy Chan
15
 * 20060529   141422 kathy@ca.ibm.com - Kathy Chan
16
 * 20070509   182274 kathy@ca.ibm.com - Kathy Chan
16
 * 20070509   182274 kathy@ca.ibm.com - Kathy Chan
17
 * 20071218	  200193 gilberta@ca.ibm.com - Gilbert Andrews
18
 * 20071220   213640 kathy@ca.ibm.com - Kathy Chan
17
 *******************************************************************************/
19
 *******************************************************************************/
18
20
19
package org.eclipse.jst.ws.internal.creation.ui.extension;
21
package org.eclipse.jst.ws.internal.creation.ui.extension;
20
22
23
import java.io.IOException;
24
25
import org.eclipse.core.resources.IProject;
26
import org.eclipse.core.resources.ResourcesPlugin;
27
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.IAdaptable;
28
import org.eclipse.core.runtime.IAdaptable;
22
import org.eclipse.core.runtime.IProgressMonitor;
29
import org.eclipse.core.runtime.IProgressMonitor;
23
import org.eclipse.core.runtime.IStatus;
30
import org.eclipse.core.runtime.IStatus;
24
import org.eclipse.core.runtime.Status;
31
import org.eclipse.core.runtime.Status;
25
import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
32
import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
33
import org.eclipse.jst.ws.internal.common.J2EEUtils;
26
import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand;
34
import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand;
27
import org.eclipse.jst.ws.internal.consumption.command.common.CreateFacetedProjectCommand;
35
import org.eclipse.jst.ws.internal.consumption.command.common.CreateFacetedProjectCommand;
36
import org.eclipse.jst.ws.internal.consumption.common.FacetUtils;
28
import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
37
import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion;
38
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages;
39
import org.eclipse.osgi.util.NLS;
40
import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
29
import org.eclipse.wst.common.environment.IEnvironment;
41
import org.eclipse.wst.common.environment.IEnvironment;
30
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
42
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
31
import org.eclipse.wst.ws.internal.plugin.WSPlugin;
43
import org.eclipse.wst.ws.internal.plugin.WSPlugin;
Lines 43-48 Link Here
43
	private String						earProject_;
55
	private String						earProject_;
44
  private String            ear_;
56
  private String            ear_;
45
  private IContext          context_;
57
  private IContext          context_;
58
  private IProject		initialProject_;
46
59
47
  public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
60
  public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable )
48
  {
61
  {
Lines 106-115 Link Here
106
			  environment.getStatusHandler().reportError(status);		  
119
			  environment.getStatusHandler().reportError(status);		  
107
		  }			
120
		  }			
108
121
122
		  //make sure the ear file has been created.
123
		  
124
		  if(initialProject_ != null && FacetUtils.isJavaProject(initialProject_)) {
125
			  IProject earProject = ResourcesPlugin.getWorkspace().getRoot().getProject(earProject_);
126
			  J2EEUtils.addJavaProjectAsUtilityJar(initialProject_, earProject, monitor);
127
		  }		 
128
	  
109
	  }
129
	  }
110
	  return status;	  
130
	  return status;	  
111
  }
131
  }
112
	
132
	
133
  public void setInitialProject(IProject initialProject)
134
  {
135
	  initialProject_ = initialProject;  
136
  }	
137
    
138
  public IProject getInitialProject()
139
  {
140
	  return initialProject_;  
141
  }	
142
  
113
  public void setProject( String project )
143
  public void setProject( String project )
114
  {
144
  {
115
	  project_ = project;
145
	  project_ = project;
(-)src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidgetDefaultingCommand.java (-1 / +10 lines)
Lines 20-25 Link Here
20
 * 20060525   143843 joan@ca.ibm.com - Joan Haggarty
20
 * 20060525   143843 joan@ca.ibm.com - Joan Haggarty
21
 * 20060905   156230 kathy@ca.ibm.com - Kathy Chan, Handling projects with no target runtime
21
 * 20060905   156230 kathy@ca.ibm.com - Kathy Chan, Handling projects with no target runtime
22
 * 20070319	  159458 mahutch@ca.ibm.com - Mark Hutchinson added in some null checks
22
 * 20070319	  159458 mahutch@ca.ibm.com - Mark Hutchinson added in some null checks
23
 * 20071212	  200193 gilberta@ca.ibm.com - Gilbert Andrews
23
 *******************************************************************************/
24
 *******************************************************************************/
24
package org.eclipse.jst.ws.internal.creation.ui.widgets.runtime;
25
package org.eclipse.jst.ws.internal.creation.ui.widgets.runtime;
25
26
Lines 295-301 Link Here
295
  {
296
  {
296
    //Choose an existing server the module is already associated with if possible
297
    //Choose an existing server the module is already associated with if possible
297
    IProject serviceProject = ResourcesPlugin.getWorkspace().getRoot().getProject(serviceProjectName_);
298
    IProject serviceProject = ResourcesPlugin.getWorkspace().getRoot().getProject(serviceProjectName_);
298
    IServer[] configuredServers = ServerUtil.getServersByModule(ServerUtils.getModule(serviceProject), null);
299
    IServer[] configuredServers = null;
300
    if(serviceProject.exists())
301
    	configuredServers = ServerUtil.getServersByModule(ServerUtils.getModule(serviceProject), null);
302
    
299
    if (configuredServers!=null && configuredServers.length>0)
303
    if (configuredServers!=null && configuredServers.length>0)
300
    {
304
    {
301
      serviceIds_.setServerId(configuredServers[0].getServerType().getId());
305
      serviceIds_.setServerId(configuredServers[0].getServerType().getId());
Lines 552-557 Link Here
552
    initialProject_ = initialProject;
556
    initialProject_ = initialProject;
553
  }
557
  }
554
  
558
  
559
  public IProject getInitialProject()
560
  {
561
    return initialProject_;  
562
  }
563
  
555
  public void setInitialComponentName(String name)
564
  public void setInitialComponentName(String name)
556
  {
565
  {
557
    //TODO This method and any mappings to it
566
    //TODO This method and any mappings to it
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %PLUGIN_NAME
3
Bundle-Name: %PLUGIN_NAME
4
Bundle-SymbolicName: org.eclipse.jst.ws.creation.ui; singleton:=true
4
Bundle-SymbolicName: org.eclipse.jst.ws.creation.ui; singleton:=true
5
Bundle-Version: 1.0.205.qualifier
5
Bundle-Version: 1.0.206.qualifier
6
Bundle-Activator: org.eclipse.jst.ws.internal.creation.ui.plugin.WebServiceCreationUIPlugin
6
Bundle-Activator: org.eclipse.jst.ws.internal.creation.ui.plugin.WebServiceCreationUIPlugin
7
Bundle-Vendor: %PLUGIN_PROVIDER
7
Bundle-Vendor: %PLUGIN_PROVIDER
8
Bundle-Localization: plugin
8
Bundle-Localization: plugin
(-)src/org/eclipse/jst/ws/internal/creation/ui/widgets/binding/ServerWidgetBinding.java (+1 lines)
Lines 524-529 Link Here
524
      dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "GenerateProxy", ClientFragment.class);
524
      dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "GenerateProxy", ClientFragment.class);
525
      dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "GenerateProxy", ClientExtensionDefaultingCommand.class);
525
      dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "GenerateProxy", ClientExtensionDefaultingCommand.class);
526
      dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceNeedEAR", ServerExtensionDefaultingCommand.class);
526
      dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ServiceNeedEAR", ServerExtensionDefaultingCommand.class);
527
      dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "InitialProject", PreServiceDevelopCommand.class );
527
      dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientNeedEAR", ClientExtensionDefaultingCommand.class);
528
      dataRegistry.addMapping(ServerRuntimeSelectionWidgetDefaultingCommand.class, "ClientNeedEAR", ClientExtensionDefaultingCommand.class);
528
      
529
      
529
      dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "InstallService", ServerExtensionDefaultingCommand.class);  
530
      dataRegistry.addMapping( ServerWizardWidgetOutputCommand.class, "InstallService", ServerExtensionDefaultingCommand.class);  
(-)src/org/eclipse/jst/ws/internal/common/J2EEUtils.java (+59 lines)
Lines 14-24 Link Here
14
 * 20060503   126819 rsinha@ca.ibm.com - Rupam Kuehner
14
 * 20060503   126819 rsinha@ca.ibm.com - Rupam Kuehner
15
 * 20060524   131132 mahutch@ca.ibm.com - Mark Hutchinson
15
 * 20060524   131132 mahutch@ca.ibm.com - Mark Hutchinson
16
 * 20070723   194434 kathy@ca.ibm.com - Kathy Chan, Check for non-existing EAR with content not deleted
16
 * 20070723   194434 kathy@ca.ibm.com - Kathy Chan, Check for non-existing EAR with content not deleted
17
 * 20071218	  200193 gilberta@ca.ibm.com - Gilbert Andrews
18
 * 20071221   213726 kathy@ca.ibm.com - Kathy Chan
17
 *******************************************************************************/
19
 *******************************************************************************/
18
20
19
package org.eclipse.jst.ws.internal.common;
21
package org.eclipse.jst.ws.internal.common;
20
22
23
import java.io.IOException;
21
import java.util.ArrayList;
24
import java.util.ArrayList;
25
import java.util.Collection;
26
import java.util.Collections;
22
import java.util.Iterator;
27
import java.util.Iterator;
23
import java.util.List;
28
import java.util.List;
24
import java.util.Set;
29
import java.util.Set;
Lines 33-38 Link Here
33
import org.eclipse.core.resources.ResourcesPlugin;
38
import org.eclipse.core.resources.ResourcesPlugin;
34
import org.eclipse.core.runtime.CoreException;
39
import org.eclipse.core.runtime.CoreException;
35
import org.eclipse.core.runtime.IPath;
40
import org.eclipse.core.runtime.IPath;
41
import org.eclipse.core.runtime.IProgressMonitor;
36
import org.eclipse.core.runtime.IStatus;
42
import org.eclipse.core.runtime.IStatus;
37
import org.eclipse.core.runtime.NullProgressMonitor;
43
import org.eclipse.core.runtime.NullProgressMonitor;
38
import org.eclipse.core.runtime.Path;
44
import org.eclipse.core.runtime.Path;
Lines 40-45 Link Here
40
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
46
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
41
import org.eclipse.jem.util.logger.proxy.Logger;
47
import org.eclipse.jem.util.logger.proxy.Logger;
42
import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
48
import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
49
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
43
import org.eclipse.jst.j2ee.ejb.EJBJar;
50
import org.eclipse.jst.j2ee.ejb.EJBJar;
44
import org.eclipse.jst.j2ee.ejb.EJBResource;
51
import org.eclipse.jst.j2ee.ejb.EJBResource;
45
import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
52
import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
Lines 48-59 Link Here
48
import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit;
55
import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit;
49
import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
56
import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
50
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
57
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
58
import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
51
import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
59
import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
52
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
60
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
61
import org.eclipse.jst.j2ee.project.facet.IJavaProjectMigrationDataModelProperties;
62
import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationDataModelProvider;
53
import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
63
import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
54
import org.eclipse.wst.common.componentcore.ComponentCore;
64
import org.eclipse.wst.common.componentcore.ComponentCore;
55
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
65
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
56
import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
66
import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
67
import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
68
import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
57
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
69
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
58
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
70
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
59
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
71
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
Lines 1419-1422 Link Here
1419
		return status;
1431
		return status;
1420
    }
1432
    }
1421
	
1433
	
1434
1435
	 public static void addJAROrModuleDependency(IProject project, String uri) throws IOException, CoreException
1436
	  {
1437
	    if (J2EEUtils.isWebComponent(project))
1438
	    {
1439
	      ArchiveManifest manifest = J2EEProjectUtilities.readManifest(project);
1440
	      manifest.mergeClassPath(new String[]{uri});
1441
	      J2EEProjectUtilities.writeManifest(project, manifest);
1442
	      forceClasspathUpdate(project);
1443
	    }
1444
	  }
1445
	  
1446
	  public static void addJavaProjectAsUtilityJar(IProject javaProject, IProject earProject,IProgressMonitor monitor)
1447
	  {
1448
		  try {
1449
			  IDataModel migrationdm = DataModelFactory.createDataModel(new JavaProjectMigrationDataModelProvider());
1450
			  migrationdm.setProperty(IJavaProjectMigrationDataModelProperties.PROJECT_NAME, javaProject.getName());
1451
			  migrationdm.setProperty(IJavaProjectMigrationDataModelProperties.ADD_TO_EAR, Boolean.FALSE);
1452
			  migrationdm.getDefaultOperation().execute(monitor, null);
1453
	 
1454
	 
1455
			  IDataModel refdm = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
1456
			  List targetCompList = (List) refdm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
1457
	 
1458
			  IVirtualComponent targetcomponent = ComponentCore.createComponent(javaProject);
1459
			  IVirtualComponent sourcecomponent = ComponentUtilities.getComponent(earProject.getName());
1460
			  targetCompList.add(targetcomponent);
1461
	 
1462
			  refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT,sourcecomponent );
1463
			  refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetCompList);
1464
			  refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH,  "/WEB-INF/lib");
1465
			  refdm.getDefaultOperation().execute(monitor, null);
1466
			  
1467
			  forceClasspathUpdate(earProject);
1468
			  
1469
		  }catch (Exception e) {
1470
			  
1471
		  }
1472
	  }
1473
	  
1474
	//Forcing classpath update
1475
	  public static void forceClasspathUpdate (IProject project) {
1476
		  J2EEComponentClasspathUpdater classpathUpdater = J2EEComponentClasspathUpdater.getInstance();
1477
		  Collection projCollection = Collections.singleton(project);
1478
		  classpathUpdater.forceUpdate(projCollection, false);
1479
	  }
1480
1422
}
1481
}
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %PLUGIN_NAME
3
Bundle-Name: %PLUGIN_NAME
4
Bundle-SymbolicName: org.eclipse.jst.ws
4
Bundle-SymbolicName: org.eclipse.jst.ws
5
Bundle-Version: 1.0.204.qualifier
5
Bundle-Version: 1.0.205.qualifier
6
Bundle-Activator: org.eclipse.jst.ws.internal.plugin.WebServicePlugin
6
Bundle-Activator: org.eclipse.jst.ws.internal.plugin.WebServicePlugin
7
Bundle-Vendor: %PLUGIN_PROVIDER
7
Bundle-Vendor: %PLUGIN_PROVIDER
8
Bundle-Localization: plugin
8
Bundle-Localization: plugin
(-)src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java (-76 / +5 lines)
Lines 12-40 Link Here
12
 * 20060324   122799 rsinha@ca.ibm.com - Rupam Kuehner
12
 * 20060324   122799 rsinha@ca.ibm.com - Rupam Kuehner
13
 * 20060503   138478 rsinha@ca.ibm.com - Rupam Kuehner
13
 * 20060503   138478 rsinha@ca.ibm.com - Rupam Kuehner
14
 * 20060510   141115 rsinha@ca.ibm.com - Rupam Kuehner
14
 * 20060510   141115 rsinha@ca.ibm.com - Rupam Kuehner
15
 * 20071212	  200193 gilberta@ca.ibm.com - Gilbert Andrews
15
 *******************************************************************************/
16
 *******************************************************************************/
16
package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample;
17
package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample;
17
18
18
import java.io.IOException;
19
import java.io.IOException;
19
import java.util.List;
20
20
21
import org.eclipse.core.resources.IProject;
21
import org.eclipse.core.resources.IProject;
22
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.IAdaptable;
23
import org.eclipse.core.runtime.IAdaptable;
24
import org.eclipse.core.runtime.IProgressMonitor;
24
import org.eclipse.core.runtime.IProgressMonitor;
25
import org.eclipse.core.runtime.IStatus;
25
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.NullProgressMonitor;
27
import org.eclipse.core.runtime.Status;
26
import org.eclipse.core.runtime.Status;
28
import org.eclipse.jdt.core.IClasspathEntry;
29
import org.eclipse.jdt.core.IJavaProject;
30
import org.eclipse.jdt.core.JavaCore;
31
import org.eclipse.jdt.core.JavaModelException;
32
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
27
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
33
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
34
import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
28
import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
35
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
36
import org.eclipse.jst.j2ee.project.facet.IJavaProjectMigrationDataModelProperties;
37
import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationDataModelProvider;
38
import org.eclipse.jst.ws.internal.common.J2EEUtils;
29
import org.eclipse.jst.ws.internal.common.J2EEUtils;
39
import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand;
30
import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand;
40
import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand;
31
import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand;
Lines 45-59 Link Here
45
import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils;
36
import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils;
46
import org.eclipse.osgi.util.NLS;
37
import org.eclipse.osgi.util.NLS;
47
import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
38
import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
48
import org.eclipse.wst.common.componentcore.ComponentCore;
49
import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
50
import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
51
import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
52
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
53
import org.eclipse.wst.common.environment.IEnvironment;
39
import org.eclipse.wst.common.environment.IEnvironment;
54
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
40
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
55
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
56
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
57
import org.eclipse.wst.ws.internal.wsrt.TestInfo;
41
import org.eclipse.wst.ws.internal.wsrt.TestInfo;
58
42
59
public class AddModuleDependenciesCommand extends AbstractDataModelOperation
43
public class AddModuleDependenciesCommand extends AbstractDataModelOperation
Lines 203-216 Link Here
203
187
204
		if (clientIProject != null && !J2EEUtils.isWebComponent(clientIProject)) {
188
		if (clientIProject != null && !J2EEUtils.isWebComponent(clientIProject)) {
205
			if (J2EEUtils.isJavaComponent(clientIProject)) {				
189
			if (J2EEUtils.isJavaComponent(clientIProject)) {				
206
				addJavaProjectAsUtilityJar(clientIProject, sampleEARIProject, monitor);
190
				J2EEUtils.addJavaProjectAsUtilityJar(clientIProject, sampleEARIProject, monitor);
207
				addJavaProjectAsUtilityJar(clientIProject, sampleIProject,monitor);
191
				J2EEUtils.addJavaProjectAsUtilityJar(clientIProject, sampleIProject,monitor);
208
			}
192
			}
209
193
210
				try
194
				try
211
				{
195
				{
212
				  String uri = clientIProject.getName() + ".jar";
196
				  String uri = clientIProject.getName() + ".jar";
213
				  addJAROrModuleDependency(sampleIProject, uri);
197
				  J2EEUtils.addJAROrModuleDependency(sampleIProject, uri);
214
				} catch (CoreException ce)
198
				} catch (CoreException ce)
215
				{
199
				{
216
					String errorMessage = NLS.bind(ConsumptionUIMessages.MSG_ERROR_MODULE_DEPENDENCY, new String[]{sampleIProject.getName(), clientIProject.getName()});
200
					String errorMessage = NLS.bind(ConsumptionUIMessages.MSG_ERROR_MODULE_DEPENDENCY, new String[]{sampleIProject.getName(), clientIProject.getName()});
Lines 223-292 Link Here
223
					env.getStatusHandler().reportError(errorStatus);					
207
					env.getStatusHandler().reportError(errorStatus);					
224
				}							
208
				}							
225
			
209
			
226
			try {		
210
			
227
				addBuildPath(sampleIProject, clientIProject);
228
			} catch (JavaModelException jme) {
229
				// Do nothing in this catch block. The worst that
230
				// will happen is that the sample Web project
231
				// will show some compile errors. The sample will
232
				// likely still launch successfully on the server
233
				// and the user will be able to use it.
234
			}
235
		}      	  
211
		}      	  
236
    
212
    
237
    return Status.OK_STATUS;
213
    return Status.OK_STATUS;
238
  }
214
  }
239
  
215
  
240
  private void addJAROrModuleDependency(IProject project, String uri) throws IOException, CoreException
241
  {
242
    if (J2EEUtils.isWebComponent(project))
243
    {
244
      ArchiveManifest manifest = J2EEProjectUtilities.readManifest(project);
245
      manifest.mergeClassPath(new String[]{uri});
246
      J2EEProjectUtilities.writeManifest(project, manifest);
247
    }
248
  }
249
  
250
  private void addJavaProjectAsUtilityJar(IProject javaProject, IProject earProject,IProgressMonitor monitor)
251
  {
252
	  try {
253
		  IDataModel migrationdm = DataModelFactory.createDataModel(new JavaProjectMigrationDataModelProvider());
254
		  migrationdm.setProperty(IJavaProjectMigrationDataModelProperties.PROJECT_NAME, javaProject.getName());
255
		  migrationdm.getDefaultOperation().execute(monitor, null);
256
 
257
 
258
		  IDataModel refdm = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
259
		  List targetCompList = (List) refdm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
260
 
216
 
261
		  IVirtualComponent targetcomponent = ComponentCore.createComponent(javaProject);
262
		  IVirtualComponent sourcecomponent = ComponentUtilities.getComponent(earProject.getName());
263
		  targetCompList.add(targetcomponent);
264
 
265
		  refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT,sourcecomponent );
266
		  refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetCompList);
267
		  refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH,  "/WEB-INF/lib");
268
		  refdm.getDefaultOperation().execute(monitor, null);
269
	  }catch (Exception e) {
270
		  
271
	  }
272
  }
273
217
274
  
218
  
275
  private void addBuildPath(IProject referencingProject, IProject referencedProject) throws JavaModelException
276
  {
277
    IJavaProject javaProject = JavaCore.create(referencingProject);
278
    if (javaProject != null)
279
    {
280
      IClasspathEntry[] oldCp = javaProject.getRawClasspath();
281
	  IClasspathEntry[] newCp = new IClasspathEntry[oldCp.length + 1];
282
	  for (int i = 0; i < oldCp.length; i++)
283
        newCp[i] = oldCp[i];
284
	  newCp[newCp.length - 1] = JavaCore.newProjectEntry(referencedProject.getFullPath());
285
	  javaProject.setRawClasspath(newCp, new NullProgressMonitor());
286
    }
287
  }
288
 
289
290
  public static final String DEFAULT_SAMPLE_EAR_PROJECT_EXT = "EAR";
219
  public static final String DEFAULT_SAMPLE_EAR_PROJECT_EXT = "EAR";
291
 
220
 
292
}
221
}

Return to bug 200193