public class SoftWrapApplianceManager extends java.lang.Object implements Dumpable
'logical position -> visual position'
, 'offset -> logical position'
etc) and update it incrementally
on events like document modification fold region(s) expanding/collapsing etc.
This class encapsulates document parsing logic. It notifies registered listeners
about parsing and they are free to store necessary information for further usage.
Not thread-safe.Modifier and Type | Class and Description |
---|---|
static interface |
SoftWrapApplianceManager.VisibleAreaWidthProvider
This interface is introduced mostly for encapsulating GUI-specific values retrieval and make it possible to write
tests for soft wraps processing.
|
Constructor and Description |
---|
SoftWrapApplianceManager(SoftWrapsStorage storage,
EditorImpl editor,
SoftWrapPainter painter,
CachingSoftWrapDataMapper dataMapper) |
Modifier and Type | Method and Description |
---|---|
boolean |
addListener(com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapAwareDocumentParsingListener listener)
Registers given listener within the current manager.
|
void |
beforeDocumentChange(DocumentEvent event) |
void |
documentChanged(DocumentEvent event,
boolean processAlsoLineEnd) |
java.lang.String |
dumpState() |
void |
recalculate(java.util.List<? extends Segment> ranges) |
boolean |
recalculateIfNecessary()
There is a possible case that we need to reparse the whole document (e.g.
|
void |
registerSoftWrapIfNecessary() |
boolean |
removeListener(com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapAwareDocumentParsingListener listener) |
void |
reset() |
void |
setSoftWrapPainter(SoftWrapPainter painter) |
void |
setWidthProvider(SoftWrapApplianceManager.VisibleAreaWidthProvider widthProvider) |
java.lang.String |
toString() |
void |
updateAvailableArea() |
public SoftWrapApplianceManager(SoftWrapsStorage storage, EditorImpl editor, SoftWrapPainter painter, CachingSoftWrapDataMapper dataMapper)
public void registerSoftWrapIfNecessary()
public void reset()
public void recalculate(java.util.List<? extends Segment> ranges)
public boolean recalculateIfNecessary()
true
if re-calculation logic was performed;
false
otherwise (e.g. we need to perform re-calculation but current editor is now shown, i.e. we don't
have information about viewport widthpublic boolean addListener(com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapAwareDocumentParsingListener listener)
listener
- listener to registertrue
if this collection changed as a result of the call; false
otherwisepublic boolean removeListener(com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapAwareDocumentParsingListener listener)
public void beforeDocumentChange(DocumentEvent event)
public void documentChanged(DocumentEvent event, boolean processAlsoLineEnd)
public void setWidthProvider(SoftWrapApplianceManager.VisibleAreaWidthProvider widthProvider)
public java.lang.String toString()
toString
in class java.lang.Object
public void setSoftWrapPainter(SoftWrapPainter painter)
public void updateAvailableArea()