PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { private void handle(@NotNull PsiElement element) { if (IOUtil.isAscii(element.getText())) return; // "Basic Latin" is a proper noun //noinspection DialogTitleCapitalization holder.registerProblem(element, JavaI18nBundle.message("inspection.non.basic.latin.character.display.name"), new ConvertToBasicLatinFix()); } @Override public void visitComment(@NotNull PsiComment comment) { super.visitComment(comment); handle(comment); } @Override public void visitLiteralExpression(@NotNull PsiLiteralExpression expression) { super.visitLiteralExpression(expression); if (!PsiUtil.isJavaToken(expression.getFirstChild(), ElementType.TEXT_LITERALS)) return; handle(expression); } @Override public void visitFragment(@NotNull PsiFragment fragment) { super.visitFragment(fragment); handle(fragment); } @Override public void visitDocComment(@NotNull PsiDocComment comment) { super.visitDocComment(comment); handle(comment); } }; }