private static PsiElement getContainingStatement(PsiElement root) {
    final PsiStatement statement = PsiTreeUtil.getParentOfType(root, PsiStatement.class);
    PsiExpression condition = getContainingCondition(root, statement);
    if (condition != null) return condition;
    final PsiField field = PsiTreeUtil.getParentOfType(root, PsiField.class);
    return statement != null ? statement : field != null ? field : root;
  }
private static PsiElement getContainingStatement(PsiElement root)