void (String name, PsiElement nameElement) { final PsiElement newNameElement = GroovyPsiElementFactory.getInstance(nameElement.getProject()).createReferenceNameFromText(name); nameElement.replace(newNameElement); }