PsiPolyadicExpression (final PsiElement element) { PsiPolyadicExpression binaryExpression = PsiTreeUtil.getParentOfType(element, PsiPolyadicExpression.class, false, PsiMember.class); if (binaryExpression == null) return null; final PsiClassType stringType = PsiType.getJavaLangString(element.getManager(), element.getResolveScope()); if (!stringType.equals(binaryExpression.getType())) return null; while (true) { final PsiElement parent = binaryExpression.getParent(); if (!(parent instanceof PsiPolyadicExpression parentBinaryExpression)) return binaryExpression; if (!stringType.equals(parentBinaryExpression.getType())) return binaryExpression; binaryExpression = parentBinaryExpression; } }