PsiElement (PsiElement anchorElement) { PsiElement child = anchorElement; while (child != null) { PsiElement prev = child.getPrevSibling(); if (CommonJavaRefactoringUtil.isExpressionAnchorElement(prev)) break; if (PsiUtil.isJavaToken(prev, JavaTokenType.LBRACE)) break; child = prev; } child = PsiTreeUtil.skipWhitespacesAndCommentsForward(child); PsiElement anchor; if (child != null) { anchor = child; } else { anchor = anchorElement; } return anchor; }