Notification (@NotNull Project project, @NotNull VirtualFile root, @NotNull Collection<String> relativePaths, @NotNull @Nls String operation, @Nullable @NlsContexts.DetailedDescription String description, @Nullable NotificationListener listener) { if (description == null) description = ""; String notificationTitle = GitBundle.message("notification.title.untracked.files.prevent.operation", StringUtil.capitalize(operation)); String notificationDesc = GitBundle.message("notification.content.untracked.files.prevent.operation.move.or.commit", operation, description); final Collection<String> absolutePaths = GitUtil.toAbsolute(root, relativePaths); final List<VirtualFile> untrackedFiles = ContainerUtil.mapNotNull(absolutePaths, absolutePath -> { return GitUtil.findRefreshFileOrLog(absolutePath); }); Notification notification = IMPORTANT_ERROR_NOTIFICATION .createNotification(notificationTitle, notificationDesc, NotificationType.ERROR) .setDisplayId(GitNotificationIdsHolder.UNTRACKED_FIES_OVERWITTEN); if (listener != null) notification.setListener(listener); notification.addAction(new NotificationAction(VcsBundle.messagePointer("action.NotificationAction.VFSListener.text.view.files")) { @Override public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { String dialogDesc = GitBundle.message("dialog.message.untracked.files.will.be.overwritten.by.operation", operation); String title = GitBundle.message("dialog.title.untracked.files.preventing.operation", StringUtil.capitalize(operation)); if (untrackedFiles.isEmpty()) { GitUtil.showPathsInDialog(project, absolutePaths, title, dialogDesc); } else { DialogWrapper dialog; dialog = new UntrackedFilesDialog(project, untrackedFiles, dialogDesc); dialog.setTitle(title); dialog.show(); } } }); return notification; }