|
Lines 16-22
Link Here
|
| 16 |
import org.eclipse.core.resources.IFile; |
16 |
import org.eclipse.core.resources.IFile; |
| 17 |
import org.eclipse.core.runtime.CoreException; |
17 |
import org.eclipse.core.runtime.CoreException; |
| 18 |
import org.eclipse.core.runtime.IAdaptable; |
18 |
import org.eclipse.core.runtime.IAdaptable; |
| 19 |
import org.eclipse.core.runtime.IPath; |
|
|
| 20 |
import org.eclipse.core.runtime.IProgressMonitor; |
19 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 21 |
import org.eclipse.core.runtime.IStatus; |
20 |
import org.eclipse.core.runtime.IStatus; |
| 22 |
import org.eclipse.core.runtime.Path; |
21 |
import org.eclipse.core.runtime.Path; |
|
Lines 99-113
Link Here
|
| 99 |
} |
98 |
} |
| 100 |
|
99 |
|
| 101 |
if(moduleURI != null) { |
100 |
if(moduleURI != null) { |
| 102 |
IPath path1 = new Path(ref.getArchiveName()); |
101 |
if(!removeModule(application, module)){ |
| 103 |
IPath path2 = new Path(moduleURI); |
|
|
| 104 |
boolean removed = false; |
| 105 |
if(path1.lastSegment().equals(path2.lastSegment())) { |
| 106 |
if(removeModule(application, module)){ |
| 107 |
removed = true; |
| 108 |
} |
| 109 |
} |
| 110 |
if(!removed) { |
| 111 |
module = null; |
102 |
module = null; |
| 112 |
moduleURI = null; |
103 |
moduleURI = null; |
| 113 |
} |
104 |
} |
|
Lines 116-122
Link Here
|
| 116 |
} |
107 |
} |
| 117 |
|
108 |
|
| 118 |
if(module == null) { |
109 |
if(module == null) { |
| 119 |
if(ref != null) |
110 |
if(ref != null && ref.getArchiveName() != null) |
| 120 |
module = getModuleFromURI(earModel, ref.getArchiveName()); |
111 |
module = getModuleFromURI(earModel, ref.getArchiveName()); |
| 121 |
else { |
112 |
else { |
| 122 |
String uri = getModuleURI(earModel, wc); |
113 |
String uri = getModuleURI(earModel, wc); |
|
Lines 200-205
Link Here
|
| 200 |
protected Object getModule(final IEARModelProvider earModel, final ReferencedComponent refComp) { |
191 |
protected Object getModule(final IEARModelProvider earModel, final ReferencedComponent refComp) { |
| 201 |
Object app = earModel.getModelObject(); |
192 |
Object app = earModel.getModelObject(); |
| 202 |
Object moduleObj = refComp.getDependentObject(); |
193 |
Object moduleObj = refComp.getDependentObject(); |
|
|
194 |
if(moduleObj != null){ |
| 195 |
String id = null; |
| 196 |
if(moduleObj instanceof org.eclipse.jst.j2ee.application.internal.impl.ModuleImpl) { |
| 197 |
id = ((org.eclipse.jst.j2ee.application.internal.impl.ModuleImpl)moduleObj).getId(); |
| 198 |
} else if (moduleObj instanceof ModuleImpl) { |
| 199 |
id = ((Module)moduleObj).getId(); |
| 200 |
} |
| 201 |
if(id == null || id.length() == 0) { |
| 202 |
return null; |
| 203 |
} |
| 204 |
} |
| 203 |
if(app instanceof Application){ |
205 |
if(app instanceof Application){ |
| 204 |
List<Module> modules = ((Application)app).getModules(); |
206 |
List<Module> modules = ((Application)app).getModules(); |
| 205 |
if(moduleObj != null){ |
207 |
if(moduleObj != null){ |
|
Lines 228-234
Link Here
|
| 228 |
} |
230 |
} |
| 229 |
} |
231 |
} |
| 230 |
} |
232 |
} |
| 231 |
return moduleObj; |
233 |
return null; |
| 232 |
} |
234 |
} |
| 233 |
|
235 |
|
| 234 |
protected Object getModuleFromURI(final IEARModelProvider earModel, String uri) { |
236 |
protected Object getModuleFromURI(final IEARModelProvider earModel, String uri) { |