void (ActionEvent e) { if (safeToReload == EncodingUtil.Magic8.NO_WAY) { Ref<Charset> current = Ref.create(); EncodingUtil.FailReason failReason = EncodingUtil.checkCanReload(virtualFile, current); int res; byte[] bom = virtualFile.getBOM(); String explanation = "<br><br>" + (failReason == null ? "" : "Why: " + EncodingUtil.reasonToString(failReason, virtualFile) + "<br>") + (current.isNull() ? "" : "Current encoding: '" + current.get().displayName() + "'"); if (bom != null) { Messages.showErrorDialog(XmlStringUtil.wrapInHtml( IdeBundle.message("dialog.title.file.0.can.t.be.reloaded", virtualFile.getName(), charset.displayName(), explanation)), IdeBundle.message("incompatible.encoding.dialog.title", charset.displayName())); res = -1; } else { res = Messages.showDialog(XmlStringUtil.wrapInHtml( IdeBundle.message("dialog.title.file.0.most.likely.isn.t.stored", virtualFile.getName(), charset.displayName(), explanation)), IdeBundle.message("incompatible.encoding.dialog.title", charset.displayName()), new String[]{IdeBundle.message("button.reload.anyway"), CommonBundle.getCancelButtonText()}, 1, AllIcons.General.WarningDialog); } if (res != 0) { doCancelAction(); return; } } close(RELOAD_EXIT_CODE); }