void (final String includePath, final List<IncludeDuplicate<T>> duplicates, final Editor editor, final Project project) { if (duplicates.size() > 0) { final String message = RefactoringBundle.message("idea.has.found.fragments.that.can.be.replaced.with.include.directive", ApplicationNamesInfo.getInstance().getProductName()); final int exitCode = Messages.showYesNoDialog(project, message, getRefactoringName(), Messages.getInformationIcon()); if (exitCode == Messages.YES) { CommandProcessor.getInstance().executeCommand(project, () -> { boolean replaceAll = false; for (IncludeDuplicate<T> pair : duplicates) { if (!replaceAll) { highlightInEditor(project, pair, editor); ReplacePromptDialog promptDialog = new ReplacePromptDialog(false, RefactoringBundle.message("replace.fragment"), project); promptDialog.show(); final int promptResult = promptDialog.getExitCode(); if (promptResult == FindManager.PromptResult.SKIP) continue; if (promptResult == FindManager.PromptResult.CANCEL) break; if (promptResult == FindManager.PromptResult.OK) { doReplaceRange(includePath, pair.getStart(), pair.getEnd()); } else if (promptResult == FindManager.PromptResult.ALL) { doReplaceRange(includePath, pair.getStart(), pair.getEnd()); replaceAll = true; } else { LOG.error("Unknown return status"); } } else { doReplaceRange(includePath, pair.getStart(), pair.getEnd()); } } }, RefactoringBundle.message("remove.duplicates.command"), null); } } }