boolean (@NotNull Collection<? extends Module> modules) { ModulesConfigurator modulesConfigurator = myContext.myModulesConfigurator; List<ModuleEditor> moduleEditors = ContainerUtil.mapNotNull(modules, modulesConfigurator::getModuleEditor); if (moduleEditors.isEmpty()) return false; if (!modulesConfigurator.canDeleteModules(moduleEditors)) return false; List<Module> modulesToDelete = ContainerUtil.mapNotNull(moduleEditors, ModuleEditor::getModule); for (Module module : modulesToDelete) { List<Facet> removed = modulesConfigurator.getFacetsConfigurator().removeAllFacets(module); myProjectStructureConfigurable.getFacetStructureConfigurable().removeFacetNodes(removed); } modulesConfigurator.deleteModules(moduleEditors); for (Module module : modulesToDelete) { myContext.getDaemonAnalyzer().removeElement(new ModuleProjectStructureElement(myContext, module)); for (final ModuleStructureExtension extension : ModuleStructureExtension.EP_NAME.getExtensions()) { extension.moduleRemoved(module); } } return true; }