@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();
 }
  @Override
  public String advertise(@NotNull final CompletionParameters parameters) {
    if (!(parameters.getOriginalFile() instanceof PsiJavaFile)) return null;

    if (parameters.getCompletionType() == CompletionType.BASIC
        && parameters.getInvocationCount() > 0) {
      PsiElement position = parameters.getPosition();
      if (psiElement()
          .withParent(
              psiReferenceExpression()
                  .withFirstChild(psiReferenceExpression().referencing(psiClass())))
          .accepts(position)) {
        if (CompletionUtil.shouldShowFeature(
            parameters, JavaCompletionFeatures.GLOBAL_MEMBER_NAME)) {
          final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
          if (shortcut != null) {
            return "Pressing "
                + shortcut
                + " twice without a class qualifier would show all accessible static methods";
          }
        }
      }
    }

    if (parameters.getCompletionType() != CompletionType.SMART
        && shouldSuggestSmartCompletion(parameters.getPosition())) {
      if (CompletionUtil.shouldShowFeature(
          parameters, CodeCompletionFeatures.EDITING_COMPLETION_SMARTTYPE_GENERAL)) {
        final String shortcut = getActionShortcut(IdeActions.ACTION_SMART_TYPE_COMPLETION);
        if (shortcut != null) {
          return CompletionBundle.message("completion.smart.hint", shortcut);
        }
      }
    }

    if (parameters.getCompletionType() == CompletionType.SMART
        && parameters.getInvocationCount() == 1) {
      final PsiType[] psiTypes =
          ExpectedTypesGetter.getExpectedTypes(parameters.getPosition(), true);
      if (psiTypes.length > 0) {
        if (CompletionUtil.shouldShowFeature(
            parameters, JavaCompletionFeatures.SECOND_SMART_COMPLETION_TOAR)) {
          final String shortcut = getActionShortcut(IdeActions.ACTION_SMART_TYPE_COMPLETION);
          if (shortcut != null) {
            for (final PsiType psiType : psiTypes) {
              final PsiType type = PsiUtil.extractIterableTypeParameter(psiType, false);
              if (type != null) {
                return CompletionBundle.message(
                    "completion.smart.aslist.hint", shortcut, type.getPresentableText());
              }
            }
          }
        }
        if (CompletionUtil.shouldShowFeature(
            parameters, JavaCompletionFeatures.SECOND_SMART_COMPLETION_ASLIST)) {
          final String shortcut = getActionShortcut(IdeActions.ACTION_SMART_TYPE_COMPLETION);
          if (shortcut != null) {
            for (final PsiType psiType : psiTypes) {
              if (psiType instanceof PsiArrayType) {
                final PsiType componentType = ((PsiArrayType) psiType).getComponentType();
                if (!(componentType instanceof PsiPrimitiveType)) {
                  return CompletionBundle.message(
                      "completion.smart.toar.hint", shortcut, componentType.getPresentableText());
                }
              }
            }
          }
        }

        if (CompletionUtil.shouldShowFeature(
            parameters, JavaCompletionFeatures.SECOND_SMART_COMPLETION_CHAIN)) {
          final String shortcut = getActionShortcut(IdeActions.ACTION_SMART_TYPE_COMPLETION);
          if (shortcut != null) {
            return CompletionBundle.message("completion.smart.chain.hint", shortcut);
          }
        }
      }
    }
    return null;
  }