PsiElement (PsiElement replacement, final PsiElement el) { final PsiNamedElement nameElement = getSymbolReplacementTarget(el); if (nameElement != null) { final PsiElement oldReplacement = replacement; replacement = el.copy(); ((PsiNamedElement)replacement).setName(oldReplacement.getText()); } return replacement; }