Java Code Examples for com.intellij.openapi.editor.FoldRegion#EMPTY_ARRAY
The following examples show how to use
com.intellij.openapi.editor.FoldRegion#EMPTY_ARRAY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VisualLinesIterator.java From consulo with Apache License 2.0 | 5 votes |
public VisualLinesIterator(@Nonnull DesktopEditorImpl editor, int startVisualLine) { myEditor = editor; SoftWrapModelImpl softWrapModel = myEditor.getSoftWrapModel(); myDocument = myEditor.getDocument(); FoldRegion[] regions = myEditor.getFoldingModel().fetchTopLevel(); myFoldRegions = regions == null ? FoldRegion.EMPTY_ARRAY : regions; mySoftWraps = softWrapModel.getRegisteredSoftWraps(); myLineHeight = myEditor.getLineHeight(); myLocation = new Location(startVisualLine); }
Example 2
Source File: VisualLineFragmentsIterator.java From consulo with Apache License 2.0 | 5 votes |
private void init(EditorView view, int visualLine, int startOffset, int startLogicalLine, int currentOrPrevWrapIndex, int nextFoldingIndex, @Nullable Runnable quickEvaluationListener, boolean align) { myQuickEvaluationListener = quickEvaluationListener; myView = view; DesktopEditorImpl editor = view.getEditor(); myScaleContext = JBUI.ScaleContext.create(editor.getContentComponent()); if (align && visualLine != -1 && editor.isRightAligned()) { myFragment = new RightAlignedFragment(view.getRightAlignmentLineStartX(visualLine) - myView.getInsets().left); } myDocument = editor.getDocument(); FoldingModelEx foldingModel = editor.getFoldingModel(); FoldRegion[] regions = foldingModel.fetchTopLevel(); myRegions = regions == null ? FoldRegion.EMPTY_ARRAY : regions; SoftWrapModelImpl softWrapModel = editor.getSoftWrapModel(); List<? extends SoftWrap> softWraps = softWrapModel.getRegisteredSoftWraps(); SoftWrap currentOrPrevWrap = currentOrPrevWrapIndex < 0 || currentOrPrevWrapIndex >= softWraps.size() ? null : softWraps.get(currentOrPrevWrapIndex); SoftWrap followingWrap = currentOrPrevWrapIndex + 1 < 0 || currentOrPrevWrapIndex + 1 >= softWraps.size() ? null : softWraps.get(currentOrPrevWrapIndex + 1); myVisualLineStartOffset = mySegmentStartOffset = startOffset; myCurrentFoldRegionIndex = nextFoldingIndex; myCurrentEndLogicalLine = startLogicalLine; myCurrentX = myView.getInsets().left; if (mySegmentStartOffset == 0) { myCurrentX += myView.getPrefixTextWidthInPixels(); } else if (currentOrPrevWrap != null && mySegmentStartOffset == currentOrPrevWrap.getStart()) { myCurrentX += currentOrPrevWrap.getIndentInPixels(); myCurrentVisualColumn = currentOrPrevWrap.getIndentInColumns(); } myNextWrapOffset = followingWrap == null ? Integer.MAX_VALUE : followingWrap.getStart(); setInlaysAndFragmentIterator(); }
Example 3
Source File: FoldRegionsTree.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull FoldRegion[] fetchCollapsedAt(int offset) { if (!isFoldingEnabled()) return FoldRegion.EMPTY_ARRAY; List<FoldRegion> allCollapsed = new ArrayList<>(); myMarkerTree.processContaining(offset, region -> { if (!region.isExpanded() && containsStrict(region, offset)) { allCollapsed.add(region); } return true; }); return toFoldArray(allCollapsed); }
Example 4
Source File: FoldRegionsTree.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull FoldRegion[] fetchAllRegions() { if (!isFoldingEnabled()) return FoldRegion.EMPTY_ARRAY; List<FoldRegion> regions = new ArrayList<>(); myMarkerTree.processOverlappingWith(0, Integer.MAX_VALUE, new CommonProcessors.CollectProcessor<>(regions)); return toFoldArray(regions); }
Example 5
Source File: TextComponentFoldingModel.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override public FoldRegion[] getAllFoldRegions() { return FoldRegion.EMPTY_ARRAY; }
Example 6
Source File: FoldRegionsTree.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull private static FoldRegion[] toFoldArray(@Nonnull List<FoldRegion> topLevels) { return topLevels.isEmpty() ? FoldRegion.EMPTY_ARRAY : topLevels.toArray(FoldRegion.EMPTY_ARRAY); }
Example 7
Source File: FoldingModelWindow.java From consulo with Apache License 2.0 | 4 votes |
@Override public FoldRegion[] fetchTopLevel() { return FoldRegion.EMPTY_ARRAY; //todo implement }