void () { if (myModifiedRegions.isEmpty()) return; myDuringSynchronize = true; try { for (int i = 0; i < myCount; i++) { if (i == myIndex) continue; final int pairedIndex = i; myEditors[pairedIndex].getFoldingModel().runBatchFoldingOperation(() -> { for (FoldedBlock folding : getFoldedBlocks()) { FoldRegion region = folding.getRegion(myIndex); if (region == null || !region.isValid()) continue; if (myModifiedRegions.contains(region)) { FoldRegion pairedRegion = folding.getRegion(pairedIndex); if (pairedRegion == null || !pairedRegion.isValid()) continue; pairedRegion.setExpanded(region.isExpanded()); } } }); } myModifiedRegions.clear(); } finally { myDuringSynchronize = false; } }