Search in sources :

Example 31 with DomEvent

use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.

the class CollectionElementInvocationHandler method undefineInternal.

@Override
public final void undefineInternal() {
    final DomElement parent = getParent();
    final XmlTag tag = getXmlTag();
    if (tag == null)
        return;
    getManager().cacheHandler(getCacheKey(), tag, null);
    setXmlElement(null);
    deleteTag(tag);
    getManager().fireEvent(new DomEvent(parent, false));
}
Also used : DomElement(com.intellij.util.xml.DomElement) XmlTag(com.intellij.psi.xml.XmlTag) DomEvent(com.intellij.util.xml.events.DomEvent)

Example 32 with DomEvent

use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.

the class DomInvocationHandler method ensureTagExists.

@Override
public XmlTag ensureTagExists() {
    assertValid();
    XmlTag tag = getXmlTag();
    if (tag != null)
        return tag;
    tag = setEmptyXmlTag();
    setXmlElement(tag);
    final DomElement element = getProxy();
    myManager.fireEvent(new DomEvent(element, true));
    addRequiredChildren();
    myManager.cacheHandler(getCacheKey(), tag, this);
    return getXmlTag();
}
Also used : XmlTag(com.intellij.psi.xml.XmlTag) DomEvent(com.intellij.util.xml.events.DomEvent)

Example 33 with DomEvent

use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.

the class DomInvocationHandler method setValue.

protected void setValue(@Nullable final String value) {
    final XmlTag tag = ensureTagExists();
    myManager.runChange(() -> setTagValue(tag, value));
    myManager.fireEvent(new DomEvent(getProxy(), false));
}
Also used : XmlTag(com.intellij.psi.xml.XmlTag) DomEvent(com.intellij.util.xml.events.DomEvent)

Example 34 with DomEvent

use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.

the class DomInvocationHandler method addCollectionChild.

public final DomElement addCollectionChild(final CollectionChildDescriptionImpl description, final Type type, int index) throws IncorrectOperationException {
    final EvaluatedXmlName name = createEvaluatedXmlName(description.getXmlName());
    final XmlTag tag = addEmptyTag(name, index);
    final CollectionElementInvocationHandler handler = new CollectionElementInvocationHandler(type, tag, description, this, null);
    myManager.fireEvent(new DomEvent(getProxy(), false));
    getManager().getTypeChooserManager().getTypeChooser(description.getType()).distinguishTag(tag, type);
    handler.addRequiredChildren();
    return handler.getProxy();
}
Also used : XmlTag(com.intellij.psi.xml.XmlTag) DomEvent(com.intellij.util.xml.events.DomEvent)

Example 35 with DomEvent

use of com.intellij.util.xml.events.DomEvent in project intellij-community by JetBrains.

the class DomSimpleValuesTest method testSetValue.

public void testSetValue() throws Throwable {
    final MyElement element = createElement("<a/>");
    assertEquals("", element.getValue());
    element.setValue(239);
    assertEquals("239", element.getValue());
    assertEquals("239", element.getXmlTag().getValue().getText());
    myCallRegistry.putExpected(new DomEvent(element, false));
    myCallRegistry.assertResultsAndClear();
}
Also used : DomEvent(com.intellij.util.xml.events.DomEvent)

Aggregations

DomEvent (com.intellij.util.xml.events.DomEvent)48 XmlTag (com.intellij.psi.xml.XmlTag)24 Result (com.intellij.openapi.application.Result)7 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)7 XmlFile (com.intellij.psi.xml.XmlFile)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 DomElement (com.intellij.util.xml.DomElement)3 Document (com.intellij.openapi.editor.Document)2 XmlAttribute (com.intellij.psi.xml.XmlAttribute)2 IncorrectOperationException (com.intellij.util.IncorrectOperationException)2 DomSupportEnabled (com.intellij.ide.highlighter.DomSupportEnabled)1 VirtualFileWithId (com.intellij.openapi.vfs.VirtualFileWithId)1 ObjectStubTree (com.intellij.psi.stubs.ObjectStubTree)1 FileStub (com.intellij.util.xml.stubs.FileStub)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1