void (@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(false); int total = selectedGroups.stream().mapToInt(g -> g.entriesToDelete).sum(); List<String> errors = new ArrayList<>(); for (DirectoryGroup group : selectedGroups) { for (Path directory : group.directories) { indicator.checkCanceled(); indicator.setText(directory.toString()); if (myLogger.isDebugEnabled()) myLogger.debug("deleting " + directory); currentRoot = directory; try { NioFiles.deleteRecursively(directory, p -> { indicator.checkCanceled(); indicator.setFraction((double)(progress++) / total); indicator.setText2(currentRoot.relativize(p).toString()); }); } catch (IOException e) { myLogger.info(e); errors.add(directory + " (" + IoErrorText.message(e) + ')'); } } } if (!errors.isEmpty()) { @NlsSafe String content = String.join("<br>", errors); NotificationGroupManager.getInstance().getNotificationGroup("leftover.ide.directories") .createNotification(message("old.dirs.delete.error"), content, NotificationType.WARNING) .addAction(ShowLogAction.notificationAction()) .notify(project); } }