void (@NotNull PsiElement token, int offsetInElement, @NotNull Consumer<? super PomTarget> consumer) { if (!(token instanceof XmlToken)) return; final PsiElement element = token.getParent(); if (element == null) return; final IElementType tokenType = ((XmlToken)token).getTokenType(); final PsiElement parentElement = element.getParent(); final DomManager domManager = DomManager.getDomManager(token.getProject()); final DomElement nameElement; if (tokenType == XmlTokenType.XML_DATA_CHARACTERS && element instanceof XmlText && parentElement instanceof XmlTag tag) { for (XmlText text : tag.getValue().getTextElements()) { if (InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)text)) { return; } } nameElement = domManager.getDomElement(tag); } else if (tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN && element instanceof XmlAttributeValue && parentElement instanceof XmlAttribute) { if (InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)element)) { return; } nameElement = domManager.getDomElement((XmlAttribute)parentElement); } else { return; } if (!(nameElement instanceof GenericDomValue)) { return; } DomElement parent = nameElement.getParent(); if (parent == null) { return; } final DomTarget target = createDomTarget(parent, nameElement); if (target != null) { consumer.consume(target); } }