PsiSwitchLabeledRuleStatement (PsiElement position) { PsiElement parent = position.getParent(); return parent.getParent() instanceof PsiExpressionStatement stmt && stmt.getParent() instanceof PsiSwitchLabeledRuleStatement rule ? rule : null; }