void (@NotNull Module module, VirtualFile @NotNull [] files) { final ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel(); for (VirtualFile file : files) { ContentEntry entry = findContentEntry(model, file); if (entry != null) { final SourceFolder[] sourceFolders = entry.getSourceFolders(); for (SourceFolder sourceFolder : sourceFolders) { if (Comparing.equal(sourceFolder.getFile(), file)) { entry.removeSourceFolder(sourceFolder); break; } } modifyRoots(file, entry); } } commitModel(module, model); }