PsiElement (@Nullable PsiElement element, @Nullable Editor editor) { if (element == null) return null; RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(element); PsiElement substituted = processor.substituteElementToRename(element, editor); if (substituted == null || !PsiElementRenameHandler.canRename(element.getProject(), editor, substituted)) return null; return substituted; }