@Override
  public void update(@NotNull AnActionEvent event) {
    super.update(event);

    Project project = event.getProject();
    event.getPresentation().setEnabledAndVisible(project != null && project.isOpen());
  }
@Override
  public void update(@NotNull AnActionEvent event)