void (@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { final PsiElement element = descriptor.getPsiElement(); final PyFunction problemFunction = PsiTreeUtil.getParentOfType(element, PyFunction.class); if (problemFunction == null) return; List<PyReferenceExpression> usages = StreamEx.of(PyPsiIndexUtil.findUsages(problemFunction, false)) .map(UsageInfo::getElement) .select(PyReferenceExpression.class) .toList(); ApplicationManagerEx.getApplicationEx().runWriteActionWithCancellableProgressInDispatchThread( PyPsiBundle.message("refactoring.progress.title.updating.existing.usages"), problemFunction.getProject(), null, (indicator -> { updateDefinition(problemFunction); for (int i = 0; i < usages.size(); i++) { indicator.checkCanceled(); indicator.setFraction((i + 1.0) / usages.size()); updateUsage(usages.get(i)); } }) ); }