void () { ExternalSystemManager<?, ?, ?, ?, ?> manager = getManager(myExternalSystemId); assert manager != null; Set<String> pathsToForget = new HashSet<>(); for (ExternalProjectPojo pojo : state.availableProjects.keySet()) { pathsToForget.add(pojo.getPath()); } for (ExternalTaskExecutionInfo taskInfo : ContainerUtil.notNullize(state.recentTasks)) { pathsToForget.add(taskInfo.getSettings().getExternalProjectPath()); } AbstractExternalSystemSettings<?, ?, ?> settings = manager.getSettingsProvider().fun(myProject); for (ExternalProjectSettings projectSettings : settings.getLinkedProjectsSettings()) { pathsToForget.remove(projectSettings.getExternalProjectPath()); } for (Module module : ModuleManager.getInstance(myProject).getModules()) { if (!isExternalSystemAwareModule(myExternalSystemId, module)) continue; pathsToForget.remove(getExternalProjectPath(module)); } if (!pathsToForget.isEmpty()) { forgetExternalProjects(pathsToForget); } }