@Override
  public void setEncoding(final @Nullable VirtualFile virtualFileOrDir, final @Nullable Charset charset) {
    Charset oldCharset;

    if (virtualFileOrDir == null) {
      oldCharset = myProjectCharset;
      myProjectCharset = charset;
    }
    else {
      VirtualFilePointer pointer = VirtualFilePointerManager.getInstance().create(virtualFileOrDir, this, null);
      if (charset == null) {
        oldCharset = myMapping.remove(pointer);
      }
      else {
        oldCharset = myMapping.put(pointer, charset);
      }
    }

    if (!Comparing.equal(oldCharset, charset) || virtualFileOrDir != null && !Comparing.equal(virtualFileOrDir.getCharset(), charset)) {
      myModificationTracker.incModificationCount();
      if (virtualFileOrDir != null) {
        virtualFileOrDir.setCharset(virtualFileOrDir.getBOM() == null ? charset : null);
      }
      reloadAllFilesUnder(virtualFileOrDir);
    }
  }
@Override
  public void setEncoding(final @Nullable VirtualFile virtualFileOrDir, final @Nullable Charset charset)