use of com.intellij.openapi.roots.impl.DirectoryIndexExcludePolicy in project intellij-community by JetBrains.
the class ChangeListManagerImpl method convertExcludedToIgnored.
void convertExcludedToIgnored() {
for (DirectoryIndexExcludePolicy policy : DirectoryIndexExcludePolicy.EP_NAME.getExtensions(myProject)) {
for (VirtualFile file : policy.getExcludeRootsForProject()) {
addDirectoryToIgnoreImplicitly(file.getPath());
}
}
ProjectFileIndex fileIndex = ProjectFileIndex.SERVICE.getInstance(myProject);
VirtualFileManager virtualFileManager = VirtualFileManager.getInstance();
for (Module module : ModuleManager.getInstance(myProject).getModules()) {
for (String url : ModuleRootManager.getInstance(module).getExcludeRootUrls()) {
VirtualFile file = virtualFileManager.findFileByUrl(url);
if (file != null && !fileIndex.isExcluded(file)) {
//root is included into some inner module so it shouldn't be ignored
continue;
}
addDirectoryToIgnoreImplicitly(VfsUtilCore.urlToPath(url));
}
}
}
use of com.intellij.openapi.roots.impl.DirectoryIndexExcludePolicy in project intellij-community by JetBrains.
the class DumpVfsInfoForExcludedFilesAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
if (project == null)
return;
Set<String> excludeRoots = new HashSet<>();
for (Module module : ModuleManager.getInstance(project).getModules()) {
Collections.addAll(excludeRoots, ModuleRootManager.getInstance(module).getExcludeRootUrls());
}
for (DirectoryIndexExcludePolicy policy : DirectoryIndexExcludePolicy.EP_NAME.getExtensions(project)) {
for (VirtualFile file : policy.getExcludeRootsForProject()) {
excludeRoots.add(file.getUrl());
}
}
if (excludeRoots.isEmpty()) {
System.out.println("No excluded roots found in project.");
}
for (String root : excludeRoots) {
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(root);
if (file == null) {
System.out.println(root + " not in VFS");
continue;
}
dumpChildrenInDbRecursively(file, 0);
}
}
use of com.intellij.openapi.roots.impl.DirectoryIndexExcludePolicy in project intellij-community by JetBrains.
the class ContentEntryEditor method isExcludedOrUnderExcludedDirectory.
public static boolean isExcludedOrUnderExcludedDirectory(@Nullable Project project, @NotNull ContentEntry entry, @NotNull VirtualFile file) {
Set<VirtualFile> excludedFiles = ContainerUtil.newHashSet(entry.getExcludeFolderFiles());
if (project != null) {
for (DirectoryIndexExcludePolicy policy : DirectoryIndexExcludePolicy.getExtensions(project)) {
ContainerUtil.addAllNotNull(excludedFiles, policy.getExcludeRootsForProject());
}
}
Set<VirtualFile> sourceRoots = ContainerUtil.set(entry.getSourceFolderFiles());
VirtualFile parent = file;
while (parent != null) {
if (excludedFiles.contains(parent))
return true;
if (sourceRoots.contains(parent))
return false;
parent = parent.getParent();
}
return false;
}
Aggregations