PsiMethod (PsiMethod methodToRename, String newName) { final PsiMethod prototype = (PsiMethod)methodToRename.copy(); if (prototype != null) { try { prototype.setName(newName); } catch (IncorrectOperationException e) { LOG.error(e); return null; } } return prototype; }