void (final Project project, DataNode<ProjectData> externalProjectNode, boolean isFromUI, final List<Module> modules, IdeModifiableModelsProvider modelsProvider, final ExternalProjectSettings projectSettings) { myProjectDataManager.importData(externalProjectNode, project, modelsProvider); myExternalProjectNode = null; // resolve dependencies final Runnable resolveDependenciesTask = () -> refreshProject(projectSettings.getExternalProjectPath(), new ImportSpecBuilder(project, myExternalSystemId) .callback(createFinalImportCallback(project, projectSettings))); if (!isFromUI) { resolveDependenciesTask.run(); } else { // execute when current dialog is closed invokeLater(project, ModalityState.nonModal(), () -> { final Module[] committedModules = ModuleManager.getInstance(project).getModules(); if (Arrays.asList(committedModules).containsAll(modules)) { resolveDependenciesTask.run(); } }); } }