@Override
  public final void update(@NotNull AnActionEvent e) {
    Presentation presentation = e.getPresentation();
    DataContext dataContext = e.getDataContext();

    MethodHierarchyBrowser methodHierarchyBrowser = getMethodHierarchyBrowser(e);
    if (methodHierarchyBrowser == null) {
      presentation.setEnabledAndVisible(false);
      return;
    }
    Project project = CommonDataKeys.PROJECT.getData(dataContext);
    if (project == null) {
      presentation.setEnabledAndVisible(false);
      return;
    }

    Object[] data = PlatformCoreDataKeys.SELECTED_ITEMS.getData(dataContext);
    HierarchyNodeDescriptor[] selectedDescriptors = data instanceof HierarchyNodeDescriptor[] ? ((HierarchyNodeDescriptor[])data) 
                                                                                              : HierarchyNodeDescriptor.EMPTY_ARRAY;
    int toImplement = 0;
    int toOverride = 0;

    for (HierarchyNodeDescriptor descriptor : selectedDescriptors) {
      if (canImplementOverride((MethodHierarchyNodeDescriptor)descriptor, methodHierarchyBrowser, true)) {
        if (toOverride > 0) {
          // no mixed actions allowed
          presentation.setEnabledAndVisible(false);
          return;
        }
        toImplement++;
      }
      else if (canImplementOverride((MethodHierarchyNodeDescriptor)descriptor, methodHierarchyBrowser, false)) {
        if (toImplement > 0) {
          // no mixed actions allowed
          presentation.setEnabledAndVisible(false);
          return;
        }
        toOverride++;
      }
      else {
        // no action is applicable to this node
        presentation.setEnabledAndVisible(false);
        return;
      }
    }

    presentation.setVisible(true);

    update(presentation, toImplement, toOverride);
  }
@Override
  public final void update(@NotNull AnActionEvent e)