@Override
  public void before(@NotNull List<? extends VFileEvent> events) {
    if (myForbid) return;
    final FileAndDirsCollector dirtyFilesAndDirs = new FileAndDirsCollector();
    // collect files and directories - sources of events
    for (VFileEvent event : events) {
      final VirtualFile file = getFileForEvent(event);
      if (file == null) {
        continue;
      }

      if (event instanceof VFileDeleteEvent) {
        if (!file.isInLocalFileSystem()) {
          continue;
        }
        dirtyFilesAndDirs.add(file, true);
      } else if (event instanceof VFileMoveEvent || event instanceof VFilePropertyChangeEvent) {
        dirtyFilesAndDirs.add(file, true);
      }
    }
    // and notify VCSDirtyScopeManager
    markDirtyOnPooled(dirtyFilesAndDirs);
  }
  @Override
  public void after(@NotNull List<? extends VFileEvent> events) {
    if (myForbid) return;
    final FileAndDirsCollector dirtyFilesAndDirs = new FileAndDirsCollector();
    // collect files and directories - sources of events
    for (VFileEvent event : events) {
      if (event instanceof VFileDeleteEvent) continue;

      final VirtualFile file = getFileForEvent(event);
      if (file == null) {
        continue;
      }

      if (event instanceof VFileContentChangeEvent
          || event instanceof VFileCopyEvent
          || event instanceof VFileCreateEvent
          || event instanceof VFileMoveEvent) {
        dirtyFilesAndDirs.add(file, false);
      } else if (event instanceof VFilePropertyChangeEvent) {
        final VFilePropertyChangeEvent pce = (VFilePropertyChangeEvent) event;

        if (pce.getPropertyName().equals(VirtualFile.PROP_NAME)) {
          // if a file was renamed, then the file is dirty and its parent directory is dirty too;
          // if a directory was renamed, all its children are recursively dirty, the parent dir is
          // also dirty but not recursively.
          dirtyFilesAndDirs.add(file, false); // the file is dirty recursively
          dirtyFilesAndDirs.addToFiles(
              file.getParent(),
              false); // directory is dirty alone. if parent is null - is checked in the method
        } else {
          dirtyFilesAndDirs.addToFiles(file, false);
        }
      }
    }
    // and notify VCSDirtyScopeManager
    markDirtyOnPooled(dirtyFilesAndDirs);
  }