<commit_before>package org.jetbrains.plugins.scala.cache.listeners;

import com.intellij.openapi.vfs.*;
import com.intellij.openapi.module.Module;
import org.jetbrains.plugins.scala.cache.module.ScalaModuleCachesManager;
import org.jetbrains.plugins.scala.cache.module.ScalaModuleCaches;
import org.jetbrains.plugins.scala.util.ScalaUtils;

/**
 * Implements all activity, related to virual file system changes
 *
 * @author Ilya.Sergey
 */
public class ScalaVirtualFileListener extends VirtualFileAdapter {

  private ScalaModuleCachesManager myManager;

  public ScalaVirtualFileListener(ScalaModuleCachesManager manager) {
    myManager = manager;
  }

  public void beforeFileDeletion(VirtualFileEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.DELETED);
  }

  public void beforeFileMovement(VirtualFileMoveEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.DELETED);
  }

  public void propertyChanged(VirtualFilePropertyEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.CHANGED);
  }

  public void contentsChanged(VirtualFileEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.CHANGED);
  }

  public void fileCreated(VirtualFileEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.CHANGED);
  }

  public void fileMoved(VirtualFileMoveEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.CHANGED);
  }

  private void processFile(VirtualFile file, VirtualFile parent, FILE_CHANGE_TYPES type) {
    if (parent == null || file == null) {
      return;
    }
    if (ScalaUtils.isVersionControlSysDir(file)) {
      return;
    }
    if (!file.isDirectory()) {
      processFile(file, type);
      return;
    }

    VirtualFile[] files = file.getChildren();
    for (VirtualFile virtualFile : files) {
      processFile(virtualFile, file, type);
    }
  }

  private void processFile(VirtualFile file, FILE_CHANGE_TYPES type) {
    switch (type) {
      case CHANGED: {
        myManager.getModuleFilesCache().processFileChanged(file);
        break;
      }
      case DELETED: {
        myManager.getModuleFilesCache().processFileDeleted(file.getUrl());
        break;
      }
    }
  }

}

/**
 * Shows current state of processed file
 */
enum FILE_CHANGE_TYPES {
  DELETED,
  CHANGED
}


<commit_msg>Added resolve only for types<commit_after>package org.jetbrains.plugins.scala.cache.listeners;

import com.intellij.openapi.vfs.*;
import com.intellij.openapi.module.Module;
import org.jetbrains.plugins.scala.cache.module.ScalaModuleCachesManager;
import org.jetbrains.plugins.scala.cache.module.ScalaModuleCaches;
import org.jetbrains.plugins.scala.util.ScalaUtils;

/**
 * Implements all activity, related to virual file system changes
 *
 * @author Ilya.Sergey
 */
public class ScalaVirtualFileListener extends VirtualFileAdapter {

  private ScalaModuleCachesManager myManager;

  public ScalaVirtualFileListener(ScalaModuleCachesManager manager) {
    myManager = manager;
  }

  public void beforeFileDeletion(VirtualFileEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.DELETED);
  }

  public void beforeFileMovement(VirtualFileMoveEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.DELETED);
  }

  public void propertyChanged(VirtualFilePropertyEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.CHANGED);
  }

  public void contentsChanged(VirtualFileEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.CHANGED);
  }

  public void fileCreated(VirtualFileEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.CHANGED);
  }

  public void fileMoved(VirtualFileMoveEvent event) {
    processFile(event.getFile(), event.getParent(), FILE_CHANGE_TYPES.CHANGED);
  }

  private void processFile(VirtualFile file, VirtualFile parent, FILE_CHANGE_TYPES type) {
    if (parent == null || file == null) {
      return;
    }
    if (!file.isDirectory()) {
      processFile(file, type);
      return;
    }
    if (ScalaUtils.isVersionControlSysDir(file)) {
      return;
    }
    VirtualFile[] files = file.getChildren();
    for (VirtualFile virtualFile : files) {
      processFile(virtualFile, file, type);
    }
  }

  private void processFile(VirtualFile file, FILE_CHANGE_TYPES type) {
    switch (type) {
      case CHANGED: {
        myManager.getModuleFilesCache().processFileChanged(file);
        break;
      }
      case DELETED: {
        myManager.getModuleFilesCache().processFileDeleted(file.getUrl());
        break;
      }
    }
  }


}

/**
 * Shows current state of processed file
 */
enum FILE_CHANGE_TYPES {
  DELETED,
  CHANGED
}



{'fraction_non_alphanumeric': 0.10493699648832885, 'fraction_numerical': 0.0, 'mean_word_length': 4.123809523809523, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1568399', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1507, 'n_words': 276}