PerFileMappingsEx<Charset> (@NotNull Project project) { EncodingProjectManagerImpl prjManager = (EncodingProjectManagerImpl)EncodingProjectManager.getInstance(project); return new PerFileMappingsEx<>() { @NotNull @Override public Map<VirtualFile, Charset> getMappings() { return new HashMap<>(prjManager.getAllMappings()); } @Override public void setMappings(@NotNull Map<VirtualFile, Charset> mappings) { prjManager.setMapping(mappings); } @Override public void setMapping(@Nullable VirtualFile file, Charset value) { throw new UnsupportedOperationException(); } @Override public Charset getMapping(@Nullable VirtualFile file) { throw new UnsupportedOperationException(); } @Nullable @Override public Charset getDefaultMapping(@Nullable VirtualFile file) { return prjManager.getEncoding(file, true); } }; }