Search in sources :

Example 11 with XmlAspect

use of com.intellij.pom.xml.XmlAspect in project intellij-community by JetBrains.

the class XmlDocumentImpl method addInternal.

@Override
public TreeElement addInternal(final TreeElement first, final ASTNode last, final ASTNode anchor, final Boolean before) {
    final PomModel model = PomManager.getModel(getProject());
    final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
    final TreeElement[] holder = new TreeElement[1];
    try {
        model.runTransaction(new PomTransactionBase(this, aspect) {

            @Override
            public PomModelEvent runInner() {
                holder[0] = XmlDocumentImpl.super.addInternal(first, last, anchor, before);
                return XmlDocumentChangedImpl.createXmlDocumentChanged(model, XmlDocumentImpl.this);
            }
        });
    } catch (IncorrectOperationException ignored) {
    }
    return holder[0];
}
Also used : XmlAspect(com.intellij.pom.xml.XmlAspect) PomModel(com.intellij.pom.PomModel) PomTransactionBase(com.intellij.pom.impl.PomTransactionBase) PomModelEvent(com.intellij.pom.event.PomModelEvent) IncorrectOperationException(com.intellij.util.IncorrectOperationException) TreeElement(com.intellij.psi.impl.source.tree.TreeElement)

Example 12 with XmlAspect

use of com.intellij.pom.xml.XmlAspect in project intellij-community by JetBrains.

the class XmlDocumentImpl method replaceChildInternal.

@Override
public void replaceChildInternal(@NotNull final ASTNode child, @NotNull final TreeElement newElement) {
    final PomModel model = PomManager.getModel(getProject());
    final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
    try {
        model.runTransaction(new PomTransactionBase(this, aspect) {

            @Override
            public PomModelEvent runInner() {
                XmlDocumentImpl.super.replaceChildInternal(child, newElement);
                return XmlDocumentChangedImpl.createXmlDocumentChanged(model, XmlDocumentImpl.this);
            }
        });
    } catch (IncorrectOperationException ignored) {
    }
}
Also used : XmlAspect(com.intellij.pom.xml.XmlAspect) PomModel(com.intellij.pom.PomModel) PomTransactionBase(com.intellij.pom.impl.PomTransactionBase) PomModelEvent(com.intellij.pom.event.PomModelEvent) IncorrectOperationException(com.intellij.util.IncorrectOperationException)

Aggregations

PomModel (com.intellij.pom.PomModel)12 PomTransactionBase (com.intellij.pom.impl.PomTransactionBase)12 XmlAspect (com.intellij.pom.xml.XmlAspect)12 PomModelEvent (com.intellij.pom.event.PomModelEvent)11 ASTNode (com.intellij.lang.ASTNode)8 IncorrectOperationException (com.intellij.util.IncorrectOperationException)7 XmlTagChildAddImpl (com.intellij.pom.xml.impl.events.XmlTagChildAddImpl)2 TreeElement (com.intellij.psi.impl.source.tree.TreeElement)2 IElementType (com.intellij.psi.tree.IElementType)2 TreeChangeEvent (com.intellij.pom.tree.events.TreeChangeEvent)1 XmlChangeSet (com.intellij.pom.xml.XmlChangeSet)1 XmlAspectChangeSetImpl (com.intellij.pom.xml.impl.XmlAspectChangeSetImpl)1 XmlAttributeSetImpl (com.intellij.pom.xml.impl.events.XmlAttributeSetImpl)1 XmlTextChangedImpl (com.intellij.pom.xml.impl.events.XmlTextChangedImpl)1 FileElement (com.intellij.psi.impl.source.tree.FileElement)1 LeafElement (com.intellij.psi.impl.source.tree.LeafElement)1 CharTable (com.intellij.util.CharTable)1 Nullable (org.jetbrains.annotations.Nullable)1