void (UsageInfo @NotNull [] usages) { try { SmartPointerManager pointerManager = SmartPointerManager.getInstance(myProject); List<SmartPsiElementPointer<PsiElement>> pointers = ContainerUtil.map(myElements, pointerManager::createSmartPsiElementPointer); for (UsageInfo usage : usages) { if (usage instanceof SafeDeleteCustomUsageInfo) { ((SafeDeleteCustomUsageInfo) usage).performRefactoring(); } } for (PsiElement element : myElements) { for (SafeDeleteProcessorDelegate delegate : SafeDeleteProcessorDelegate.EP_NAME.getExtensionList()) { if (delegate.handlesElement(element)) { delegate.prepareForDeletion(element); break; } } } for (SmartPsiElementPointer<PsiElement> pointer : pointers) { PsiElement element = pointer.getElement(); if (element != null) { element.delete(); } } if (myAfterRefactoringCallback != null) myAfterRefactoringCallback.run(); } catch (IncorrectOperationException e) { RefactoringUIUtil.processIncorrectOperation(myProject, e); } }