if (javaProject == null) return;
ClasspathContainerInitializer scalaInitializer = JavaCore.getClasspathContainerInitializer(SCALA_CONTAINER_PATH);
if (scalaInitializer == null) return;
IPath scalaContainerPath = Path.fromPortableString(SCALA_CONTAINER_PATH);
Boolean updateAble = scalaInitializer.canUpdateClasspathContainer(scalaContainerPath, javaProject);
final IClasspathContainer scalaLibrary = JavaCore.getClasspathContainer(scalaContainerPath, javaProject);
final IClasspathEntry[] cpEntries = scalaLibrary.getClasspathEntries();
for(int i = 0; i < cpEntries.length; i++ ) {
IClasspathEntry cpe = cpEntries[i];
LinkedHashMap<String, IClasspathAttribute> attrs = new LinkedHashMap<String, IClasspathAttribute>();
for(IClasspathAttribute attr : cpe.getExtraAttributes()) {
//Keep all existing attributes except the non_deployable key
if(!attr.getName().equals(NON_DEPLOYABLE_KEY)) {
attrs.put(attr.getName(), attr);
}
}
attrs.put(deployableAttribute.getName(), deployableAttribute);
IClasspathAttribute[] newAttrs = attrs.values().toArray(new IClasspathAttribute[attrs.size()]);
cpEntries[i] = JavaCore.newLibraryEntry(cpe.getPath(), cpe.getSourceAttachmentPath(),
cpe.getSourceAttachmentRootPath(), cpe.getAccessRules(), newAttrs, cpe.isExported());
}
IClasspathContainer candidateScalaContainer = new IClasspathContainer() {
public IPath getPath() { return scalaLibrary.getPath(); }
public IClasspathEntry[] getClasspathEntries() { return cpEntries; }
public String getDescription() { return scalaLibrary.getDescription(); }
public int getKind() { return scalaLibrary.getKind(); }
};