public void setMapping(@NotNull Map<? extends VirtualFile, ? extends Charset> mapping) {
    ApplicationManager.getApplication().assertWriteIntentLockAcquired();
    FileDocumentManager.getInstance().saveAllDocuments();  // consider all files as unmodified
    final Map<VirtualFilePointer, Charset> newMap = new HashMap<>(mapping.size());

    // ChangeFileEncodingAction should not start progress "reload files..."
    suppressReloadDuring(() -> {
      ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
      for (Map.Entry<? extends VirtualFile, ? extends Charset> entry : mapping.entrySet()) {
        VirtualFile virtualFile = entry.getKey();
        Charset charset = entry.getValue();
        if (charset == null) throw new IllegalArgumentException("Null charset for " + virtualFile + "; mapping: " + mapping);
        if (virtualFile == null) {
          myProjectCharset = charset;
        }
        else {
          if (!fileIndex.isInContent(virtualFile)) continue;
          VirtualFilePointer pointer = VirtualFilePointerManager.getInstance().create(virtualFile, this, null);

          if (!fileEncodingChanged(virtualFile, myMapping.get(pointer), charset)) continue;
          newMap.put(pointer, charset);
        }
      }
    });

    updateMapping(newMap);
  }
public void setMapping(@NotNull Map<? extends VirtualFile, ? extends Charset> mapping)