private static boolean isListContext(PsiElement element) {
    if (element instanceof PsiParameter || element instanceof PsiClass) {
      return true;
    }
    final PsiElement parent = element.getParent();

    return (parent instanceof PsiExpressionList && !parent.getClass().getSimpleName().startsWith("Jsp")) ||
           parent instanceof PsiCodeBlock || parent instanceof PsiCodeFragment ||
           parent instanceof PsiClass ||
           parent instanceof PsiIfStatement && (((PsiIfStatement)parent).getThenBranch() == element ||
                                                ((PsiIfStatement)parent).getElseBranch() == element) ||
           parent instanceof PsiLoopStatement && ((PsiLoopStatement)parent).getBody() == element;
  }
private static boolean isListContext(PsiElement element)