PsiExpression (PsiElement parenthesisOwner) { if (parenthesisOwner instanceof PsiTypeCastExpression) { return ((PsiTypeCastExpression)parenthesisOwner).getOperand(); } if (parenthesisOwner instanceof PsiParenthesizedExpression) { PsiElement next = parenthesisOwner.getNextSibling(); while ((next instanceof PsiEmptyExpressionImpl || next instanceof PsiErrorElement || next instanceof PsiWhiteSpace)) { next = next.getNextSibling(); } if (next instanceof PsiExpression) { return (PsiExpression)next; } } return null; }