public interface SoftWrapModel
'soft wrapping'
to the editor.
'Soft wrap'
here means representation of the line that exceeds right component viewport margin as if it is wrapped.
No changes are introduced to the actual document/file system during that, i.e. it's a pure 'view'
facility.
Example:
Raw text (as stored at file system)
public class Test { | <- right margin | public void baz() { | foo("test1", "test2", "test3", "test4", "test5", "test6"); } | | public void foo(Object ... args) { | } | } |The same text with soft wraps as shown to end-user at editor
public class Test { | <- right margin | public void baz() { | foo("test1", "test2", "test3", "test4", "test5", | "test6"); | } | | public void foo(Object ... args) { | } | } |Another important soft wrap feature is that as soon as the user starts typing on a line which representation is affected by soft wrap (e.g. starts adding new call argument after
"test6"
at example above), that soft wraps becomes
'hard wrap'
, i.e. virtual changes introduced by it are flushed to the underlying document.
Note: soft wrap is assumed to provide as user-friendly indentation for those wrapped line as possible
(note that "test6"
at example below is aligned to the parameters start).
Implementations of this interface are not obliged to be thread-safe.Modifier and Type | Method and Description |
---|---|
void |
beforeDocumentChangeAtCaret()
Notifies current model that target document is about to be changed at current caret location.
|
SoftWrap |
getSoftWrap(int offset)
Asks current model for the soft wrap registered for the given document offset if any.
|
java.util.List<? extends SoftWrap> |
getSoftWrapsForLine(int documentLine)
Allows to ask current model about all soft wraps registered for the given document line.
|
java.util.List<? extends SoftWrap> |
getSoftWrapsForRange(int start,
int end)
Allows to ask current model about all soft wraps registered for the given document offsets range.
|
boolean |
isInsideOrBeforeSoftWrap(VisualPosition visual)
Allows to answer if given visual position points to soft wrap-introduced virtual space or points just before soft wrap.
|
boolean |
isInsideSoftWrap(VisualPosition position)
Allows to answer if given visual position points to soft wrap-introduced virtual space.
|
boolean |
isSoftWrappingEnabled()
Allows to answer if
'soft wrap' feature is enabled. |
boolean |
isVisible(SoftWrap softWrap)
Allows to answer if given soft wrap is shown.
|
void |
release()
Callback method to ask soft wrap model to release all resources.
|
boolean isSoftWrappingEnabled()
'soft wrap'
feature is enabled.true
if 'soft wraps'
are enabled; false
otherwiseSoftWrap getSoftWrap(int offset)
offset
- target document offsetnull
otherwisejava.util.List<? extends SoftWrap> getSoftWrapsForRange(int start, int end)
start
- start document offset range to use (inclusive)end
- end document offset range to use (inclusive)java.util.List<? extends SoftWrap> getSoftWrapsForLine(int documentLine)
documentLine
- target document lineboolean isVisible(SoftWrap softWrap)
softWrap
- soft wrap to checktrue
if given soft wrap is visible; false
otherwisevoid beforeDocumentChangeAtCaret()
'soft wrap' -> 'hard wrap'
conversion if the user types in virtual
soft wraps-introduced space.boolean isInsideSoftWrap(VisualPosition position)
position
- target visual position to checktrue
if given visual position points to soft wrap-introduced virtual space;
false
otherwiseboolean isInsideOrBeforeSoftWrap(VisualPosition visual)
visual
- target visual position to checktrue
if given visual position points to soft wrap-introduced virtual space;
false
otherwisevoid release()