boolean (ConfigurationContext context, Set<String> patterns) { final LinkedHashSet<String> classes = new LinkedHashSet<>(); final DataContext dataContext = context.getDataContext(); if (TestsUIUtil.isMultipleSelectionImpossible(dataContext)) { return false; } final PsiElement[] locationElements = collectLocationElements(classes, dataContext); if (locationElements == null) { collectContextElements(dataContext, true, false, classes, new PsiElementProcessor.CollectElements<>()); } int patternsSize = patterns.size(); if (patternsSize == classes.size()) { final Iterator<String> patternsIterator = patterns.iterator(); final Iterator<String> classesIterator = classes.iterator(); while (patternsIterator.hasNext() && classesIterator.hasNext()) { if (!Objects.equals(patternsIterator.next(), classesIterator.next())) { return false; } } if (patternsSize == 1) { final String pattern = patterns.iterator().next(); if (!pattern.contains(",")) { final PsiMethod method = PsiTreeUtil.getParentOfType(CommonDataKeys.PSI_ELEMENT.getData(dataContext), PsiMethod.class); return method != null && isTestMethod(false, method); } } return true; } return false; }