Package org.eclipse.jface.text.rules
Class WhitespaceRule
java.lang.Object
org.eclipse.jface.text.rules.WhitespaceRule
- All Implemented Interfaces:
IRule
An implementation of
IRule
capable of detecting whitespace.
A whitespace rule uses a whitespace detector in order to find out which
characters are whitespace characters.
Originally since unknown version, but moved to org.eclipse.text in 3.14- Since:
- 3.14
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected IWhitespaceDetector
The whitespace detector used by this ruleprotected final IToken
The token returned for whitespace. -
Constructor Summary
ConstructorDescriptionWhitespaceRule
(IWhitespaceDetector detector) Creates a rule which, with the help of an whitespace detector, will returnToken.WHITESPACE
when a whitespace is detected.WhitespaceRule
(IWhitespaceDetector detector, IToken token) Creates a rule which, with the help of an whitespace detector, will return the given whitespace token when a whitespace is detected. -
Method Summary
Modifier and TypeMethodDescriptionevaluate
(ICharacterScanner scanner) Evaluates the rule by examining the characters available from the provided character scanner.
-
Field Details
-
fDetector
The whitespace detector used by this rule -
fWhitespaceToken
The token returned for whitespace.- Since:
- 3.5
-
-
Constructor Details
-
WhitespaceRule
Creates a rule which, with the help of an whitespace detector, will returnToken.WHITESPACE
when a whitespace is detected.- Parameters:
detector
- the rule's whitespace detector
-
WhitespaceRule
Creates a rule which, with the help of an whitespace detector, will return the given whitespace token when a whitespace is detected.- Parameters:
detector
- the rule's whitespace detectortoken
- the token returned for whitespace- Since:
- 3.5
-
-
Method Details
-
evaluate
Evaluates the rule by examining the characters available from the provided character scanner. The token returned by this rule returnstrue
when callingisUndefined
, if the text that the rule investigated does not match the rule's requirements- Specified by:
evaluate
in interfaceIRule
- Parameters:
scanner
- the character scanner to be used by this rule- Returns:
fWhitespaceToken
if whitespace got detected,Token.UNDEFINED
otherwise
-