boolean (@NotNull VirtualFile virtualFile) { if (allowDirectories && virtualFile.isDirectory()) return true; FileDocumentManager documentManager = FileDocumentManager.getInstance(); Document document = documentManager.getDocument(virtualFile); if (document == null) return false; return EncodingUtil.checkCanConvert(virtualFile) == null || EncodingUtil.checkCanReload(virtualFile, null) == null; }