}
}
// Add Java export model objects for all the packages we found
for (String pkg: packages) {
JavaExport export = new JavaExportImpl();
export.setPackage(pkg);
contribution.getExports().add(export);
}
}
}
// Initialize the contribution exports
for (Export export: contribution.getExports()) {
export.setModelResolver(contribution.getModelResolver());
}
// Initialize the contribution imports
for (Import import_: contribution.getImports()) {
boolean initialized = false;
if(import_ instanceof JavaImport) {
JavaImport javaImport = (JavaImport) import_;
//Find a matching contribution
if(javaImport.getLocation() != null) {
Contribution targetContribution = repository.getContribution(javaImport.getLocation());
if (targetContribution != null) {
// Find a matching contribution export
for (Export export: targetContribution.getExports()) {
if (export instanceof JavaExport) {
JavaExport javaExport = (JavaExport)export;
if (javaImport.getPackage().equals(javaExport.getPackage())) {
List<Contribution> exportingContributions = new ArrayList<Contribution>();
exportingContributions.add(targetContribution);
javaImport.setModelResolver(new JavaImportModelResolver(exportingContributions, javaExport.getModelResolver()));
initialized = true;
break;
}
}
}