void (@NotNull final Project project, @NotNull ProjectSystemId projectSystemId, @NotNull AbstractExternalEntityData externalEntityData, @NotNull AnActionEvent e) { final List<ExternalSystemNode> selectedNodes = e.getData(ExternalSystemDataKeys.SELECTED_NODES); final ExternalSystemNode<?> externalSystemNode = ContainerUtil.getFirstItem(selectedNodes); assert externalSystemNode != null; final ExternalConfigPathAware externalConfigPathAware = externalSystemNode.getData() instanceof ExternalConfigPathAware ? (ExternalConfigPathAware)externalSystemNode.getData() : null; assert externalConfigPathAware != null; // We save all documents because there is a possible case that there is an external system config file changed inside the ide. FileDocumentManager.getInstance().saveAllDocuments(); final ExternalProjectSettings linkedProjectSettings = ExternalSystemApiUtil.getSettings( project, projectSystemId).getLinkedProjectSettings(externalConfigPathAware.getLinkedExternalProjectPath()); final String externalProjectPath = linkedProjectSettings == null ? externalConfigPathAware.getLinkedExternalProjectPath() : linkedProjectSettings.getExternalProjectPath(); ExternalSystemUtil.refreshProject(externalProjectPath, new ImportSpecBuilder(project, projectSystemId) .withArguments("--refresh-dependencies")); }