public class FindReplaceDocumentAdapter
extends java.lang.Object
implements java.lang.CharSequence
IDocument.
Replaces
IDocument.search(int, String, boolean, boolean, boolean).
| Constructor and Description |
|---|
FindReplaceDocumentAdapter(IDocument document)
Constructs a new find replace document adapter.
|
| Modifier and Type | Method and Description |
|---|---|
char |
charAt(int index) |
static java.lang.String |
escapeForRegExPattern(java.lang.String string)
Escapes special characters in the string, such that the resulting pattern
matches the given string.
|
IRegion |
find(int startOffset,
java.lang.String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord,
boolean regExSearch)
Returns the location of a given string in this adapter's document based on a set of search criteria.
|
int |
length() |
IRegion |
replace(java.lang.String text,
boolean regExReplace)
Substitutes the previous match with the given text.
|
java.lang.CharSequence |
subSequence(int start,
int end) |
java.lang.String |
toString() |
public FindReplaceDocumentAdapter(IDocument document)
document - the adapted documentpublic IRegion find(int startOffset, java.lang.String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord, boolean regExSearch) throws BadLocationException
startOffset - document offset at which search startsfindString - the string to findforwardSearch - the search directioncaseSensitive - indicates whether lower and upper case should be distinguishedwholeWord - indicates whether the findString should be limited by white spaces as
defined by Character.isWhiteSpace. Must not be used in combination with regExSearch.regExSearch - if true findString represents a regular expression
Must not be used in combination with wholeWord.null if there was no matchBadLocationException - if startOffset is an invalid document offsetjava.util.regex.PatternSyntaxException - if a regular expression has invalid syntaxpublic IRegion replace(java.lang.String text, boolean regExReplace) throws BadLocationException
DocumentEvent to all registered IDocumentListener.text - the substitution textregExReplace - if true text represents a regular expressionnull if there was no matchBadLocationException - if startOffset is an invalid document offsetjava.lang.IllegalStateException - if a REPLACE or REPLACE_FIND operation is not preceded by a successful FIND operationjava.util.regex.PatternSyntaxException - if a regular expression has invalid syntaxDocumentEvent,
IDocumentListenerpublic int length()
length in interface java.lang.CharSequencepublic char charAt(int index)
charAt in interface java.lang.CharSequencepublic java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequencepublic java.lang.String toString()
toString in interface java.lang.CharSequencetoString in class java.lang.Objectpublic static java.lang.String escapeForRegExPattern(java.lang.String string)
string - the string to escape
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.