@@ -0,0 +1,3078 @@
+/*%0A * Copyright 2000-2013 JetBrains s.r.o.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.intellij.psi.impl;%0A%0Aimport com.intellij.psi.PsiElement;%0Aimport com.intellij.psi.PsiFile;%0Aimport org.jetbrains.annotations.NotNull;%0A%0A/**%0A * @author Roman.Chernyatchik%0A */%0Apublic abstract class AbstractModificationTracker implements PsiTreeChangePreprocessor %7B%0A  private final PsiManagerImpl myPsiManager;%0A  private PsiModificationTrackerImpl myModificationTracker;%0A%0A  protected abstract boolean isInsideCodeBlock(PsiElement element);%0A%0A  public AbstractModificationTracker(PsiManagerImpl psiManager) %7B%0A    myPsiManager = psiManager;%0A  %7D%0A%0A  public PsiManagerImpl getPsiManager() %7B%0A    return myPsiManager;%0A  %7D%0A%0A  protected void initTracker() %7B%0A    myModificationTracker = (PsiModificationTrackerImpl) myPsiManager.getModificationTracker();%0A    myPsiManager.addTreeChangePreprocessor(this);%0A  %7D%0A%0A  @Override%0A  public void treeChanged(@NotNull final PsiTreeChangeEventImpl event) %7B%0A    boolean changedInsideCodeBlock = false;%0A%0A    switch (event.getCode()) %7B%0A      case BEFORE_CHILDREN_CHANGE:%0A        if (event.getParent() instanceof PsiFile) %7B%0A          changedInsideCodeBlock = true;%0A          break; // May be caused by fake PSI event from PomTransaction. A real event will anyway follow.%0A        %7D%0A%0A      case CHILDREN_CHANGED :%0A        if (event.isGenericChildrenChange()) return;%0A        changedInsideCodeBlock = isInsideCodeBlock(event.getParent());%0A      break;%0A%0A      case BEFORE_CHILD_ADDITION:%0A      case BEFORE_CHILD_REMOVAL:%0A      case CHILD_ADDED :%0A      case CHILD_REMOVED :%0A      case BEFORE_CHILD_REPLACEMENT:%0A      case CHILD_REPLACED :%0A        changedInsideCodeBlock = isInsideCodeBlock(event.getParent()) &&%0A                                 isInsideCodeBlock(event.getChild()) &&%0A                                 isInsideCodeBlock(event.getOldChild()) &&%0A                                 isInsideCodeBlock(event.getNewChild());%0A      break;%0A%0A      case BEFORE_CHILD_MOVEMENT:%0A      case CHILD_MOVED :%0A        changedInsideCodeBlock = isInsideCodeBlock(event.getOldParent()) && isInsideCodeBlock(event.getNewParent()) && isInsideCodeBlock(event.getChild());%0A      break;%0A%0A      case BEFORE_PROPERTY_CHANGE:%0A      case PROPERTY_CHANGED :%0A        changedInsideCodeBlock = false;%0A      break;%0A   %7D%0A%0A    if (!changedInsideCodeBlock) %7B%0A      processOutOfCodeBlockModification(event);%0A    %7D%0A  %7D%0A%0A  protected void processOutOfCodeBlockModification(final PsiTreeChangeEventImpl event) %7B%0A    myModificationTracker.incOutOfCodeBlockModificationCounter();%0A  %7D%0A%7D%0A

revert removal