use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class JpsLibraryDelegate method getInvalidRootUrls.
@Override
public List<String> getInvalidRootUrls(OrderRootType type) {
final VirtualFilePointerContainer container = myRoots.get(type);
if (container == null)
return Collections.emptyList();
final List<VirtualFilePointer> pointers = container.getList();
List<String> invalidPaths = null;
for (VirtualFilePointer pointer : pointers) {
if (!pointer.isValid()) {
if (invalidPaths == null) {
invalidPaths = new SmartList<>();
}
invalidPaths.add(pointer.getUrl());
}
}
return invalidPaths == null ? Collections.<String>emptyList() : invalidPaths;
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class JpsLibraryDelegate method isValid.
@Override
public boolean isValid(@NotNull String url, @NotNull OrderRootType rootType) {
final VirtualFilePointerContainer container = myRoots.get(rootType);
if (container == null)
return false;
final VirtualFilePointer fp = container.findByUrl(url);
return fp != null && fp.isValid();
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class JpsLibraryDelegate method getFiles.
@NotNull
@Override
public VirtualFile[] getFiles(@NotNull OrderRootType rootType) {
final VirtualFilePointerContainer container = myRoots.get(rootType);
if (container == null)
return VirtualFile.EMPTY_ARRAY;
final List<VirtualFile> expanded = new ArrayList<>();
for (JpsLibraryRoot root : myJpsLibrary.getRoots(getJpsRootType(rootType))) {
final VirtualFilePointer pointer = container.findByUrl(root.getUrl());
if (pointer == null)
continue;
VirtualFile file = pointer.getFile();
if (file == null)
continue;
if (file.isDirectory() && root.getInclusionOptions() != JpsLibraryRoot.InclusionOptions.ROOT_ITSELF) {
LibraryImpl.collectJarFiles(file, expanded, root.getInclusionOptions() == JpsLibraryRoot.InclusionOptions.ARCHIVES_UNDER_ROOT_RECURSIVELY);
continue;
}
expanded.add(file);
}
return VfsUtilCore.toVirtualFileArray(expanded);
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class OrderRootsCache method setCachedRoots.
public VirtualFilePointerContainer setCachedRoots(OrderRootType rootType, int flags, Collection<String> urls) {
final VirtualFilePointerContainer container = VirtualFilePointerManager.getInstance().createContainer(myParentDisposable);
for (String url : urls) {
container.add(url);
}
myRoots.put(new CacheKey(rootType, flags), container);
return container;
}
use of com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer in project intellij-community by JetBrains.
the class LibraryImpl method disposeMyPointers.
private void disposeMyPointers() {
for (VirtualFilePointerContainer container : new THashSet<>(myRoots.values())) {
container.killAll();
}
if (myExcludedRoots != null) {
myExcludedRoots.killAll();
}
Disposer.dispose(myPointersDisposable);
Disposer.register(this, myPointersDisposable);
}
Aggregations