use of com.intellij.openapi.roots.FileIndexFacade in project intellij-community by JetBrains.
the class MappingsToRoots method getDetailedVcsMappings.
// not only set mappings, but include all modules inside: modules might have different settings
public List<VirtualFile> getDetailedVcsMappings(final AbstractVcs vcs) {
// same as above, but no compression
final List<VirtualFile> result = myMappings.getMappingsAsFilesUnderVcs(vcs);
boolean addInnerModules = true;
final String vcsName = vcs.getName();
final List<VcsDirectoryMapping> directoryMappings = myMappings.getDirectoryMappings(vcsName);
for (VcsDirectoryMapping directoryMapping : directoryMappings) {
if (directoryMapping.isDefaultMapping()) {
addInnerModules = false;
break;
}
}
Collections.sort(result, FilePathComparator.getInstance());
if (addInnerModules) {
final FileIndexFacade facade = PeriodicalTasksCloser.getInstance().safeGetService(myProject, FileIndexFacade.class);
final Collection<VirtualFile> modules = DefaultVcsRootPolicy.getInstance(myProject).getDefaultVcsRoots(myMappings, vcsName);
ApplicationManager.getApplication().runReadAction(() -> {
Iterator<VirtualFile> iterator = modules.iterator();
while (iterator.hasNext()) {
final VirtualFile module = iterator.next();
boolean included = false;
for (VirtualFile root : result) {
if (facade.isValidAncestor(root, module)) {
included = true;
break;
}
}
if (!included) {
iterator.remove();
}
}
});
result.addAll(modules);
}
result.removeIf(file -> !file.isDirectory());
return result;
}
use of com.intellij.openapi.roots.FileIndexFacade in project google-cloud-intellij by GoogleCloudPlatform.
the class SetupCloudRepositoryAction method filterOutIgnored.
@NotNull
private static Collection<VirtualFile> filterOutIgnored(@NotNull Project project, @NotNull Collection<VirtualFile> files) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
final FileIndexFacade fileIndex = FileIndexFacade.getInstance(project);
return Collections2.filter(files, file -> !changeListManager.isIgnoredFile(file) && !fileIndex.isExcludedFile(file));
}
Aggregations