|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2007, 2008 IBM Corporation and others. |
2 |
* Copyright (c) 2007, 2009 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 15-20
Link Here
|
| 15 |
* 20080325 222473 makandre@ca.ibm.com - Andrew Mak, Create EAR version based on the version of modules to be added |
15 |
* 20080325 222473 makandre@ca.ibm.com - Andrew Mak, Create EAR version based on the version of modules to be added |
| 16 |
* 20080429 213730 trungha@ca.ibm.com - Trung Ha |
16 |
* 20080429 213730 trungha@ca.ibm.com - Trung Ha |
| 17 |
* 20080507 229532 kathy@ca.ibm.com - Kathy Chan |
17 |
* 20080507 229532 kathy@ca.ibm.com - Kathy Chan |
|
|
18 |
* 20090818 286859 zina@ca.ibm.com - Zina Mostafia |
| 18 |
*******************************************************************************/ |
19 |
*******************************************************************************/ |
| 19 |
|
20 |
|
| 20 |
package org.eclipse.jst.ws.internal.consumption.common; |
21 |
package org.eclipse.jst.ws.internal.consumption.common; |
|
Lines 30-39
Link Here
|
| 30 |
import org.eclipse.core.resources.IProject; |
31 |
import org.eclipse.core.resources.IProject; |
| 31 |
import org.eclipse.core.resources.ResourcesPlugin; |
32 |
import org.eclipse.core.resources.ResourcesPlugin; |
| 32 |
import org.eclipse.core.runtime.CoreException; |
33 |
import org.eclipse.core.runtime.CoreException; |
|
|
34 |
import org.eclipse.core.runtime.IPath; |
| 33 |
import org.eclipse.core.runtime.IProgressMonitor; |
35 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 34 |
import org.eclipse.core.runtime.IStatus; |
36 |
import org.eclipse.core.runtime.IStatus; |
|
|
37 |
import org.eclipse.core.runtime.Path; |
| 35 |
import org.eclipse.core.runtime.Platform; |
38 |
import org.eclipse.core.runtime.Platform; |
| 36 |
import org.eclipse.core.runtime.Status; |
39 |
import org.eclipse.core.runtime.Status; |
|
|
40 |
import org.eclipse.jdt.core.IClasspathEntry; |
| 37 |
import org.eclipse.jdt.core.IJavaProject; |
41 |
import org.eclipse.jdt.core.IJavaProject; |
| 38 |
import org.eclipse.jdt.core.JavaCore; |
42 |
import org.eclipse.jdt.core.JavaCore; |
| 39 |
import org.eclipse.jem.util.emf.workbench.ProjectUtilities; |
43 |
import org.eclipse.jem.util.emf.workbench.ProjectUtilities; |
|
Lines 776-781
Link Here
|
| 776 |
try |
780 |
try |
| 777 |
{ |
781 |
{ |
| 778 |
fproject.modify(actions, shellMonitor); |
782 |
fproject.modify(actions, shellMonitor); |
|
|
783 |
fixEJBClassPath(fproject); |
| 779 |
} catch (CoreException e) |
784 |
} catch (CoreException e) |
| 780 |
{ |
785 |
{ |
| 781 |
status[0] = getErrorStatusForAddingFacets(fproject.getProject().getName(), projectFacetVersions, e); |
786 |
status[0] = getErrorStatusForAddingFacets(fproject.getProject().getName(), projectFacetVersions, e); |
|
Lines 802-807
Link Here
|
| 802 |
try |
807 |
try |
| 803 |
{ |
808 |
{ |
| 804 |
fproject.modify(actions, null); |
809 |
fproject.modify(actions, null); |
|
|
810 |
fixEJBClassPath(fproject); |
| 805 |
} catch (CoreException e) |
811 |
} catch (CoreException e) |
| 806 |
{ |
812 |
{ |
| 807 |
status[0] = getErrorStatusForAddingFacets(fproject.getProject().getName(), projectFacetVersions, e); |
813 |
status[0] = getErrorStatusForAddingFacets(fproject.getProject().getName(), projectFacetVersions, e); |
|
Lines 811-817
Link Here
|
| 811 |
return status[0]; |
817 |
return status[0]; |
| 812 |
} |
818 |
} |
| 813 |
|
819 |
|
| 814 |
/** |
820 |
protected static void fixEJBClassPath(IFacetedProject project) { |
|
|
821 |
if (!J2EEUtils.isEJBComponent(project.getProject())) return; |
| 822 |
IProject ejbProject = project.getProject(); |
| 823 |
IJavaProject javaProject = JavaCore.create(ejbProject); |
| 824 |
Path projectRoot = new Path(Path.ROOT.append(new Path(ejbProject.getName())).toString()); |
| 825 |
IPath ejbModulePath = projectRoot.append("ejbModule"); |
| 826 |
try { |
| 827 |
IClasspathEntry[] originalSet = javaProject.getRawClasspath(); |
| 828 |
boolean foundEJBModulEntry = false; |
| 829 |
for (int i = 0; i < originalSet.length ; i++) { |
| 830 |
if (originalSet[i].equals(ejbModulePath)) |
| 831 |
foundEJBModulEntry = true; |
| 832 |
} |
| 833 |
if (!foundEJBModulEntry) { |
| 834 |
IClasspathEntry[] newSet = new IClasspathEntry[originalSet.length + 1]; |
| 835 |
for (int i = 0; i < originalSet.length ; i++) { |
| 836 |
newSet[i] = originalSet[i]; |
| 837 |
} |
| 838 |
newSet[originalSet.length] = JavaCore.newSourceEntry(ejbModulePath); |
| 839 |
javaProject.setRawClasspath(newSet,null); |
| 840 |
} |
| 841 |
} |
| 842 |
catch (Exception e) { |
| 843 |
// TODO: handle exception |
| 844 |
} |
| 845 |
|
| 846 |
} |
| 847 |
|
| 848 |
/** |
| 815 |
* Returns an error status indicating that the facet versions could not be |
849 |
* Returns an error status indicating that the facet versions could not be |
| 816 |
* added to the faceted project |
850 |
* added to the faceted project |
| 817 |
* |
851 |
* |