PatternLabelEvaluator (@NotNull PsiPattern element) { PsiSwitchBlock switchBlock = PsiTreeUtil.getParentOfType(element, PsiSwitchBlock.class); if (switchBlock == null) return null; PsiExpression selector = switchBlock.getExpression(); if (selector == null) return null; selector.accept(this); Evaluator selectorEvaluator = myResult; PsiPrimaryPattern primaryPattern = JavaPsiPatternUtil.getTypedPattern(element); PatternEvaluator patternEvaluator = createPatternEvaluator(primaryPattern); if (patternEvaluator == null) return null; return new PatternLabelEvaluator(selectorEvaluator, patternEvaluator); }