|
Lines 16-21
Link Here
|
| 16 |
import java.util.List; |
16 |
import java.util.List; |
| 17 |
import java.util.Map; |
17 |
import java.util.Map; |
| 18 |
import java.util.Properties; |
18 |
import java.util.Properties; |
|
|
19 |
import java.util.Set; |
| 19 |
|
20 |
|
| 20 |
import org.eclipse.core.resources.IProject; |
21 |
import org.eclipse.core.resources.IProject; |
| 21 |
import org.eclipse.core.runtime.CoreException; |
22 |
import org.eclipse.core.runtime.CoreException; |
|
Lines 24-29
Link Here
|
| 24 |
import org.eclipse.core.runtime.IStatus; |
25 |
import org.eclipse.core.runtime.IStatus; |
| 25 |
import org.eclipse.core.runtime.Path; |
26 |
import org.eclipse.core.runtime.Path; |
| 26 |
import org.eclipse.core.runtime.Platform; |
27 |
import org.eclipse.core.runtime.Platform; |
|
|
28 |
import org.eclipse.emf.common.util.URI; |
| 27 |
import org.eclipse.wst.common.componentcore.ComponentCore; |
29 |
import org.eclipse.wst.common.componentcore.ComponentCore; |
| 28 |
import org.eclipse.wst.common.componentcore.ModuleCoreNature; |
30 |
import org.eclipse.wst.common.componentcore.ModuleCoreNature; |
| 29 |
import org.eclipse.wst.common.componentcore.internal.ComponentcoreFactory; |
31 |
import org.eclipse.wst.common.componentcore.internal.ComponentcoreFactory; |
|
Lines 34-40
Link Here
|
| 34 |
import org.eclipse.wst.common.componentcore.internal.ReferencedComponent; |
36 |
import org.eclipse.wst.common.componentcore.internal.ReferencedComponent; |
| 35 |
import org.eclipse.wst.common.componentcore.internal.StructureEdit; |
37 |
import org.eclipse.wst.common.componentcore.internal.StructureEdit; |
| 36 |
import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent; |
38 |
import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent; |
| 37 |
import org.eclipse.wst.common.componentcore.internal.builder.DependencyGraphManager; |
39 |
import org.eclipse.wst.common.componentcore.internal.builder.IDependencyGraph; |
| 38 |
import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil; |
40 |
import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil; |
| 39 |
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; |
41 |
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; |
| 40 |
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; |
42 |
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; |
|
Lines 272-277
Link Here
|
| 272 |
return getReferences(); |
274 |
return getReferences(); |
| 273 |
} |
275 |
} |
| 274 |
|
276 |
|
|
|
277 |
protected IVirtualReference createVirtualReference( ReferencedComponent ref) { |
| 278 |
return StructureEdit.createVirtualReference(this, ref); |
| 279 |
} |
| 280 |
|
| 281 |
protected URI getHandle(IVirtualReference reference) { |
| 282 |
if(reference.getReferencedComponent().isBinary()) |
| 283 |
return ModuleURIUtil.fullyQualifyURI(reference.getReferencedComponent().getProject()); |
| 284 |
else |
| 285 |
return ModuleURIUtil.archiveComponentfullyQualifyURI(reference.getReferencedComponent().getName()); |
| 286 |
} |
| 287 |
|
| 275 |
public IVirtualReference[] getReferences() { |
288 |
public IVirtualReference[] getReferences() { |
| 276 |
StructureEdit core = null; |
289 |
StructureEdit core = null; |
| 277 |
List references = new ArrayList(); |
290 |
List references = new ArrayList(); |
|
Lines 285-291
Link Here
|
| 285 |
ReferencedComponent referencedComponent = (ReferencedComponent) iter.next(); |
298 |
ReferencedComponent referencedComponent = (ReferencedComponent) iter.next(); |
| 286 |
if (referencedComponent==null) |
299 |
if (referencedComponent==null) |
| 287 |
continue; |
300 |
continue; |
| 288 |
IVirtualReference vReference = StructureEdit.createVirtualReference(this, referencedComponent); |
301 |
IVirtualReference vReference = createVirtualReference(referencedComponent); |
| 289 |
if( vReference != null ){ |
302 |
if( vReference != null ){ |
| 290 |
vReference.setArchiveName( referencedComponent.getArchiveName() ); |
303 |
vReference.setArchiveName( referencedComponent.getArchiveName() ); |
| 291 |
} |
304 |
} |
|
Lines 320-329
Link Here
|
| 320 |
referencedComponent.setRuntimePath(references[i].getRuntimePath()); |
333 |
referencedComponent.setRuntimePath(references[i].getRuntimePath()); |
| 321 |
|
334 |
|
| 322 |
IVirtualComponent comp = references[i].getReferencedComponent(); |
335 |
IVirtualComponent comp = references[i].getReferencedComponent(); |
| 323 |
if(comp!=null && !comp.isBinary()) |
336 |
if( comp != null ) |
| 324 |
referencedComponent.setHandle(ModuleURIUtil.fullyQualifyURI(comp.getProject())); |
337 |
referencedComponent.setHandle(getHandle(references[i])); |
| 325 |
else if (comp!=null) |
|
|
| 326 |
referencedComponent.setHandle(ModuleURIUtil.archiveComponentfullyQualifyURI(comp.getName())); |
| 327 |
if (component != null) |
338 |
if (component != null) |
| 328 |
component.getReferencedComponents().add(referencedComponent); |
339 |
component.getReferencedComponents().add(referencedComponent); |
| 329 |
referencedComponent.setArchiveName(references[i].getArchiveName()); |
340 |
referencedComponent.setArchiveName(references[i].getArchiveName()); |
|
Lines 346-352
Link Here
|
| 346 |
ReferencedComponent referencedComponent = (ReferencedComponent) iter.next(); |
357 |
ReferencedComponent referencedComponent = (ReferencedComponent) iter.next(); |
| 347 |
if (referencedComponent==null) |
358 |
if (referencedComponent==null) |
| 348 |
continue; |
359 |
continue; |
| 349 |
IVirtualReference vReference = StructureEdit.createVirtualReference(this, referencedComponent); |
360 |
IVirtualReference vReference = createVirtualReference(referencedComponent); |
| 350 |
if (vReference == null || vReference.getReferencedComponent() == null || !vReference.getReferencedComponent().exists()){ |
361 |
if (vReference == null || vReference.getReferencedComponent() == null || !vReference.getReferencedComponent().exists()){ |
| 351 |
iter.remove(); |
362 |
iter.remove(); |
| 352 |
} |
363 |
} |
|
Lines 368-378
Link Here
|
| 368 |
referencedComponent.setRuntimePath(references[i].getRuntimePath()); |
379 |
referencedComponent.setRuntimePath(references[i].getRuntimePath()); |
| 369 |
|
380 |
|
| 370 |
IVirtualComponent comp = references[i].getReferencedComponent(); |
381 |
IVirtualComponent comp = references[i].getReferencedComponent(); |
| 371 |
if( !comp.isBinary()) |
382 |
if( comp != null ) |
| 372 |
referencedComponent.setHandle(ModuleURIUtil.fullyQualifyURI(references[i].getReferencedComponent().getProject())); |
383 |
referencedComponent.setHandle(getHandle(references[i])); |
| 373 |
else |
384 |
|
| 374 |
referencedComponent.setHandle(ModuleURIUtil.archiveComponentfullyQualifyURI(references[i].getReferencedComponent().getName())); |
|
|
| 375 |
|
| 376 |
referencedComponent.setArchiveName(references[i].getArchiveName()); |
385 |
referencedComponent.setArchiveName(references[i].getArchiveName()); |
| 377 |
component.getReferencedComponents().add(referencedComponent); |
386 |
component.getReferencedComponents().add(referencedComponent); |
| 378 |
} |
387 |
} |
|
Lines 434-443
Link Here
|
| 434 |
* @return array of components |
443 |
* @return array of components |
| 435 |
*/ |
444 |
*/ |
| 436 |
public IVirtualComponent[] getReferencingComponents() { |
445 |
public IVirtualComponent[] getReferencingComponents() { |
| 437 |
IProject[] handles = DependencyGraphManager.getInstance().getDependencyGraph().getReferencingComponents(getProject()); |
446 |
Set<IProject> projects = IDependencyGraph.INSTANCE.getReferencingComponents(getProject()); |
| 438 |
IVirtualComponent[] result = new IVirtualComponent[handles.length]; |
447 |
IVirtualComponent[] result = new IVirtualComponent[projects.size()]; |
| 439 |
for (int i=0; i<handles.length; i++) |
448 |
Iterator<IProject> i = projects.iterator(); |
| 440 |
result[i] = ComponentCore.createComponent(handles[i]); |
449 |
for (int j=0; j<projects.size(); j++) |
|
|
450 |
result[j] = ComponentCore.createComponent(i.next()); |
| 441 |
return result; |
451 |
return result; |
| 442 |
} |
452 |
} |
| 443 |
|
453 |
|
|
Lines 479-492
Link Here
|
| 479 |
List referencedComponents = component.getReferencedComponents(); |
489 |
List referencedComponents = component.getReferencedComponents(); |
| 480 |
for (int i=0; i<referencedComponents.size(); i++) { |
490 |
for (int i=0; i<referencedComponents.size(); i++) { |
| 481 |
ReferencedComponent ref = (ReferencedComponent) referencedComponents.get(i); |
491 |
ReferencedComponent ref = (ReferencedComponent) referencedComponents.get(i); |
| 482 |
if (!aReference.getReferencedComponent().isBinary()) { |
492 |
if( ref.getHandle().equals(getHandle(aReference))) |
| 483 |
if (ref.getHandle().equals(ModuleURIUtil.fullyQualifyURI(aReference.getReferencedComponent().getProject()))) |
493 |
return ref; |
| 484 |
return ref; |
|
|
| 485 |
} |
| 486 |
else { |
| 487 |
if (ref.getHandle().equals(ModuleURIUtil.archiveComponentfullyQualifyURI(aReference.getReferencedComponent().getName()))) |
| 488 |
return ref; |
| 489 |
} |
| 490 |
} |
494 |
} |
| 491 |
return null; |
495 |
return null; |
| 492 |
} |
496 |
} |
|
Lines 508-514
Link Here
|
| 508 |
ReferencedComponent referencedComponent = (ReferencedComponent) iter.next(); |
512 |
ReferencedComponent referencedComponent = (ReferencedComponent) iter.next(); |
| 509 |
if (referencedComponent==null) |
513 |
if (referencedComponent==null) |
| 510 |
continue; |
514 |
continue; |
| 511 |
IVirtualReference vReference = StructureEdit.createVirtualReference(this, referencedComponent); |
515 |
IVirtualReference vReference = createVirtualReference(referencedComponent); |
| 512 |
if( vReference != null ){ |
516 |
if( vReference != null ){ |
| 513 |
vReference.setArchiveName( referencedComponent.getArchiveName() ); |
517 |
vReference.setArchiveName( referencedComponent.getArchiveName() ); |
| 514 |
} |
518 |
} |