@Override
 public boolean accepts(
     @NotNull PsiSwitchStatement psiSwitchStatement,
     ProcessingContext context) {
   final PsiExpression expression =
       psiSwitchStatement.getExpression();
   if (expression == null) return false;
   PsiClass aClass =
       PsiUtil.resolveClassInClassTypeOnly(expression.getType());
   return aClass != null && aClass.isEnum();
 }
 @NotNull
 public static Set<PsiField> findConstantsUsedInSwitch(@Nullable PsiElement position) {
   if (IN_SWITCH_LABEL.accepts(position)) {
     Set<PsiField> used = ContainerUtil.newLinkedHashSet();
     PsiSwitchStatement sw = PsiTreeUtil.getParentOfType(position, PsiSwitchStatement.class);
     assert sw != null;
     final PsiCodeBlock body = sw.getBody();
     assert body != null;
     for (PsiStatement statement : body.getStatements()) {
       if (statement instanceof PsiSwitchLabelStatement) {
         final PsiExpression value = ((PsiSwitchLabelStatement) statement).getCaseValue();
         if (value instanceof PsiReferenceExpression) {
           final PsiElement target = ((PsiReferenceExpression) value).resolve();
           if (target instanceof PsiField) {
             used.add(CompletionUtil.getOriginalOrSelf((PsiField) target));
           }
         }
       }
     }
     return used;
   }
   return Collections.emptySet();
 }