void () { Collection<VcsRootError> errors = scan(); if (errors.isEmpty()) { synchronized (NOTIFICATION_LOCK) { expireNotification(); } return; } MAPPING_DETECTION_LOG.debug("Following errors detected: " + errors); Collection<VcsRootError> importantUnregisteredRoots = getImportantUnregisteredMappings(errors); Collection<VcsRootError> invalidRoots = getInvalidRoots(errors); String title; String description; NotificationAction[] notificationActions; if (Registry.is("vcs.root.auto.add") && !areThereExplicitlyIgnoredRoots(errors)) { if (invalidRoots.isEmpty() && importantUnregisteredRoots.isEmpty()) return; LOG.info("Auto-registered following mappings: " + importantUnregisteredRoots); addMappings(importantUnregisteredRoots, true); // Register the single root equal to the project dir silently, without any notification if (invalidRoots.isEmpty() && importantUnregisteredRoots.size() == 1) { VcsRootError rootError = Objects.requireNonNull(getFirstItem(importantUnregisteredRoots)); if (FileUtil.pathsEqual(rootError.getMapping().getDirectory(), myProject.getBasePath())) { return; } } // Don't display the notification about registered roots unless configured to do so (and unless there are invalid roots) if (invalidRoots.isEmpty() && !Registry.is("vcs.root.auto.add.nofity")) { return; } title = makeTitle(importantUnregisteredRoots, invalidRoots, true); description = makeDescription(importantUnregisteredRoots, invalidRoots); notificationActions = new NotificationAction[]{getConfigureNotificationAction()}; } else { // Don't report again, if these roots were already reported List<String> unregRootPaths = map(importantUnregisteredRoots, rootError -> rootError.getMapping().getDirectory()); if (invalidRoots.isEmpty() && (importantUnregisteredRoots.isEmpty() || myReportedUnregisteredRoots.containsAll(unregRootPaths))) { return; } myReportedUnregisteredRoots.addAll(unregRootPaths); title = makeTitle(importantUnregisteredRoots, invalidRoots, false); description = makeDescription(importantUnregisteredRoots, invalidRoots); NotificationAction enableIntegration = NotificationAction .create(VcsBundle.messagePointer("action.NotificationAction.VcsRootProblemNotifier.text.enable.integration"), (event, notification) -> addMappings(importantUnregisteredRoots, false)); NotificationAction ignoreAction = NotificationAction .create(VcsBundle.messagePointer("action.NotificationAction.VcsRootProblemNotifier.text.ignore"), (event, notification) -> { mySettings.addIgnoredUnregisteredRoots(map(importantUnregisteredRoots, rootError -> rootError.getMapping().getDirectory())); notification.expire(); }); notificationActions = new NotificationAction[]{enableIntegration, getConfigureNotificationAction(), ignoreAction}; } ProgressManager.checkCanceled(); synchronized (NOTIFICATION_LOCK) { expireNotification(); VcsNotifier notifier = VcsNotifier.getInstance(myProject); myNotification = invalidRoots.isEmpty() ? notifier.notifyMinorInfo(ROOTS_REGISTERED, title, description, notificationActions) : notifier.notifyError(ROOTS_INVALID, title, description, getConfigureNotificationAction()); } }