MultiStatus errorStatuses = new MultiStatus(IvyPlugin.ID, IStatus.ERROR,
"Failed to update one or more Ivy files. See details.", null);
IvyClasspathContainerImpl[] containers = getIvyClasspathContainers();
for (int i = 0; i < containers.length; i++) {
IvyClasspathContainerImpl container = containers[i];
ModuleDescriptor md = container.getState().getCachedModuleDescriptor();
if (md == null) {
continue;
}
Map/* <ModuleRevisionId, String> */newRevisions = new HashMap();
DependencyDescriptor[] dependencies = md.getDependencies();
for (int j = 0; j < dependencies.length; j++) {
for (int k = 0; k < multiRevisionDependencies.length; k++) {
MultiRevDependencyDescriptor multiRevision = multiRevisionDependencies[k];
ModuleRevisionId dependencyRevisionId = dependencies[j]
.getDependencyRevisionId();
if (dependencies[j].getDependencyId().equals(multiRevision.getModuleId())
&& multiRevision.hasNewRevision()
&& multiRevision.isForContainer(container)) {
newRevisions.put(dependencyRevisionId,
multiRevisionDependencies[k].getNewRevision());
break; // move on to the next dependency
}
}
}
UpdateOptions updateOptions = new UpdateOptions().setResolvedRevisions(newRevisions)
.setReplaceInclude(false).setGenerateRevConstraint(false)
.setNamespace(new RevisionPreservingNamespace());
File ivyFile;
try {
ivyFile = container.getState().getIvyFile();
} catch (IvyDEException e) {
errorStatuses.add(new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR,
"Fail to resolve the ivy file", e));
continue;
}