PsiElement (ConfigurationContext context, LinkedHashSet<? super String> classes) { PsiElement[] result; final DataContext dataContext = context.getDataContext(); if (TestsUIUtil.isMultipleSelectionImpossible(dataContext)) { return null; } final PsiElement[] locationElements = collectLocationElements(classes, dataContext); PsiElementProcessor.CollectElements<PsiElement> processor = new PsiElementProcessor.CollectElements<>(); if (locationElements != null) { collectTestMembers(locationElements, false, true, processor); result = processor.toArray(); } else if (collectContextElements(dataContext, true, true, classes, processor)) { result = processor.toArray(); } else { return null; } if (result.length <= 1) { return null; } return result[0]; }