@Override
 public void dropResolveCaches() {
   FileManager fileManager = myFileManager;
   if (fileManager instanceof FileManagerImpl) { // mock tests
     ((FileManagerImpl) fileManager).processQueue();
   }
   beforeChange(true);
   beforeChange(false);
 }
 public void beforeChildrenChange(@NotNull PsiTreeChangeEventImpl event) {
   beforeChange(true);
   event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILDREN_CHANGE);
   if (LOG.isDebugEnabled()) {
     LOG.debug("beforeChildrenChange: parent = " + event.getParent());
   }
   fireEvent(event);
 }
 @Override
 public void beforeChildAddition(@NotNull PsiTreeChangeEventImpl event) {
   beforeChange(true);
   event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILD_ADDITION);
   if (LOG.isDebugEnabled()) {
     LOG.debug("beforeChildAddition: parent = " + event.getParent());
   }
   fireEvent(event);
 }
 @Override
 public void beforeChildRemoval(@NotNull PsiTreeChangeEventImpl event) {
   beforeChange(true);
   event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILD_REMOVAL);
   if (LOG.isDebugEnabled()) {
     LOG.debug(
         "beforeChildRemoval: child = " + event.getChild() + ", parent = " + event.getParent());
   }
   fireEvent(event);
 }
 @Override
 public void beforeChildReplacement(@NotNull PsiTreeChangeEventImpl event) {
   beforeChange(true);
   event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILD_REPLACEMENT);
   if (LOG.isDebugEnabled()) {
     LOG.debug(
         "beforeChildReplacement: oldChild = "
             + event.getOldChild()
             + ", parent = "
             + event.getParent());
   }
   fireEvent(event);
 }
 public void beforePropertyChange(@NotNull PsiTreeChangeEventImpl event) {
   beforeChange(true);
   event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_PROPERTY_CHANGE);
   if (LOG.isDebugEnabled()) {
     LOG.debug(
         "beforePropertyChange: element = "
             + event.getElement()
             + ", propertyName = "
             + event.getPropertyName()
             + ", oldValue = "
             + event.getOldValue());
   }
   fireEvent(event);
 }
 public void beforeChildMovement(@NotNull PsiTreeChangeEventImpl event) {
   beforeChange(true);
   event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILD_MOVEMENT);
   if (LOG.isDebugEnabled()) {
     LOG.debug(
         "beforeChildMovement: child = "
             + event.getChild()
             + ", oldParent = "
             + event.getOldParent()
             + ", newParent = "
             + event.getNewParent());
   }
   fireEvent(event);
 }
 public static void sendBeforeChildrenChangeEvent(
     @NotNull PsiManagerImpl manager, @NotNull PsiElement scope, boolean isGenericChange) {
   if (!scope.isPhysical()) {
     manager.beforeChange(false);
     return;
   }
   PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(manager);
   event.setParent(scope);
   event.setFile(scope.getContainingFile());
   TextRange range = scope.getTextRange();
   event.setOffset(range == null ? 0 : range.getStartOffset());
   event.setOldLength(scope.getTextLength());
   // the "generic" event is being sent on every PSI change. It does not carry any specific info
   // except the fact that "something has changed"
   event.setGenericChange(isGenericChange);
   manager.beforeChildrenChange(event);
 }