List<XmlTag> (List<CommonProblemDescriptor> descriptors) { List<XmlTag> tags = new ArrayList<>(); for (CommonProblemDescriptor d : descriptors) { if (d instanceof ProblemDescriptor) { PsiElement e = ((ProblemDescriptor)d).getPsiElement(); if (e instanceof XmlTag) { tags.add((XmlTag)e); } else if (e instanceof XmlAttributeValue) { PsiElement parent = e.getParent(); if (parent instanceof XmlAttribute) { ContainerUtil.addIfNotNull(tags, ((XmlAttribute)parent).getParent()); } } } } return tags; }