void (@NotNull PsiElement sourcePsi, @NotNull UInjectionHost expression) { String stringValue = getStringValueOfKnownPart(expression); if (StringUtil.isEmptyOrSpaces(stringValue)) { return; } Set<PsiModifierListOwner> nonNlsTargets = new HashSet<>(); NlsInfo info = getExpectedNlsInfo(myHolder.getProject(), expression, stringValue, nonNlsTargets, myOnTheFly, ignoreForAllButNls); if (!(info instanceof NlsInfo.Localized)) { return; } UField parentField = UastUtils.getParentOfType(expression, UField.class); // PsiTreeUtil.getParentOfType(expression, PsiField.class); if (parentField != null) { nonNlsTargets.add((PsiModifierListOwner)parentField.getJavaPsi()); } final String description = JavaI18nBundle.message("inspection.i18n.message.general.with.value", "#ref"); List<LocalQuickFix> fixes = new ArrayList<>(); if (sourcePsi instanceof PsiLiteralExpression && PsiUtil.isLanguageLevel5OrHigher(sourcePsi)) { final JavaPsiFacade facade = JavaPsiFacade.getInstance(myHolder.getProject()); for (PsiModifierListOwner element : nonNlsTargets) { if (NlsInfo.forModifierListOwner(element).getNlsStatus() == ThreeState.UNSURE) { if (!element.getManager().isInProject(element) || facade.findClass(AnnotationUtil.NON_NLS, element.getResolveScope()) != null) { fixes.add(new NonNlsAnnotationProvider().createFix(element)); } } } } if (!(sourcePsi instanceof PsiLiteralExpression) || !isSwitchCase(expression)) { if (myOnTheFly) { fixes.add(new I18nizeQuickFix((NlsInfo.Localized)info)); if (I18nizeConcatenationQuickFix.getEnclosingLiteralConcatenation(sourcePsi) != null) { fixes.add(new I18nizeConcatenationQuickFix((NlsInfo.Localized)info)); } if (sourcePsi instanceof PsiLiteralExpression && !isNotConstantFieldInitializer((PsiExpression)sourcePsi)) { fixes.add(createIntroduceConstantFix()); } } else { fixes.add(new I18nizeBatchQuickFix()); } } LocalQuickFix[] farr = fixes.toArray(LocalQuickFix.EMPTY_ARRAY); myHolder.registerProblem(sourcePsi, description, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, farr); }