public static boolean isGuarded(@NotNull PsiCaseLabelElement pattern) {
    PsiElement parent = pattern.getParent();
    if (parent instanceof PsiCaseLabelElementList) {
      PsiElement gParent = parent.getParent();
      if (gParent instanceof PsiSwitchLabelStatementBase) {
        PsiExpression guardExpression = ((PsiSwitchLabelStatementBase)gParent).getGuardExpression();
        if (guardExpression != null && !Boolean.TRUE.equals(evaluateConstant(guardExpression))) {
          return true;
        }
      }
    }
    return false;
  }
public static boolean isGuarded(@NotNull PsiCaseLabelElement pattern)