use of com.intellij.psi.PsiDocCommentBase in project intellij-community by JetBrains.
the class CollapseExpandDocCommentsHandler method invoke.
@Override
public void invoke(@NotNull Project project, @NotNull final Editor editor, @NotNull PsiFile file) {
CodeFoldingManager foldingManager = CodeFoldingManager.getInstance(project);
foldingManager.updateFoldRegions(editor);
final FoldRegion[] allFoldRegions = editor.getFoldingModel().getAllFoldRegions();
Runnable processor = () -> {
for (FoldRegion region : allFoldRegions) {
PsiElement element = EditorFoldingInfo.get(editor).getPsiElement(region);
if (element instanceof PsiDocCommentBase) {
region.setExpanded(myExpand);
}
}
};
editor.getFoldingModel().runBatchFoldingOperation(processor);
}
Aggregations