CauseItem (AssignInstruction instruction, DfaValue target) { PsiExpression rExpression = instruction.getRExpression(); PsiElement anchor = null; String targetName = target.toString(); if (rExpression != null) { PsiElement parent = PsiUtil.skipParenthesizedExprUp(rExpression.getParent()); if (parent instanceof PsiAssignmentExpression) { anchor = ((PsiAssignmentExpression)parent).getOperationSign(); targetName = ((PsiAssignmentExpression)parent).getLExpression().getText(); } else if (parent instanceof PsiVariable) { ASTNode node = parent.getNode(); if (node instanceof CompositeElement) { anchor = ((CompositeElement)node).findChildByRoleAsPsiElement(ChildRole.INITIALIZER_EQ); } targetName = ((PsiVariable)parent).getName(); } if (anchor == null) { anchor = rExpression; } } PsiExpression stripped = PsiUtil.skipParenthesizedExprDown(rExpression); String message; if (stripped instanceof PsiLiteralExpression) { message = JavaAnalysisBundle .message("dfa.find.cause.was.assigned.to", targetName, StringUtil.shortenTextWithEllipsis(stripped.getText(), 40, 5)); } else { message = JavaAnalysisBundle.message("dfa.find.cause.was.assigned", targetName); } return new CauseItem(message, anchor); }