use of com.intellij.facet.ui.libraries.LibraryInfo in project intellij-community by JetBrains.
the class RequiredLibrariesInfo method checkLibraries.
@Nullable
public RequiredClassesNotFoundInfo checkLibraries(List<VirtualFile> libraryFiles) {
List<LibraryInfo> infos = new ArrayList<>();
List<String> classes = new ArrayList<>();
for (LibraryInfo info : myLibraryInfos) {
boolean notFound;
final String md5 = info.getMd5();
if (!StringUtil.isEmptyOrSpaces(md5)) {
notFound = true;
for (VirtualFile libraryFile : libraryFiles) {
final VirtualFile jarFile = JarFileSystem.getInstance().getVirtualFileForJar(libraryFile);
if (md5.equals(md5(jarFile))) {
notFound = false;
break;
}
}
} else {
notFound = false;
for (String className : info.getRequiredClasses()) {
if (!LibraryUtil.isClassAvailableInLibrary(libraryFiles, className)) {
classes.add(className);
notFound = true;
}
}
}
if (notFound) {
infos.add(info);
}
}
if (infos.isEmpty()) {
return null;
}
return new RequiredClassesNotFoundInfo(ArrayUtil.toStringArray(classes), infos.toArray(new LibraryInfo[infos.size()]));
}
use of com.intellij.facet.ui.libraries.LibraryInfo in project intellij-community by JetBrains.
the class FacetLibrariesValidatorImpl method check.
@NotNull
public ValidationResult check() {
if (myRequiredLibraries == null) {
return ValidationResult.OK;
}
List<VirtualFile> roots = collectRoots(myContext.getRootModel());
RequiredLibrariesInfo.RequiredClassesNotFoundInfo info = myRequiredLibraries.checkLibraries(VfsUtil.toVirtualFileArray(roots));
if (info == null) {
return ValidationResult.OK;
}
String missingJars = IdeBundle.message("label.missed.libraries.prefix") + " " + info.getMissingJarsText();
LibraryInfo[] missingLibraries = info.getLibraryInfos();
CustomLibraryDescription description = new OldCustomLibraryDescription(missingLibraries, myDescription.getDefaultLibraryName());
return new ValidationResult(missingJars, new LibrariesQuickFix(description));
}
Aggregations