void (@NotNull AnActionEvent e) { VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE); boolean enabled = file != null && file.getBOM() == null && CharsetToolkit.getPossibleBom(file.getCharset()) != null; // support adding BOM to a single file only for the time being e.getPresentation().setEnabled(enabled); e.getPresentation().setVisible(enabled || ActionPlaces.isMainMenuOrActionSearch(e.getPlace())); e.getPresentation().setDescription(IdeBundle.messagePointer("add.byte.order.mark.to", enabled ? file.getName() : null)); }