private void updateMapping(Map<VirtualFilePointer, Charset> newMap) {
    Map<VirtualFilePointer, Charset> oldMap = new HashMap<>(myMapping);
    myMapping.clear();
    myMapping.putAll(newMap);

    final Set<VirtualFilePointer> changed = new HashSet<>(oldMap.keySet());
    for (Map.Entry<VirtualFilePointer, Charset> entry : newMap.entrySet()) {
      VirtualFilePointer file = entry.getKey();
      Charset charset = entry.getValue();
      Charset oldCharset = oldMap.get(file);
      if (Comparing.equal(oldCharset, charset)) {
        changed.remove(file);
      }
    }

    Set<VirtualFilePointer> added = new HashSet<>(newMap.keySet());
    added.removeAll(oldMap.keySet());

    Set<VirtualFilePointer> removed = new HashSet<>(oldMap.keySet());
    removed.removeAll(newMap.keySet());

    changed.addAll(added);
    changed.addAll(removed);
    changed.remove(null);

    if (!changed.isEmpty()) {
      Processor<VirtualFile> reloadProcessor = createChangeCharsetProcessor(myProject);
      tryStartReloadWithProgress(() -> {
        Set<VirtualFile> processed = new HashSet<>();
        next:
        for (VirtualFilePointer changedFilePointer : changed) {
          VirtualFile changedFile = changedFilePointer.getFile();
          if (changedFile == null) continue;
          for (VirtualFile processedFile : processed) {
            if (VfsUtilCore.isAncestor(processedFile, changedFile, false)) continue next;
          }
          processSubFiles(changedFile, reloadProcessor);
          processed.add(changedFile);
        }
      });
    }

    myModificationTracker.incModificationCount();
  }
private void updateMapping(Map<VirtualFilePointer, Charset> newMap)