当前位置: 首页>>代码示例>>Java>>正文


Java TreeChangeEventImpl类代码示例

本文整理汇总了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;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ChangeUtil.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:CompositeElement.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:CompositeElement.java

示例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;
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:ChangeUtil.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:DiffLog.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DiffLog.java

示例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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:ChangeUtil.java

示例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();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:DiffLog.java

示例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);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:CompositeElement.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:DiffLog.java

示例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();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:PsiEventWrapperAspect.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ASTDiffBuilder.java

示例13: getEvent

import com.intellij.pom.tree.events.impl.TreeChangeEventImpl; //导入依赖的package包/类
@NotNull
public TreeChangeEventImpl getEvent() {
  return myEvent;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ASTDiffBuilder.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:CompositeElement.java

示例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);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:CompositeElement.java


注:本文中的com.intellij.pom.tree.events.impl.TreeChangeEventImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。