void (final @NotNull Project project, final CommonProblemDescriptor @NotNull [] descriptors, final @NotNull List<PsiElement> psiElementsToIgnore, final @Nullable Runnable refreshViews) { for (CommonProblemDescriptor descriptor : descriptors) { RefElement refElement = (RefElement)myProcessor.getElement(descriptor); if (refElement instanceof RefMethod refMethod && refElement.isValid()) { if (myNeedToDeleteHierarchy) { deleteHierarchy(refMethod, psiElementsToIgnore); } else { deleteMethod(refMethod, psiElementsToIgnore); } } } ApplicationManager.getApplication().invokeLater(() -> SafeDeleteHandler.invoke(project, PsiUtilCore.toPsiElementArray(psiElementsToIgnore), false, refreshViews), project.getDisposed()); }