public boolean isEnabled(@NotNull final Project project, final AnActionEvent event) {
   XLineBreakpointType<?>[] breakpointTypes = XDebuggerUtil.getInstance().getLineBreakpointTypes();
   final XBreakpointManager breakpointManager =
       XDebuggerManager.getInstance(project).getBreakpointManager();
   for (XSourcePosition position :
       XDebuggerUtilImpl.getAllCaretsPositions(project, event.getDataContext())) {
     for (XLineBreakpointType<?> breakpointType : breakpointTypes) {
       final VirtualFile file = position.getFile();
       final int line = position.getLine();
       if (breakpointType.canPutAt(file, line, project)
           || breakpointManager.findBreakpointAtLine(breakpointType, file, line) != null) {
         return true;
       }
     }
   }
   return false;
 }
  /**
   * Toggle line breakpoint with editor support: - unfolds folded block on the line - if folded,
   * checks if line breakpoints could be toggled inside folded text
   */
  @NotNull
  public static Promise toggleLineBreakpoint(
      @NotNull Project project,
      @NotNull XSourcePosition position,
      @Nullable Editor editor,
      boolean temporary,
      boolean moveCarret) {
    int lineStart = position.getLine();
    VirtualFile file = position.getFile();
    // for folded text check each line and find out type with the biggest priority
    int linesEnd = lineStart;
    if (editor != null) {
      FoldRegion region = FoldingUtil.findFoldRegionStartingAtLine(editor, lineStart);
      if (region != null && !region.isExpanded()) {
        linesEnd = region.getDocument().getLineNumber(region.getEndOffset());
      }
    }

    final XBreakpointManager breakpointManager =
        XDebuggerManager.getInstance(project).getBreakpointManager();
    XLineBreakpointType<?>[] lineTypes = XDebuggerUtil.getInstance().getLineBreakpointTypes();
    XLineBreakpointType<?> typeWinner = null;
    int lineWinner = -1;
    for (int line = lineStart; line <= linesEnd; line++) {
      int maxPriority = 0;
      for (XLineBreakpointType<?> type : lineTypes) {
        maxPriority = Math.max(maxPriority, type.getPriority());
        final XLineBreakpoint<? extends XBreakpointProperties> breakpoint =
            breakpointManager.findBreakpointAtLine(type, file, line);
        if (breakpoint != null && temporary && !breakpoint.isTemporary()) {
          breakpoint.setTemporary(true);
        } else if (type.canPutAt(file, line, project) || breakpoint != null) {
          if (typeWinner == null || type.getPriority() > typeWinner.getPriority()) {
            typeWinner = type;
            lineWinner = line;
          }
        }
      }
      // already found max priority type - stop
      if (typeWinner != null && typeWinner.getPriority() == maxPriority) {
        break;
      }
    }

    if (typeWinner != null) {
      XSourcePosition winPosition =
          (lineStart == lineWinner) ? position : XSourcePositionImpl.create(file, lineWinner);
      if (winPosition != null) {
        Promise<XLineBreakpoint> res =
            XDebuggerUtilImpl.toggleAndReturnLineBreakpoint(
                project, typeWinner, winPosition, temporary, editor);

        if (editor != null && lineStart != lineWinner) {
          int offset = editor.getDocument().getLineStartOffset(lineWinner);
          ExpandRegionAction.expandRegionAtOffset(project, editor, offset);
          if (moveCarret) {
            editor.getCaretModel().moveToOffset(offset);
          }
        }
        return res;
      }
    }

    return PromiseKt.rejectedPromise();
  }