void (@NotNull AnActionEvent e) { Editor editor = e.getData(CommonDataKeys.EDITOR); PreviewTextModel textModel = editor == null ? null : editor.getUserData(TEXT_MODEL_KEY); e.getPresentation().setEnabledAndVisible(textModel != null && editor.getSelectionModel().hasSelection()); }