protected void childrenChanged(PsiElement parent, final boolean stopProcessingForThisModificationCount) {
    if (parent instanceof PsiDirectory && isFlattenPackages()){
      addSubtreeToUpdateByRoot();
      return;
    }

    long newModificationCount = myModificationTracker.getModificationCount();
    if (newModificationCount == myModificationCount) return;
    if (stopProcessingForThisModificationCount) {
      myModificationCount = newModificationCount;
    }

    while (true) {
      if (parent == null) break;
      if (parent instanceof PsiFile) {
        VirtualFile virtualFile = ((PsiFile)parent).getVirtualFile();
        if (virtualFile != null && !FileTypeRegistry.getInstance().isFileOfType(virtualFile, FileTypes.PLAIN_TEXT)) {
          // adding a class within a file causes a new node to appear in project view => entire dir should be updated
          parent = ((PsiFile)parent).getContainingDirectory();
          if (parent == null) break;
        }
      }
      else if (parent instanceof PsiDirectory &&
               ScratchUtil.isScratch(((PsiDirectory)parent).getVirtualFile())) {
        addSubtreeToUpdateByRoot();
        break;
      }

      if (addSubtreeToUpdateByElementFile(parent)) {
        break;
      }

      if (parent instanceof PsiFile || parent instanceof PsiDirectory) break;
      parent = parent.getParent();
    }
  }
protected void childrenChanged(PsiElement parent, final boolean stopProcessingForThisModificationCount)