diff options
Diffstat (limited to 'xml/dom-impl/src/com')
3 files changed, 22 insertions, 12 deletions
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java index 88bc70044268..a0529b60a8fc 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java @@ -170,7 +170,10 @@ public abstract class DomInvocationHandler<T extends AbstractDomChildDescription @Override public void run() { ensureXmlElementExists(); - final DomGenericInfoEx genericInfo = getGenericInfo(); + final DomInvocationHandler otherInvocationHandler = DomManagerImpl.getDomInvocationHandler(other); + assert otherInvocationHandler != null : other; + + final DomGenericInfoEx genericInfo = otherInvocationHandler.getGenericInfo(); for (final AttributeChildDescriptionImpl description : genericInfo.getAttributeChildrenDescriptions()) { description.getDomAttributeValue(DomInvocationHandler.this).setStringValue(description.getDomAttributeValue(other).getStringValue()); } @@ -197,7 +200,7 @@ public abstract class DomInvocationHandler<T extends AbstractDomChildDescription } } - final String stringValue = DomManagerImpl.getDomInvocationHandler(other).getValue(); + final String stringValue = otherInvocationHandler.getValue(); if (StringUtil.isNotEmpty(stringValue)) { setValue(stringValue); } @@ -659,12 +662,12 @@ public abstract class DomInvocationHandler<T extends AbstractDomChildDescription return new AttributeChildInvocationHandler(evaluatedXmlName, description, myManager, strategy, stub); } final XmlTag tag = getXmlTag(); - + if (tag != null) { // TODO: this seems ugly String ns = evaluatedXmlName.getNamespace(tag, getFile()); final XmlAttribute attribute = tag.getAttribute(description.getXmlName().getLocalName(), ns.equals(tag.getNamespace())? null:ns); - + if (attribute != null) { PsiUtilCore.ensureValid(attribute); AttributeChildInvocationHandler semElement = diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java index b77a838eb0ec..9a90fbf0fcec 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java @@ -44,7 +44,7 @@ public class IndexedElementInvocationHandler extends DomInvocationHandler<FixedC final DomParentStrategy strategy, final DomManagerImpl manager, @Nullable ElementStub stub) { - super(description.getType(), strategy, tagName, description, manager, strategy.getXmlElement() != null, stub); + super(description.getType(), strategy, tagName, description, manager, strategy.isPhysical(), stub); myIndex = index; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/stubs/StubParentStrategy.java b/xml/dom-impl/src/com/intellij/util/xml/stubs/StubParentStrategy.java index b827c6221746..951c6f576249 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/stubs/StubParentStrategy.java +++ b/xml/dom-impl/src/com/intellij/util/xml/stubs/StubParentStrategy.java @@ -20,6 +20,7 @@ import com.intellij.psi.xml.XmlElement; import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlTag; import com.intellij.util.xml.impl.*; +import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -32,6 +33,11 @@ import java.util.List; public class StubParentStrategy implements DomParentStrategy { private final static Logger LOG = Logger.getInstance(StubParentStrategy.class); + protected final DomStub myStub; + + public StubParentStrategy(@NotNull DomStub stub) { + myStub = stub; + } public static StubParentStrategy createAttributeStrategy(@Nullable AttributeStub stub, @NotNull final DomStub parent) { if (stub == null) { @@ -59,12 +65,6 @@ public class StubParentStrategy implements DomParentStrategy { } } - protected final DomStub myStub; - - public StubParentStrategy(@NotNull DomStub stub) { - myStub = stub; - } - @Override public DomInvocationHandler getParentHandler() { DomStub parentStub = myStub.getParentStub(); @@ -82,7 +82,14 @@ public class StubParentStrategy implements DomParentStrategy { // for custom elements, namespace information is lost // todo: propagate ns info through DomChildDescriptions - XmlTag[] tags = parentTag.getSubTags(); + XmlTag[] tags; + try { + XmlUtil.BUILDING_DOM_STUBS.set(true); + tags = parentTag.getSubTags(); + } + finally { + XmlUtil.BUILDING_DOM_STUBS.set(false); + } int i = 0; String nameToFind = myStub.getName(); |