boolean (Document document, Editor editor, @Nullable VirtualFile virtualFile, byte[] bytes, @NotNull Charset charset) { if (virtualFile == null) { return false; } String text = document.getText(); EncodingUtil.Magic8 isSafeToConvert = EncodingUtil.isSafeToConvertTo(virtualFile, text, bytes, charset); EncodingUtil.Magic8 isSafeToReload = EncodingUtil.isSafeToReloadIn(virtualFile, text, bytes, charset); Project project = editor == null ? null : editor.getProject(); if (project == null) { project = ProjectLocator.getInstance().guessProjectForFile(virtualFile); } return changeTo(Objects.requireNonNull(project), document, editor, virtualFile, charset, isSafeToConvert, isSafeToReload); }