void (@NotNull Module module, @NotNull List<? extends VirtualFile> files, boolean exclude) { ModuleRootModificationUtil.updateModel(module, model -> { for (ContentEntry entry : model.getContentEntries()) { VirtualFile root = entry.getFile(); if (root == null) continue; for (VirtualFile file : files) { if (VfsUtilCore.isAncestor(root, file, true)) { if (exclude) { entry.addExcludeFolder(file); } else { entry.removeExcludeFolder(file.getUrl()); } } } } }); }