FoldRegion (Editor editor, RangeMarker range) { FoldRegion result = null; for (FoldRegion foldRegion : editor.getFoldingModel().getAllFoldRegions()) { if (foldRegion.isValid() && contains(range, foldRegion) && !contains(result, foldRegion)) { result = foldRegion; } } return result; }