void (final @NotNull Editor editor) { final Project project = editor.getProject(); if (project == null || !project.equals(myProject) || editor.isDisposed()) return; if (!((FoldingModelEx)editor.getFoldingModel()).isFoldingEnabled()) return; if (!FoldingUpdate.supportsDumbModeFolding(editor)) return; Document document = editor.getDocument(); PsiDocumentManager.getInstance(myProject).commitDocument(document); CodeFoldingState foldingState = buildInitialFoldings(document); if (foldingState != null) { foldingState.setToEditor(editor); } }