void (@NotNull AnActionEvent e) { Data data = getDataFromContext(e); boolean isEnabled = data != null && data.tracker.isValid() && data.tracker.isAvailableAt(data.editor) && getTargetRange(data.tracker, data.editor) != null; e.getPresentation().setEnabled(isEnabled); e.getPresentation().setVisible(data != null || e.isFromActionToolbar()); }