void () { ModuleManager manager = ModuleManager.getInstance(getProject()); ModifiableModuleModel model = manager.getModifiableModel(); model.disposeModule(manager.findModuleByName("C")); WriteAction.run(() -> model.commit()); }