public void setPointerMapping(@NotNull Map<? extends VirtualFilePointer, ? 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 VirtualFilePointer, ? extends Charset> entry : mapping.entrySet()) {
        VirtualFilePointer filePointer = entry.getKey();
        Charset charset = entry.getValue();
        if (charset == null) throw new IllegalArgumentException("Null charset for " + filePointer + "; mapping: " + mapping);
        if (filePointer == null) {
          myProjectCharset = charset;
        }
        else {
          final VirtualFile virtualFile = filePointer.getFile();
          if (virtualFile != null) {
            if (!fileIndex.isInContent(virtualFile)
                || !fileEncodingChanged(virtualFile, myMapping.get(filePointer), charset)) continue;
          }
          newMap.put(filePointer, charset);
        }
      }
    });

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