void (UsageInfo @NotNull [] usages) { try { final String superClassName = myClass.getName(); final String oldQualifiedName = myClass.getQualifiedName(); myClass.setName(myNewClassName); PsiClass superClass = extractSuper(superClassName); final PsiDirectory initialDirectory = myClass.getContainingFile().getContainingDirectory(); PsiFile containingFile = myClass.getContainingFile(); try { if (myTargetDirectory != initialDirectory) { containingFile = (PsiFile)myTargetDirectory.add(myClass.getContainingFile().copy()); myClass.getContainingFile().delete(); } } catch (IncorrectOperationException e) { RefactoringUIUtil.processIncorrectOperation(myProject, e); } for (final UsageInfo usage : usages) { if (usage instanceof BindToOldUsageInfo) { final PsiReference reference = usage.getReference(); if (reference != null && reference.getElement().isValid()) { reference.bindToElement(myClass); } } } if (!Objects.equals(oldQualifiedName, superClass.getQualifiedName())) { processTurnToSuperRefs(usages, superClass); } if (containingFile instanceof PsiJavaFile) { JavaCodeStyleManager.getInstance(myProject).removeRedundantImports((PsiJavaFile) containingFile); } } catch (IncorrectOperationException e) { LOG.error(e); } performVariablesRenaming(); }