boolean (@NotNull ASTNode pairNode) { PsiElement prev = PsiTreeUtil.skipWhitespacesAndCommentsBackward(pairNode.getPsi()); if (prev != null && prev.getNode().getElementType() != JavaTokenType.LPARENTH) return false; PsiElement next = PsiTreeUtil.skipWhitespacesAndCommentsForward(pairNode.getPsi()); if (next != null && next.getNode().getElementType() != JavaTokenType.RPARENTH) return false; return true; }