use of com.intellij.util.xml.EvaluatedXmlName in project intellij-community by JetBrains.
the class DomSemContributor method findChildrenDescription.
@Nullable
private static <T extends DomChildrenDescription> T findChildrenDescription(List<T> descriptions, XmlTag tag, DomInvocationHandler parent) {
final String localName = tag.getLocalName();
String namespace = null;
final String qName = tag.getName();
final XmlFile file = parent.getFile();
//noinspection ForLoopReplaceableByForEach
for (int i = 0, size = descriptions.size(); i < size; i++) {
final T description = descriptions.get(i);
final XmlName xmlName = description.getXmlName();
if (localName.equals(xmlName.getLocalName()) || qName.equals(xmlName.getLocalName())) {
final EvaluatedXmlName evaluatedXmlName = parent.createEvaluatedXmlName(xmlName);
if (DomImplUtil.isNameSuitable(evaluatedXmlName, localName, qName, namespace == null ? namespace = tag.getNamespace() : namespace, file)) {
return description;
}
}
}
return null;
}
use of com.intellij.util.xml.EvaluatedXmlName in project intellij-community by JetBrains.
the class IndexedElementInvocationHandler method undefineInternal.
@Override
public void undefineInternal() {
final DomInvocationHandler parent = getParentHandler();
assert parent != null : "write operations should be performed on the DOM having a parent, your DOM may be not very fresh";
final XmlTag parentTag = parent.getXmlTag();
if (parentTag == null)
return;
final EvaluatedXmlName xmlElementName = getXmlName();
final FixedChildDescriptionImpl description = getChildDescription();
final int totalCount = description.getCount();
final List<XmlTag> subTags = DomImplUtil.findSubTags(parentTag, xmlElementName, getFile());
if (subTags.size() <= myIndex) {
return;
}
XmlTag tag = getXmlTag();
if (tag == null)
return;
final boolean changing = getManager().setChanging(true);
try {
detach();
if (totalCount == myIndex + 1 && subTags.size() >= myIndex + 1) {
for (int i = myIndex; i < subTags.size(); i++) {
subTags.get(i).delete();
}
} else if (subTags.size() == myIndex + 1) {
tag.delete();
} else {
setXmlElement((XmlTag) tag.replace(parent.createChildTag(getXmlName())));
}
} catch (IncorrectOperationException e) {
LOG.error(e);
} finally {
getManager().setChanging(changing);
}
fireUndefinedEvent();
}
Aggregations