use of com.intellij.webcore.libraries.ScriptingLibraryModel in project intellij-plugins by JetBrains.
the class JstdLibraryUtil method doesCorrectJstdLibExist.
private static boolean doesCorrectJstdLibExist(@NotNull final Project project) {
Boolean correctJstdLibExists = JSTD_LIBRARY_EXISTS;
if (correctJstdLibExists == null) {
correctJstdLibExists = ReadAction.compute(() -> {
VirtualFile libVirtualFile = VfsUtil.findFileByURL(JstdDefaultAssertionFrameworkSrcMarker.class.getResource("TestCase.js"));
if (libVirtualFile == null) {
return false;
}
JSLibraryManager libraryManager = JSLibraryManager.getInstance(project);
for (ScriptingLibraryModel libraryModel : libraryManager.getAllLibraries()) {
if (libraryModel == null) {
continue;
}
String libraryName = libraryModel.getName();
if (libraryName != null && libraryName.startsWith(LIBRARY_NAME)) {
Library library = libraryModel.getOriginalLibrary();
if (library instanceof LibraryEx) {
LibraryEx libraryEx = (LibraryEx) library;
if (libraryEx.isDisposed()) {
continue;
}
}
if (libraryModel.containsFile(libVirtualFile)) {
return true;
}
}
}
return false;
});
JSTD_LIBRARY_EXISTS = correctJstdLibExists;
}
return correctJstdLibExists;
}
Aggregations