void (final Module @NotNull [] modules, final ModuleGroup group, @Nullable final DataContext dataContext) { Project project = modules[0].getProject(); ModifiableModuleModel modifiableModuleModel = dataContext != null ? LangDataKeys.MODIFIABLE_MODULE_MODEL.getData(dataContext) : null; ModifiableModuleModel model = modifiableModuleModel != null ? modifiableModuleModel : ModuleManager.getInstance(project).getModifiableModel(); for (final Module module : modules) { model.setModuleGroupPath(module, group == null ? null : group.getGroupPath()); } if (modifiableModuleModel == null) { WriteAction.run(model::commit); } AbstractProjectViewPane pane = ProjectView.getInstance(project).getCurrentProjectViewPane(); if (pane != null) { pane.updateFromRoot(true); } if (!ProjectSettingsService.getInstance(project).processModulesMoved(modules, group) && pane != null) { if (group != null) { pane.selectModuleGroup(group, true); } else { pane.selectModule(modules[0], true); } } }