void (@NotNull Collection<? extends Usage> usages) { final Set<Usage> excluded = myUsageView.getExcludedUsages(); usages = usages.stream().filter(u -> !excluded.contains(u)).filter(u -> isValid((UsageInfo2UsageAdapter)u)).collect(Collectors.toList()); final List<VirtualFile> files = ContainerUtil.map(usages, i -> ((UsageInFile)i).getFile()); if (ReadonlyStatusHandler.getInstance(mySearchContext.getProject()).ensureFilesWritable(files).hasReadonlyFiles()) { return; } removeUsagesAndSelectNext(usages, excluded); final List<ReplacementInfo> replacementInfos = ContainerUtil.map(usages, usage2ReplacementInfo::get); final LocalHistoryAction action = LocalHistory.getInstance().startAction(SSRBundle.message("structural.replace.title")); try { CommandProcessor.getInstance().executeCommand( mySearchContext.getProject(), () -> replacer.replaceAll(replacementInfos), SSRBundle.message("structural.replace.title"), null); } finally { action.finish(); } }