void (String... names) { MapDataContext dataContext = new MapDataContext(); dataContext.put(CommonDataKeys.PROJECT, myProject); List<Module> modules = new ArrayList<>(); List<UnloadedModuleDescription> unloaded = new ArrayList<>(); for (String name : names) { UnloadedModuleDescription description = getModuleManager().getUnloadedModuleDescription(name); if (description != null) { unloaded.add(description); } else { Module module = getModuleManager().findModuleByName(name); assertNotNull("Module " + name + " not found", module); modules.add(module); } } if (!modules.isEmpty()) { dataContext.put(LangDataKeys.MODULE_CONTEXT_ARRAY, modules.toArray(Module.EMPTY_ARRAY)); } if (!unloaded.isEmpty()) { dataContext.put(ProjectView.UNLOADED_MODULES_CONTEXT_KEY, unloaded); } ModuleDeleteProvider provider = ModuleDeleteProvider.getInstance(); assertTrue(provider.canDeleteElement(dataContext)); provider.deleteElement(dataContext); }