use of com.intellij.pom.xml.impl.XmlAspectChangeSetImpl in project intellij-community by JetBrains.
the class XmlAttributeImpl method setName.
@Override
public PsiElement setName(@NotNull final String nameText) throws IncorrectOperationException {
final ASTNode name = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild(this);
final String oldName = name.getText();
final PomModel model = PomManager.getModel(getProject());
final XmlAttribute attribute = XmlElementFactory.getInstance(getProject()).createAttribute(nameText, "", this);
final ASTNode newName = XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild((ASTNode) attribute);
final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
model.runTransaction(new PomTransactionBase(getParent(), aspect) {
@Override
public PomModelEvent runInner() {
final PomModelEvent event = new PomModelEvent(model);
PsiFile file = getContainingFile();
XmlChangeSet xmlAspectChangeSet = new XmlAspectChangeSetImpl(model, file instanceof XmlFile ? (XmlFile) file : null);
xmlAspectChangeSet.add(new XmlAttributeSetImpl(getParent(), oldName, null));
xmlAspectChangeSet.add(new XmlAttributeSetImpl(getParent(), nameText, getValue()));
event.registerChangeSet(model.getModelAspect(XmlAspect.class), xmlAspectChangeSet);
CodeEditUtil.replaceChild(XmlAttributeImpl.this, name, newName);
return event;
}
});
return this;
}
use of com.intellij.pom.xml.impl.XmlAspectChangeSetImpl in project intellij-community by JetBrains.
the class XmlTextImpl method createEvent.
private PomModelEvent createEvent(final XmlChange... events) {
final PomModelEvent event = new PomModelEvent(PomManager.getModel(getProject()));
final XmlAspectChangeSetImpl xmlAspectChangeSet = new XmlAspectChangeSetImpl(PomManager.getModel(getProject()), (XmlFile) getContainingFile());
for (XmlChange xmlChange : events) {
xmlAspectChangeSet.add(xmlChange);
}
event.registerChangeSet(PomManager.getModel(getProject()).getModelAspect(XmlAspect.class), xmlAspectChangeSet);
return event;
}
use of com.intellij.pom.xml.impl.XmlAspectChangeSetImpl in project intellij-community by JetBrains.
the class XmlAttributeSetImpl method createXmlAttributeSet.
public static PomModelEvent createXmlAttributeSet(PomModel model, XmlTag xmlTag, String name, String value) {
final PomModelEvent event = new PomModelEvent(model);
final XmlAspectChangeSetImpl xmlAspectChangeSet = new XmlAspectChangeSetImpl(model, PsiTreeUtil.getParentOfType(xmlTag, XmlFile.class));
xmlAspectChangeSet.add(new XmlAttributeSetImpl(xmlTag, name, value));
event.registerChangeSet(model.getModelAspect(XmlAspect.class), xmlAspectChangeSet);
return event;
}
use of com.intellij.pom.xml.impl.XmlAspectChangeSetImpl in project intellij-community by JetBrains.
the class XmlTagChildChangedImpl method createXmlTagChildChanged.
public static PomModelEvent createXmlTagChildChanged(PomModel source, XmlTag context, XmlTagChild treeElement) {
final PomModelEvent event = new PomModelEvent(source);
final XmlAspectChangeSetImpl xmlAspectChangeSet = new XmlAspectChangeSetImpl(source, PsiTreeUtil.getParentOfType(context, XmlFile.class));
xmlAspectChangeSet.add(new XmlTagChildChangedImpl(context, treeElement));
event.registerChangeSet(source.getModelAspect(XmlAspect.class), xmlAspectChangeSet);
return event;
}
use of com.intellij.pom.xml.impl.XmlAspectChangeSetImpl in project intellij-community by JetBrains.
the class XmlTextChangedImpl method createXmlTextChanged.
public static PomModelEvent createXmlTextChanged(PomModel source, XmlText xmlText, String oldText) {
final PomModelEvent event = new PomModelEvent(source);
final XmlAspectChangeSetImpl xmlAspectChangeSet = new XmlAspectChangeSetImpl(source, PsiTreeUtil.getParentOfType(xmlText, XmlFile.class));
xmlAspectChangeSet.add(new XmlTextChangedImpl(xmlText, oldText));
event.registerChangeSet(source.getModelAspect(XmlAspect.class), xmlAspectChangeSet);
return event;
}
Aggregations