/**
   * @return breakpoints of one of the category: LINE_BREAKPOINTS, EXCEPTION_BREAKPOINTS,
   *     FIELD_BREAKPOINTS, METHOD_BREAKPOINTS
   */
  public <T extends Breakpoint> Breakpoint[] getBreakpoints(@NotNull final Key<T> category) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    removeInvalidBreakpoints();

    final ArrayList<Breakpoint> breakpoints = new ArrayList<Breakpoint>();
    for (Breakpoint breakpoint : getBreakpoints()) {
      if (category.equals(breakpoint.getCategory())) {
        breakpoints.add(breakpoint);
      }
    }

    return breakpoints.toArray(new Breakpoint[breakpoints.size()]);
  }
 /** @param category breakpoint category, null if the category does not matter */
 @Nullable
 public <T extends BreakpointWithHighlighter> T findBreakpoint(
     final Document document, final int offset, @Nullable final Key<T> category) {
   for (final Breakpoint breakpoint : getBreakpoints()) {
     if (breakpoint instanceof BreakpointWithHighlighter
         && ((BreakpointWithHighlighter) breakpoint).isAt(document, offset)) {
       if (category == null || category.equals(breakpoint.getCategory())) {
         //noinspection CastConflictsWithInstanceof,unchecked
         return (T) breakpoint;
       }
     }
   }
   return null;
 }