@Override
      public void update(@NotNull AnActionEvent e) {
        super.update(e);
        Project project = getEventProject(e);
        Editor editor = e.getData(CommonDataKeys.EDITOR);
        boolean disabled = project != null &&
                         (LookupManager.getInstance(project).getActiveLookup() != null ||
                          (editor != null && TemplateManager.getInstance(project).getActiveTemplate(editor) != null));
        final Component owner = IdeFocusManager.findInstance().getFocusOwner();
        if (owner != null) {
          final JComboBox comboBox = ComponentUtil.getParentOfType((Class<? extends JComboBox>)JComboBox.class, owner);
          if (comboBox != null && comboBox.isPopupVisible()) {
            disabled = true;
          }
        }
        e.getPresentation().setEnabled(!disabled && (editor == null || StringUtil.isEmpty(editor.getSelectionModel().getSelectedText())) );
      }
@Override
      public void update(@NotNull AnActionEvent e)