void (final UsageInfo @NotNull [] usages) { super.performRefactoring(usages); if (editor != null) { ApplicationManager.getApplication().invokeLater(() -> { final List<PsiElement> result = new ArrayList<>(); for (UsageInfo usage : usages) { final PsiElement element = usage.getElement(); if (element == null || !containingFiles.contains(element.getContainingFile())) continue; if (element instanceof PsiMethod) { result.add(((PsiMethod)element).getReturnTypeElement()); } else if (element instanceof PsiVariable) { result.add(((PsiVariable)element).getTypeElement()); } else { result.add(element); } } RefactoringUtil.highlightAllOccurrences(project, PsiUtilCore.toPsiElementArray(result), editor); }); } if (optimizeImports) { final JavaCodeStyleManager javaCodeStyleManager = JavaCodeStyleManager.getInstance(myProject); final Set<PsiFile> affectedFiles = new HashSet<>(); for (UsageInfo usage : usages) { final PsiFile usageFile = usage.getFile(); if (usageFile != null) { affectedFiles.add(usageFile); } } for (PsiFile file : affectedFiles) { javaCodeStyleManager.optimizeImports(file); javaCodeStyleManager.shortenClassReferences(file); } } }