do not introduce from q.selection (IDEA-87461)

This commit is contained in:
Anna Kozlova
2012-06-15 17:48:25 +04:00
parent e8f0205e24
commit 2d25763038
3 changed files with 21 additions and 0 deletions
@@ -365,6 +365,9 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
final PsiReferenceExpression refExpr = PsiTreeUtil.getParentOfType(toBeExpression.findElementAt(refIdx[0]), PsiReferenceExpression.class);
assert refExpr != null;
if (toBeExpression == refExpr && refIdx[0] > 0) {
return null;
}
if (ReplaceExpressionUtil.isNeedParenthesis(refExpr.getNode(), tempExpr.getNode())) {
tempExpr.putCopyableUserData(NEED_PARENTHESIS, Boolean.TRUE);
return tempExpr;