@Override
 public void update(AnActionEvent e) {
   super.update(e);
   final Presentation presentation = e.getPresentation();
   presentation.setEnabled(allTargetsAreValid());
 }
    // Make sure that the text rendered by this method is 'searchable' via
    // com.intellij.openapi.keymap.impl.ui.ActionsTree.filter method.
    public void customizeCellRenderer(
        JTree tree,
        Object value,
        boolean selected,
        boolean expanded,
        boolean leaf,
        int row,
        boolean hasFocus) {
      final boolean showIcons = UISettings.getInstance().SHOW_ICONS_IN_MENUS;
      Keymap originalKeymap = myKeymap != null ? myKeymap.getParent() : null;
      Icon icon = null;
      String text;
      boolean bound = false;
      setToolTipText(null);

      if (value instanceof DefaultMutableTreeNode) {
        Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
        boolean changed;
        if (userObject instanceof Group) {
          Group group = (Group) userObject;
          text = group.getName();

          changed = originalKeymap != null && isGroupChanged(group, originalKeymap, myKeymap);
          icon = group.getIcon();
          if (icon == null) {
            icon = CLOSE_ICON;
          }
        } else if (userObject instanceof String) {
          String actionId = (String) userObject;
          bound = myShowBoundActions && ((KeymapImpl) myKeymap).isActionBound(actionId);
          AnAction action = ActionManager.getInstance().getAction(actionId);
          if (action != null) {
            text = action.getTemplatePresentation().getText();
            if (text == null || text.length() == 0) { // fill dynamic presentation gaps
              text = actionId;
            }
            Icon actionIcon = action.getTemplatePresentation().getIcon();
            if (actionIcon != null) {
              icon = actionIcon;
            }
            setToolTipText(action.getTemplatePresentation().getDescription());
          } else {
            text = actionId;
          }
          changed = originalKeymap != null && isActionChanged(actionId, originalKeymap, myKeymap);
        } else if (userObject instanceof QuickList) {
          QuickList list = (QuickList) userObject;
          icon = AllIcons.Actions.QuickList;
          text = list.getDisplayName();

          changed =
              originalKeymap != null
                  && isActionChanged(list.getActionId(), originalKeymap, myKeymap);
        } else if (userObject instanceof Separator) {
          // TODO[vova,anton]: beautify
          changed = false;
          text = "-------------";
        } else {
          throw new IllegalArgumentException("unknown userObject: " + userObject);
        }

        if (showIcons) {
          setIcon(ActionsTree.getEvenIcon(icon));
        }

        Color foreground;
        if (selected) {
          foreground = UIUtil.getTreeSelectionForeground();
        } else {
          if (changed) {
            foreground = PlatformColors.BLUE;
          } else {
            foreground = UIUtil.getTreeForeground();
          }

          if (bound) {
            foreground = JBColor.MAGENTA;
          }
        }
        SearchUtil.appendFragments(
            myFilter,
            text,
            Font.PLAIN,
            foreground,
            selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground(),
            this);
      }
    }
 private AnAction createRecentFindUsagesAction() {
   AnAction action = ActionManager.getInstance().getAction(SHOW_RECENT_FIND_USAGES_ACTION_ID);
   action.registerCustomShortcutSet(action.getShortcutSet(), getComponent());
   return action;
 }