Lines 482-487
Link Here
|
482 |
|
482 |
|
483 |
for (int i = 0; i < models.length; i++) { |
483 |
for (int i = 0; i < models.length; i++) { |
484 |
BundleDescription desc = models[i].getBundleDescription(); |
484 |
BundleDescription desc = models[i].getBundleDescription(); |
|
|
485 |
|
486 |
// If the current model is a fragment, it must have hasExtensibleAPI set to export its packages |
487 |
if (isFragmentThatCannotExportPackages(models[i])) |
488 |
continue; |
489 |
|
485 |
String id = desc == null ? null : desc.getSymbolicName(); |
490 |
String id = desc == null ? null : desc.getSymbolicName(); |
486 |
if (id == null || forbidden.contains(id)) |
491 |
if (id == null || forbidden.contains(id)) |
487 |
continue; |
492 |
continue; |
Lines 520-525
Link Here
|
520 |
IProject project = resource != null ? resource.getProject() : null; |
525 |
IProject project = resource != null ? resource.getProject() : null; |
521 |
if (project == null || !project.hasNature(JavaCore.NATURE_ID) || WorkspaceModelManager.isBinaryProject(project) || !PDEProject.getManifest(project).exists()) |
526 |
if (project == null || !project.hasNature(JavaCore.NATURE_ID) || WorkspaceModelManager.isBinaryProject(project) || !PDEProject.getManifest(project).exists()) |
522 |
continue; |
527 |
continue; |
|
|
528 |
|
529 |
// If the current model is a fragment, it must have hasExtensibleAPI set to export its packages |
530 |
if (isFragmentThatCannotExportPackages(models[i])) |
531 |
continue; |
532 |
|
523 |
IJavaProject jp = JavaCore.create(project); |
533 |
IJavaProject jp = JavaCore.create(project); |
524 |
IPackageFragmentRoot[] roots = jp.getPackageFragmentRoots(); |
534 |
IPackageFragmentRoot[] roots = jp.getPackageFragmentRoots(); |
525 |
for (int j = 0; j < roots.length; j++) { |
535 |
for (int j = 0; j < roots.length; j++) { |
Lines 543-548
Link Here
|
543 |
dialog.setConditionalElements(conditional.toArray()); |
553 |
dialog.setConditionalElements(conditional.toArray()); |
544 |
} |
554 |
} |
545 |
|
555 |
|
|
|
556 |
/** |
557 |
* Returns whether the provided plug-in model is a fragment that cannot export |
558 |
* its packages to other bundles (<code>hasExtensibleAPI</code> is not set). Will |
559 |
* return false if the model does not represent a fragment. |
560 |
* |
561 |
* @param fragment the model to test |
562 |
* @return <code>true</code> if the model is a fragment that cannot export packages |
563 |
*/ |
564 |
private boolean isFragmentThatCannotExportPackages(IPluginModelBase fragment) { |
565 |
if (!fragment.isFragmentModel()) { |
566 |
// Not a fragment |
567 |
return false; |
568 |
} |
569 |
BundleDescription bundleDescription = fragment.getBundleDescription(); |
570 |
if (bundleDescription == null) { |
571 |
// Classic plugin, do not change the behavior |
572 |
return false; |
573 |
} |
574 |
HostSpecification hostSpec = bundleDescription.getHost(); |
575 |
if (hostSpec == null) { |
576 |
// Not a fragment |
577 |
return false; |
578 |
} |
579 |
BundleDescription[] hosts = hostSpec.getHosts(); |
580 |
for (int i = 0; i < hosts.length; i++) { |
581 |
// Hosts have extensible API so they packages can be exported |
582 |
if (ClasspathUtilCore.hasExtensibleAPI(PluginRegistry.findModel(hosts[i]))) |
583 |
return false; |
584 |
} |
585 |
// Fragment that cannot export |
586 |
return true; |
587 |
} |
588 |
|
546 |
public void modelChanged(IModelChangedEvent event) { |
589 |
public void modelChanged(IModelChangedEvent event) { |
547 |
if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { |
590 |
if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { |
548 |
fHeader = null; |
591 |
fHeader = null; |