@Override
  public void propertyChanged(@Nullable Document document, @NotNull String propertyName, Object oldValue, Object newValue) {
    if (EncodingManager.PROP_NATIVE2ASCII_SWITCH.equals(propertyName) ||
        EncodingManager.PROP_PROPERTIES_FILES_ENCODING.equals(propertyName)
    ) {
      DumbService.getInstance(myProject).smartInvokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> {
        Collection<VirtualFile> filesToRefresh = FileTypeIndex.getFiles(PropertiesFileType.INSTANCE, GlobalSearchScope.allScope(myProject));
        VirtualFile[] virtualFiles = VfsUtilCore.toVirtualFileArray(filesToRefresh);
        FileDocumentManager.getInstance().saveAllDocuments();

        //force to re-detect encoding
        for (VirtualFile virtualFile : virtualFiles) {
          virtualFile.setCharset(null);
        }
        FileDocumentManager.getInstance().reloadFiles(virtualFiles);
      }));
    }
  }
@Override
  public void propertyChanged(@Nullable Document document, @NotNull String propertyName, Object oldValue, Object newValue)