boolean (PsiElement context) { if (context.getParent() instanceof GrReferenceExpression && context.getParent().getParent() instanceof GrCaseSection) { return true; } final GrSwitchElement switchElement = PsiTreeUtil.getParentOfType(context, GrSwitchElement.class, true, GrCodeBlock.class); if (switchElement == null) return false; final GrExpression condition = switchElement.getCondition(); return condition == null || !PsiTreeUtil.isAncestor(condition, context, false); }