use of com.intellij.psi.xml.XmlElement in project intellij-community by JetBrains.
the class DomInvocationHandler method createChildTag.
protected final XmlTag createChildTag(final EvaluatedXmlName tagName) {
final String localName = tagName.getXmlName().getLocalName();
if (localName.contains(":")) {
try {
return XmlElementFactory.getInstance(myManager.getProject()).createTagFromText("<" + localName + "/>");
} catch (IncorrectOperationException e) {
LOG.error(e);
}
}
final XmlElement element = getXmlElement();
assert element != null;
return getXmlTag().createChildTag(localName, tagName.getNamespace(element, getFile()), null, false);
}
use of com.intellij.psi.xml.XmlElement in project intellij-community by JetBrains.
the class PhysicalDomParentStrategy method strategyEquals.
public static boolean strategyEquals(DomParentStrategy strategy, final Object o) {
if (strategy == o)
return true;
if (!(o instanceof DomParentStrategy))
return false;
final XmlElement thatElement = ((DomParentStrategy) o).getXmlElement();
if (thatElement == null)
return false;
XmlElement element = strategy.getXmlElement();
if (element == null)
return false;
if (xmlElementsEqual(element, thatElement)) {
if (element != thatElement) {
final PsiElement nav1 = element.getNavigationElement();
final PsiElement nav2 = thatElement.getNavigationElement();
if (nav1 != nav2) {
PsiElement curContext = findIncluder(element);
PsiElement navContext = findIncluder(nav1);
LOG.error(LogMessageEx.createEvent("x:include processing error", "nav1,nav2=" + nav1 + ", " + nav2 + ";\n" + nav1.getContainingFile() + ":" + nav1.getTextRange().getStartOffset() + "!=" + nav2.getContainingFile() + ":" + nav2.getTextRange().getStartOffset() + ";\n" + (nav1 == element) + ";" + (nav2 == thatElement) + ";\n" + "contexts equal: " + (curContext == navContext) + ";\n" + "curContext?.physical=" + (curContext != null && curContext.isPhysical()) + ";\n" + "navContext?.physical=" + (navContext != null && navContext.isPhysical()) + ";\n" + "myElement.physical=" + element.isPhysical() + ";\n" + "thatElement.physical=" + thatElement.isPhysical() + "\n" + DebugUtil.currentStackTrace(), new Attachment("Including tag text 1.xml", curContext == null ? "null" : curContext.getText()), new Attachment("Including tag text 2.xml", navContext == null ? "null" : navContext.getText())));
throw new AssertionError();
}
}
return true;
}
return false;
}
use of com.intellij.psi.xml.XmlElement in project intellij-community by JetBrains.
the class XmlElementImpl method findElementByTokenType.
public XmlElement findElementByTokenType(final IElementType type) {
final XmlElement[] result = new XmlElement[1];
result[0] = null;
processElements(new PsiElementProcessor() {
@Override
public boolean execute(@NotNull PsiElement element) {
if (element instanceof TreeElement && ((ASTNode) element).getElementType() == type) {
result[0] = (XmlElement) element;
return false;
}
return true;
}
}, this);
return result[0];
}
use of com.intellij.psi.xml.XmlElement in project intellij-community by JetBrains.
the class XmlElementImpl method getNavigationElement.
@Override
@NotNull
public PsiElement getNavigationElement() {
if (!isPhysical()) {
final XmlElement including = getUserData(INCLUDING_ELEMENT);
if (including != null) {
return including;
}
PsiElement astParent = getAstParent();
PsiElement parentNavigation = astParent.getNavigationElement();
if (parentNavigation.getTextOffset() == getTextOffset())
return parentNavigation;
return this;
}
return super.getNavigationElement();
}
use of com.intellij.psi.xml.XmlElement in project intellij-community by JetBrains.
the class XmlEnumeratedTypeImpl method getEnumeratedValues.
@Override
public XmlElement[] getEnumeratedValues() {
final List<XmlElement> result = new ArrayList<>();
processElements(new FilterElementProcessor(new XmlTokenTypeFilter(XmlTokenType.XML_NAME), result), this);
return result.toArray(new XmlElement[result.size()]);
}
Aggregations