@Override
  public void update(@NotNull AnActionEvent e) {
    Presentation presentation = e.getPresentation();
    Project project = e.getProject();

    if (project == null) {
      presentation.setEnabledAndVisible(false);
      return;
    }

    final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
    final boolean underVcs = vcsManager.hasActiveVcss();
    if (!underVcs) {
      presentation.setEnabledAndVisible(false);
      return;
    }

    String scopeName = myScopeInfo.getScopeName(e.getDataContext(), myActionInfo);
    String actionName = myActionInfo.getActionName(scopeName);
    if (myActionInfo.showOptions(project) || OptionsDialog.shiftIsPressed(e.getModifiers())) {
      actionName += "...";
    }
    presentation.setText(actionName);

    if (supportingVcsesAreEmpty(vcsManager, myActionInfo)) {
      presentation.setEnabledAndVisible(false);
      return;
    }

    if (filterRootsBeforeAction()) {
      List<FilePath> filePaths = myScopeInfo.getRoots(e.getDataContext(), myActionInfo);
      FilePath[] roots = filterRoots(project, filePaths);
      if (roots.length == 0) {
        presentation.setVisible(myAlwaysVisible);
        presentation.setEnabled(false);
        return;
      }
    }

    final AbstractVcs singleVcs = vcsManager.getSingleVCS();
    presentation.setVisible(true);
    presentation.setEnabled(!vcsManager.isBackgroundVcsOperationRunning() &&
                            (singleVcs == null || !singleVcs.isUpdateActionDisabled()));
  }
@Override
  public void update(@NotNull AnActionEvent e)