public class FindReplaceDocumentAdapter extends Object implements 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 String |
escapeForRegExPattern(String string)
Escapes special characters in the string, such that the resulting pattern
matches the given string.
|
IRegion |
find(int startOffset,
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(String text,
boolean regExReplace)
Substitutes the previous match with the given text.
|
CharSequence |
subSequence(int start,
int end) |
String |
toString() |
public FindReplaceDocumentAdapter(IDocument document)
document
- the adapted documentpublic IRegion find(int startOffset, 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 offsetPatternSyntaxException
- if a regular expression has invalid syntaxpublic IRegion replace(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 offsetIllegalStateException
- if a REPLACE or REPLACE_FIND operation is not preceded by a successful FIND operationPatternSyntaxException
- if a regular expression has invalid syntaxDocumentEvent
,
IDocumentListener
public int length()
length
in interface CharSequence
public char charAt(int index)
charAt
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public String toString()
toString
in interface CharSequence
toString
in class Object
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.