Package org.fife.ui.rsyntaxtextarea
Class DefaultOccurrenceMarker
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.DefaultOccurrenceMarker
-
- All Implemented Interfaces:
OccurrenceMarker
class DefaultOccurrenceMarker extends java.lang.Object implements OccurrenceMarker
The default implementation ofOccurrenceMarker. It goes through the document and marks all instances of the specified token.- Version:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description DefaultOccurrenceMarker()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TokengetTokenToMark(RSyntaxTextArea textArea)Returns the token to mark occurrences, of, provided it matches the criteria put forth byOccurrenceMarker.isValidType(RSyntaxTextArea, Token).booleanisValidType(RSyntaxTextArea textArea, Token t)Returns whether the specified token is a type that we can do a "mark occurrences" of.voidmarkOccurrences(RSyntaxDocument doc, Token t, RSyntaxTextAreaHighlighter h, SmartHighlightPainter p)Called when occurrences of a token should be marked.static voidmarkOccurrencesOfToken(RSyntaxDocument doc, Token t, RSyntaxTextAreaHighlighter h, SmartHighlightPainter p)Highlights all instances of tokens identical totin the specified document.
-
-
-
Method Detail
-
getTokenToMark
public Token getTokenToMark(RSyntaxTextArea textArea)
Description copied from interface:OccurrenceMarkerReturns the token to mark occurrences, of, provided it matches the criteria put forth byOccurrenceMarker.isValidType(RSyntaxTextArea, Token). For most languages, this method should return the token at the caret position.- Specified by:
getTokenToMarkin interfaceOccurrenceMarker- Parameters:
textArea- The text area.- Returns:
- The token to (possibly) mark occurrences of, or
nullif none.
-
isValidType
public boolean isValidType(RSyntaxTextArea textArea, Token t)
Description copied from interface:OccurrenceMarkerReturns whether the specified token is a type that we can do a "mark occurrences" of. Typically, this will delegate toRSyntaxTextArea.getMarkOccurrencesOfTokenType(int).- Specified by:
isValidTypein interfaceOccurrenceMarker- Parameters:
textArea- The text area.t- The token.- Returns:
- Whether we should mark all occurrences of this token.
-
markOccurrences
public void markOccurrences(RSyntaxDocument doc, Token t, RSyntaxTextAreaHighlighter h, SmartHighlightPainter p)
Description copied from interface:OccurrenceMarkerCalled when occurrences of a token should be marked.- Specified by:
markOccurrencesin interfaceOccurrenceMarker- Parameters:
doc- The document.t- The document whose relevant occurrences should be marked.h- The highlighter to add the highlights to.p- The painter for the highlights.
-
markOccurrencesOfToken
public static void markOccurrencesOfToken(RSyntaxDocument doc, Token t, RSyntaxTextAreaHighlighter h, SmartHighlightPainter p)
Highlights all instances of tokens identical totin the specified document.- Parameters:
doc- The document.t- The document whose relevant occurrences should be marked.h- The highlighter to add the highlights to.p- The painter for the highlights.
-
-