本文整理汇总了Java中com.intellij.pom.tree.events.impl.TreeChangeEventImpl类的典型用法代码示例。如果您正苦于以下问题:Java TreeChangeEventImpl类的具体用法?Java TreeChangeEventImpl怎么用?Java TreeChangeEventImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TreeChangeEventImpl类属于com.intellij.pom.tree.events.impl包,在下文中一共展示了TreeChangeEventImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareAndRunChangeAction
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
public static void prepareAndRunChangeAction(final ChangeAction action, final TreeElement changedElement){
final FileElement changedFile = TreeUtil.getFileElement(changedElement);
final PsiManager manager = changedFile.getManager();
final PomModel model = PomManager.getModel(manager.getProject());
final TreeAspect treeAspect = model.getModelAspect(TreeAspect.class);
model.runTransaction(new PomTransactionBase(changedElement.getPsi(), treeAspect) {
@Override
public PomModelEvent runInner() {
final PomModelEvent event = new PomModelEvent(model);
final TreeChangeEvent destinationTreeChange = new TreeChangeEventImpl(treeAspect, changedFile);
event.registerChangeSet(treeAspect, destinationTreeChange);
action.makeChange(destinationTreeChange);
TreeUtil.clearCaches(changedElement);
if (changedElement instanceof CompositeElement) {
((CompositeElement) changedElement).subtreeChanged();
}
return event;
}
});
}
示例2: addChild
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
@Override
public void addChild(@Nonnull ASTNode child, @Nullable final ASTNode anchorBefore) {
LOG.assertTrue(anchorBefore == null || ((TreeElement)anchorBefore).getTreeParent() == this, "anchorBefore == null || anchorBefore.getTreeParent() == parent");
TreeUtil.ensureParsed(getFirstChildNode());
TreeUtil.ensureParsed(child);
final TreeElement last = ((TreeElement)child).getTreeNext();
final TreeElement first = (TreeElement)child;
removeChildrenInner(first, last);
ChangeUtil.prepareAndRunChangeAction(new ChangeUtil.ChangeAction(){
@Override
public void makeChange(TreeChangeEvent destinationTreeChange) {
if (anchorBefore != null) {
insertBefore((TreeChangeEventImpl)destinationTreeChange, (TreeElement)anchorBefore, first);
}
else {
add((TreeChangeEventImpl)destinationTreeChange, CompositeElement.this, first);
}
}
}, this);
}
示例3: replaceChild
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
@Override
public void replaceChild(@Nonnull ASTNode oldChild, @Nonnull ASTNode newChild) {
LOG.assertTrue(((TreeElement)oldChild).getTreeParent() == this);
final TreeElement oldChild1 = (TreeElement)oldChild;
final TreeElement newChildNext = ((TreeElement)newChild).getTreeNext();
final TreeElement newChild1 = (TreeElement)newChild;
if(oldChild1 == newChild1) return;
removeChildrenInner(newChild1, newChildNext);
ChangeUtil.prepareAndRunChangeAction(new ChangeUtil.ChangeAction(){
@Override
public void makeChange(TreeChangeEvent destinationTreeChange) {
replace((TreeChangeEventImpl)destinationTreeChange, oldChild1, newChild1);
repairRemovedElement(CompositeElement.this, oldChild1);
}
}, this);
}
示例4: prepareAndRunChangeAction
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
public static void prepareAndRunChangeAction(final ChangeAction action, final TreeElement changedElement){
final FileElement changedFile = TreeUtil.getFileElement(changedElement);
final PsiManager manager = changedFile.getManager();
final PomModel model = PomManager.getModel(manager.getProject());
final TreeAspect treeAspect = model.getModelAspect(TreeAspect.class);
model.runTransaction(new PomTransactionBase(changedElement.getPsi(), treeAspect) {
@Override
public PomModelEvent runInner() {
final PomModelEvent event = new PomModelEvent(model);
final TreeChangeEvent destinationTreeChange = new TreeChangeEventImpl(treeAspect, changedFile);
event.registerChangeSet(treeAspect, destinationTreeChange);
action.makeChange(destinationTreeChange);
changedElement.clearCaches();
if (changedElement instanceof CompositeElement) {
((CompositeElement) changedElement).subtreeChanged();
}
return event;
}
});
}
示例5: doActualPsiChange
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
@Override
void doActualPsiChange(@Nonnull PsiFile file, @Nonnull TreeChangeEventImpl changeEvent) {
PsiElement psiParent = myOldParent.getPsi();
PsiElement psiChild = file.isPhysical() ? myOldNode.getPsi() : null;
if (psiParent != null && psiChild != null) {
PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(file.getManager());
event.setParent(psiParent);
event.setChild(psiChild);
event.setFile(file);
((PsiManagerEx)file.getManager()).beforeChildRemoval(event);
}
changeEvent.addElementaryChange(myOldParent);
myOldNode.rawRemove();
myOldParent.subtreeChanged();
DebugUtil.checkTreeStructure(myOldParent);
}
示例6: performActualPsiChange
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
@NotNull
public TreeChangeEventImpl performActualPsiChange(@NotNull PsiFile file) {
final ASTDiffBuilder astDiffBuilder = new ASTDiffBuilder((PsiFileImpl) file);
for (LogEntry entry : myEntries) {
entry.doActualPsiChange(file, astDiffBuilder);
}
file.subtreeChanged();
return astDiffBuilder.getEvent();
}
示例7: prepareAndRunChangeAction
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
public static void prepareAndRunChangeAction(final ChangeAction action, final TreeElement changedElement){
final FileElement changedFile = TreeUtil.getFileElement(changedElement);
final PsiManager manager = changedFile.getManager();
final PomModel model = PomManager.getModel(manager.getProject());
try{
final TreeAspect treeAspect = model.getModelAspect(TreeAspect.class);
model.runTransaction(new PomTransactionBase(changedElement.getPsi(), treeAspect) {
@Override
public PomModelEvent runInner() {
final PomModelEvent event = new PomModelEvent(model);
final TreeChangeEvent destinationTreeChange = new TreeChangeEventImpl(treeAspect, changedFile);
event.registerChangeSet(treeAspect, destinationTreeChange);
final PsiManagerEx psiManager = (PsiManagerEx) manager;
final PsiFile file = (PsiFile)changedFile.getPsi();
//if (file.isPhysical()) {
// SmartPointerManagerImpl.fastenBelts(file, changedElement.getStartOffset());
//}
action.makeChange(destinationTreeChange);
TreeUtil.clearCaches(changedElement);
if (changedElement instanceof CompositeElement) {
((CompositeElement) changedElement).subtreeChanged();
}
return event;
}
});
}
catch(IncorrectOperationException ioe){
LOG.error(ioe);
}
}
示例8: performActualPsiChange
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
public TreeChangeEventImpl performActualPsiChange(PsiFile file) {
final ASTDiffBuilder astDiffBuilder = new ASTDiffBuilder((PsiFileImpl) file);
for (LogEntry entry : myEntries) {
entry.doActualPsiChange(file, astDiffBuilder);
}
file.subtreeChanged();
return astDiffBuilder.getEvent();
}
示例9: removeChildrenInner
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
private static void removeChildrenInner(final TreeElement first, final TreeElement last) {
final FileElement fileElement = TreeUtil.getFileElement(first);
if (fileElement != null) {
ChangeUtil.prepareAndRunChangeAction(new ChangeUtil.ChangeAction() {
@Override
public void makeChange(TreeChangeEvent destinationTreeChange) {
remove((TreeChangeEventImpl)destinationTreeChange, first, last);
repairRemovedElement(fileElement, first);
}
}, first.getTreeParent());
}
else {
first.rawRemoveUpTo(last);
}
}
示例10: performActualPsiChange
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
@Nonnull
public TreeChangeEventImpl performActualPsiChange(@Nonnull PsiFile file) {
TreeAspect modelAspect = PomManager.getModel(file.getProject()).getModelAspect(TreeAspect.class);
TreeChangeEventImpl event = new TreeChangeEventImpl(modelAspect, ((PsiFileImpl)file).calcTreeElement());
for (LogEntry entry : myEntries) {
entry.doActualPsiChange(file, event);
}
((PsiElementWithSubtreeChangeNotifier)file).subtreeChanged();
return event;
}
示例11: sendAfterEvents
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
private static void sendAfterEvents(TreeChangeEvent changeSet) {
ASTNode rootElement = changeSet.getRootElement();
PsiFile file = (PsiFile)rootElement.getPsi();
if (!file.isPhysical()) {
promoteNonPhysicalChangesToDocument(rootElement, file);
((PsiManagerImpl)file.getManager()).afterChange(false);
return;
}
((TreeChangeEventImpl)changeSet).fireEvents();
}
示例12: ASTDiffBuilder
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
public ASTDiffBuilder(@NotNull PsiFileImpl fileImpl) {
TreeAspect modelAspect = PomManager.getModel(fileImpl.getProject()).getModelAspect(TreeAspect.class);
myEvent = new TreeChangeEventImpl(modelAspect, fileImpl.getTreeElement());
}
示例13: getEvent
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
@NotNull
public TreeChangeEventImpl getEvent() {
return myEvent;
}
示例14: add
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
private static void add(TreeChangeEventImpl destinationTreeChange, CompositeElement parent, TreeElement first) {
destinationTreeChange.addElementaryChange(parent);
parent.rawAddChildren(first);
}
示例15: remove
import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
private static void remove(TreeChangeEventImpl destinationTreeChange, TreeElement first, TreeElement last) {
if (first != null) {
destinationTreeChange.addElementaryChange(first.getTreeParent());
first.rawRemoveUpTo(last);
}
}