*/
public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
if (IvyClasspathUtil.isIvyClasspathContainer(containerPath)) {
// try to get an existing one
IClasspathContainer container = null;
try {
container = JavaCore.getClasspathContainer(containerPath, project);
} catch (JavaModelException ex) {
// unless there are issues with the JDT, this should never happen
IvyPlugin.log(IStatus.ERROR, "Unable to get container for "
+ containerPath.toString(), ex);
return;
}
try {
IvyClasspathContainer ivycp;
if (container == null) {
ivycp = new IvyClasspathContainer(project, containerPath,
new IClasspathEntry[0]);
} else if (!(container instanceof IvyClasspathContainer)) {
// this might be the persisted one : reuse the persisted entries
ivycp = new IvyClasspathContainer(project, containerPath, container
.getClasspathEntries());
} else {
ivycp = (IvyClasspathContainer) container;
}