com.intellij.openapi.editor
Interface RangeMarker

All Superinterfaces:
UserDataHolder
All Known Subinterfaces:
FoldRegion, RangeHighlighter

public interface RangeMarker
extends UserDataHolder

Represents a range of text in a Document which is automatically adjusted as the document text is modified. Adding or deleting text before the marker shifts the marker forward or backward; adding or deleting text within the marker increases or decreases the length of the marked range by the respective offset. Adding text at the start or end of the marker optionally extends the marker, depending on setGreedyToLeft(boolean) and setGreedyToRight(boolean) settings. Deleting the entire text range containing the marker causes the marker to become invalid.

See Also:
Document.createRangeMarker(int, int)

Method Summary
 Document getDocument()
          Returns the doņument to which the marker belongs.
 int getEndOffset()
          Returns the end offset of the text range covered by the marker.
 int getStartOffset()
          Returns the start offset of the text range covered by the marker.
 boolean isValid()
          Checks if the marker has been invalidated by deleting the entire fragment of text containing the marker.
 void setGreedyToLeft(boolean greedy)
          Sets the value indicating whether the text added exactly at the beginning of the marker should be included in the text range of the marker.
 void setGreedyToRight(boolean greedy)
          Sets the value indicating whether the text added exactly at the end of the marker should be included in the text range of the marker.
 
Methods inherited from interface com.intellij.openapi.util.UserDataHolder
getUserData, putUserData
 

Method Detail

getDocument

@NotNull
Document getDocument()
Returns the doņument to which the marker belongs.

Returns:
the document instance.

getStartOffset

int getStartOffset()
Returns the start offset of the text range covered by the marker.

Returns:
the start offset.

getEndOffset

int getEndOffset()
Returns the end offset of the text range covered by the marker.

Returns:
the end offset.

isValid

boolean isValid()
Checks if the marker has been invalidated by deleting the entire fragment of text containing the marker.

Returns:
true if the marker is valid, false if it has been invalidated.

setGreedyToLeft

void setGreedyToLeft(boolean greedy)
Sets the value indicating whether the text added exactly at the beginning of the marker should be included in the text range of the marker. The default value is false.

Parameters:
greedy - true if text added at the beginning is included in the range, false otherwise.

setGreedyToRight

void setGreedyToRight(boolean greedy)
Sets the value indicating whether the text added exactly at the end of the marker should be included in the text range of the marker. The default value is false.

Parameters:
greedy - true if text added at the end is included in the range, false otherwise.