use of com.intellij.codeInsight.folding.impl.CodeFoldingManagerImpl in project intellij-community by JetBrains.
the class CopyPasteFoldingProcessor method processTransferableData.
@Override
public void processTransferableData(final Project project, final Editor editor, final RangeMarker bounds, int caretOffset, Ref<Boolean> indented, final List<FoldingTransferableData> values) {
assert values.size() == 1;
final FoldingTransferableData value = values.get(0);
if (value.getData().length == 0)
return;
final CodeFoldingManagerImpl foldingManager = (CodeFoldingManagerImpl) CodeFoldingManager.getInstance(project);
foldingManager.updateFoldRegions(editor, true);
Runnable operation = () -> {
for (FoldingData data : value.getData()) {
FoldRegion region = foldingManager.findFoldRegion(editor, data.startOffset + bounds.getStartOffset(), data.endOffset + bounds.getStartOffset());
if (region != null) {
region.setExpanded(data.isExpanded);
}
}
};
editor.getFoldingModel().runBatchFoldingOperation(operation);
}
Aggregations