BreakpointManagerState (@NotNull BreakpointManagerState state) { // create default breakpoints map without locking var defaultBreakpointsMap = StreamEx.of(createDefaultBreakpoints()).toMap(XBreakpointBase::getType, Function.identity()); return withLockMaybeCancellable(myLock, () -> { myDependentBreakpointManager.saveState(); List<BreakpointState<?, ?, ?>> defaultBreakpoints = new SmartList<>(); for (Set<XBreakpointBase<?, ?, ?>> typeDefaultBreakpoints : myDefaultBreakpoints.values()) { if (!ContainerUtil.exists(typeDefaultBreakpoints, breakpoint -> differsFromDefault(defaultBreakpointsMap, breakpoint.getType(), breakpoint.getState()))) { continue; } for (XBreakpointBase<?, ?, ?> breakpoint : typeDefaultBreakpoints) { final BreakpointState breakpointState = breakpoint.getState(); defaultBreakpoints.add(breakpointState); } } List<BreakpointState<?, ?, ?>> breakpoints = new SmartList<>(); for (XBreakpointBase<?, ?, ?> breakpoint : myBreakpoints.values()) { breakpoints.add(breakpoint.getState()); } List<BreakpointState<?, ?, ?>> breakpointsDefaults = new SmartList<>(); for (Map.Entry<XBreakpointType, BreakpointState<?, ?, ?>> entry : myBreakpointsDefaults.entrySet()) { if (statesAreDifferent(entry.getValue(), createBreakpointDefaults(entry.getKey()), false)) { breakpointsDefaults.add(entry.getValue()); } } state.getDefaultBreakpoints().clear(); state.getDefaultBreakpoints().addAll(defaultBreakpoints); state.getBreakpoints().clear(); state.getBreakpoints().addAll(breakpoints); state.getBreakpointsDefaults().clear(); state.getBreakpointsDefaults().addAll(breakpointsDefaults); state.setBreakpointsDialogProperties(myBreakpointsDialogSettings); state.setDefaultGroup(myDefaultGroup); return state; }); }