public interface ICharacterPairMatcherExtension
ICharacterPairMatcher
.
Extends the character pair matcher with the concept of matching peer character and enclosing peer characters for a given selection.
ICharacterPairMatcher
Modifier and Type | Method and Description |
---|---|
IRegion |
findEnclosingPeerCharacters(IDocument document,
int offset,
int length)
Starting at the given selection, the matcher searches for a pair of enclosing peer characters
and if it finds one, returns the minimal region of the document that contains the pair.
|
boolean |
isMatchedChar(char ch)
Checks whether the character is one of the characters matched by the pair matcher.
|
boolean |
isMatchedChar(char ch,
IDocument document,
int offset)
Checks whether the character is one of the characters matched by the pair matcher.
|
boolean |
isRecomputationOfEnclosingPairRequired(IDocument document,
IRegion currentSelection,
IRegion previousSelection)
Computes whether a client needs to recompute the enclosing pair after a selection change in
the document.
|
IRegion |
match(IDocument document,
int offset,
int length)
Starting at the given offset (i.e. length 0) or the selected character, the matcher searches
for the matching peer character and if it finds one, returns the minimal region of the
document that contains both characters.
|
IRegion match(IDocument document, int offset, int length)
document
- the document to work onoffset
- the start offsetlength
- the selection length which can be negative indicating right-to-left selectionnull
if there is no
peer characterIRegion findEnclosingPeerCharacters(IDocument document, int offset, int length)
document
- the document to work onoffset
- the start offsetlength
- the selection length which can be negative indicating right-to-left selectionnull
if there is no
enclosing pairboolean isMatchedChar(char ch)
ch
- the charactertrue
if the the character is one of the characters matched by the pair
matcher, and false
otherwiseboolean isMatchedChar(char ch, IDocument document, int offset)
Clients can use this method to handle characters which may have special meaning in some situations. E.g. in Java, '<' is used as an angular bracket and as well as less-than operator.
ch
- the characterdocument
- the documentoffset
- the offset in documenttrue
if the the character is one of the characters matched by the pair
matcher, and false
otherwiseboolean isRecomputationOfEnclosingPairRequired(IDocument document, IRegion currentSelection, IRegion previousSelection)
This is intended to be a quick test to determine whether a re-computation of the enclosing pair is
required, as the re-computation after each selection change via a
findEnclosingPeerCharacters(IDocument, int, int)
call can be expensive for some
clients.
document
- the document to work oncurrentSelection
- the current selection in the documentpreviousSelection
- the previous selection in the documenttrue
if the enclosing pair needs to be recomputed, false
otherwise
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.