PsiElement (boolean replaceAllOccurrences) { if (replaceAllOccurrences) { if (myContext.getOccurrences().length > 0) { GroovyRefactoringUtil.sortOccurrences(myContext.getOccurrences()); return myContext.getOccurrences()[0]; } else { return myContext.getPlace(); } } else { final GrExpression expression = myContext.getExpression(); return expression != null ? expression : myContext.getStringPart().getLiteral(); } }