diff --git a/platform/core-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java b/platform/core-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java index 7e127598dab4..f0638c94e348 100644 --- a/platform/core-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/ex/DocumentEx.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,17 @@ public interface DocumentEx extends Document { @NotNull List getGuardedBlocks(); + + /** + * Get all range markers + * and hand them to the {@code processor} in their {@link RangeMarker#getStartOffset()} order + */ boolean processRangeMarkers(@NotNull Processor processor); + + /** + * Get range markers which {@link com.intellij.openapi.util.TextRange#intersects(int, int)} the specified range + * and hand them to the {@code processor} in their {@link RangeMarker#getStartOffset()} order + */ boolean processRangeMarkersOverlappingWith(int start, int end, @NotNull Processor processor); } diff --git a/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java index a9ac8c880521..d380056e8a47 100644 --- a/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java @@ -332,11 +332,11 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { } } - public ReadonlyFragmentModificationHandler getReadonlyFragmentModificationHandler() { + ReadonlyFragmentModificationHandler getReadonlyFragmentModificationHandler() { return myReadonlyFragmentModificationHandler; } - public void setReadonlyFragmentModificationHandler(final ReadonlyFragmentModificationHandler readonlyFragmentModificationHandler) { + void setReadonlyFragmentModificationHandler(final ReadonlyFragmentModificationHandler readonlyFragmentModificationHandler) { myReadonlyFragmentModificationHandler = readonlyFragmentModificationHandler; } @@ -364,13 +364,13 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { } @TestOnly - public int getRangeMarkersSize() { + int getRangeMarkersSize() { return myRangeMarkers.size() + myPersistentRangeMarkers.size(); } @TestOnly - public int getRangeMarkersNodeSize() { - return myRangeMarkers.nodeSize()+myPersistentRangeMarkers.size(); + int getRangeMarkersNodeSize() { + return myRangeMarkers.nodeSize()+myPersistentRangeMarkers.nodeSize(); } @Override @@ -693,7 +693,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { getLineSet().clearModificationFlags(); } - public void clearLineModificationFlagsExcept(@NotNull int[] caretLines) { + void clearLineModificationFlagsExcept(@NotNull int[] caretLines) { IntArrayList modifiedLines = new IntArrayList(caretLines.length); LineSet lineSet = getLineSet(); for (int line : caretLines) { @@ -716,8 +716,8 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { assertNotNestedModification(); boolean enableRecursiveModifications = Registry.is("enable.recursive.document.changes"); // temporary property, to remove in IDEA 16 myChangeInProgress = true; - final DocumentEvent event; try { + final DocumentEvent event; try { event = doBeforeChangedUpdate(offset, oldString, newString, wholeTextReplaced); } @@ -742,11 +742,9 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { Application app = ApplicationManager.getApplication(); if (app != null) { FileDocumentManager manager = FileDocumentManager.getInstance(); - if (manager != null) { - VirtualFile file = manager.getFile(this); - if (file != null && !file.isValid()) { - LOG.error("File of this document has been deleted."); - } + VirtualFile file = manager.getFile(this); + if (file != null && !file.isValid()) { + LOG.error("File of this document has been deleted."); } } assertInsideCommand(); @@ -878,9 +876,9 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { private final Ref myCachedDocumentListenersRef; private final List myDocumentListeners; - public DocumentListenerDisposable(@NotNull DocumentListener listener, - @NotNull Ref cachedDocumentListenersRef, - @NotNull List documentListeners) { + private DocumentListenerDisposable(@NotNull DocumentListener listener, + @NotNull Ref cachedDocumentListenersRef, + @NotNull List documentListeners) { myListener = listener; myCachedDocumentListenersRef = cachedDocumentListenersRef; myDocumentListeners = documentListeners; @@ -1085,7 +1083,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { return "DocumentImpl[" + FileDocumentManager.getInstance().getFile(this) + "]"; } - public void requestTabTracking() { + void requestTabTracking() { ApplicationManager.getApplication().assertIsDispatchThread(); if (myTabTrackingRequestors++ == 0) { myMightContainTabs = false; @@ -1093,14 +1091,14 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { } } - public void giveUpTabTracking() { + void giveUpTabTracking() { ApplicationManager.getApplication().assertIsDispatchThread(); if (--myTabTrackingRequestors == 0) { myMightContainTabs = true; } } - public boolean mightContainTabs() { + boolean mightContainTabs() { return myMightContainTabs; }