PsiElement (@Nullable PsiElement element, Editor editor) { if (!(element instanceof LeafPsiElement)) return null; FoldRegion region = editor.getFoldingModel().getCollapsedRegionAtOffset(element.getTextRange().getStartOffset()); if (region == null) return null; PsiElement editableElement = EditPropertyValueAction.getEditableElement(region); UElement uElement = UastContextKt.toUElement(editableElement); //case: "literalAnnotatedWithPropertyKey" if (uElement instanceof ULiteralExpression) { return JavaI18nUtil.resolveProperty((ULiteralExpression)uElement); } if (uElement instanceof UQualifiedReferenceExpression) { uElement = ((UQualifiedReferenceExpression)uElement).getSelector(); } //case: MyBundle.message("literalAnnotatedWithPropertyKey", param1, param2) if (uElement instanceof UCallExpression call) { for (UExpression expression : call.getValueArguments()) { if (expression instanceof ULiteralExpression && PropertyFoldingBuilder.isI18nProperty((ULiteralExpression)expression)) { Property property = JavaI18nUtil.resolveProperty(expression); if (property != null) { return property; } } } } return null; }