void () { loadingPanel.setLoadingText(ExternalSystemBundle.message("please.wait")); loadingPanel.startLoading(); final DataNode<ProjectData> projectStructure = myProjectInfo.getExternalProjectStructure(); if (projectStructure != null) { final boolean[] isModified = {false}; projectStructure.visit(node -> { final DataNode modifiedDataNode = node.getUserData(MODIFIED_NODE_KEY); if (modifiedDataNode != null) { if (node.isIgnored() != modifiedDataNode.isIgnored()) { node.setIgnored(modifiedDataNode.isIgnored()); isModified[0] = true; } node.removeUserData(MODIFIED_NODE_KEY); node.removeUserData(CONNECTED_UI_NODE_KEY); } }); if (isModified[0]) { DataNode<?> notIgnoredNode = ContainerUtil.find(projectStructure.getChildren(), node -> !node.isIgnored()); projectStructure.setIgnored(notIgnoredNode == null); // execute when current dialog is closed ExternalSystemUtil.invokeLater(myProject, ModalityState.nonModal(), () -> { final ProjectData projectData = projectStructure.getData(); String title = ExternalSystemBundle.message( "progress.refresh.text", projectData.getExternalName(), projectData.getOwner().getReadableName()); new Task.Backgroundable(myProject, title, true, PerformInBackgroundOption.DEAF) { @Override public void run(@NotNull ProgressIndicator indicator) { ProjectDataManager.getInstance().importData(projectStructure, myProject); } }.queue(); }); } } super.doOKAction(); }