private static <T extends Breakpoint> Element getCategoryGroupElement(
     @NotNull final Map<Key<? extends Breakpoint>, Element> categoryToElementMap,
     @NotNull final Key<T> category,
     @NotNull final Element parentNode) {
   Element group = categoryToElementMap.get(category);
   if (group == null) {
     group = new Element(category.toString());
     categoryToElementMap.put(category, group);
     parentNode.addContent(group);
   }
   return group;
 }
 public void setBreakpointDefaults(
     Key<? extends Breakpoint> category, BreakpointDefaults defaults) {
   Class typeCls = null;
   if (LineBreakpoint.CATEGORY.toString().equals(category.toString())) {
     typeCls = JavaLineBreakpointType.class;
   } else if (MethodBreakpoint.CATEGORY.toString().equals(category.toString())) {
     typeCls = JavaMethodBreakpointType.class;
   } else if (FieldBreakpoint.CATEGORY.toString().equals(category.toString())) {
     typeCls = JavaFieldBreakpointType.class;
   } else if (ExceptionBreakpoint.CATEGORY.toString().equals(category.toString())) {
     typeCls = JavaExceptionBreakpointType.class;
   }
   if (typeCls != null) {
     XBreakpointType<XBreakpoint<?>, ?> type =
         XDebuggerUtil.getInstance().findBreakpointType(typeCls);
     ((XBreakpointManagerImpl) getXBreakpointManager())
         .getBreakpointDefaults(type)
         .setSuspendPolicy(Breakpoint.transformSuspendPolicy(defaults.getSuspendPolicy()));
   }
   // myBreakpointDefaults.put(category, defaults);
 }
  /**
   * @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;
 }