The two main methods are
replaceSelection. The target
does not provide any way to modify the content other than replacing the selection.
In order to provide backward compatibility for clients of
extension interfaces are used as a means of evolution. The following extension interfaces exist:
IFindReplaceTargetExtensionsince version 2.0 introducing the notion of find/replace session and of a find/replace scope. In additions, in allows clients to replace all occurrences of a given find query.
IFindReplaceTargetExtension3since version 3.0 allowing clients to specify search queries as regular expressions.
IFindReplaceTargetExtension4since version 3.19 allowing clients to select multiple text ranges in the target.
Clients of a
IFindReplaceTarget that also implements the
IFindReplaceTargetExtension have to indicate the start of a find/replace session
before using the target and to indicate the end of the session when the target is no longer used.
Method SummaryModifier and TypeMethodDescription
booleanReturns whether a find operation can be performed.
(int widgetOffset, String findString, boolean searchForward, boolean caseSensitive, boolean wholeWord)Searches for a string starting at the given widget offset and using the specified search directives.Returns the currently selected range of characters as an offset and length in widget coordinates.Returns the currently selected characters as a string.
booleanReturns whether this target can be modified.
voidReplaces the currently selected range of characters with the given text.
canPerformFindboolean canPerformFind()Returns whether a find operation can be performed.
- whether a find operation can be performed
(int widgetOffset, String findString, boolean searchForward, boolean caseSensitive, boolean wholeWord)Searches for a string starting at the given widget offset and using the specified search directives. If a string has been found it is selected and its start offset is returned.
widgetOffset- the widget offset at which searching starts
findString- the string which should be found
trueperforms a case sensitive search,
falsean insensitive search
trueonly occurrences are reported in which the findString stands as a word by itself
- the position of the specified string, or -1 if the string has not been found
getSelectionPoint getSelection()Returns the currently selected range of characters as an offset and length in widget coordinates.
- the currently selected character range in widget coordinates
getSelectionTextString getSelectionText()Returns the currently selected characters as a string.
- the currently selected characters
isEditableboolean isEditable()Returns whether this target can be modified.
trueif target can be modified
(String text)Replaces the currently selected range of characters with the given text. This target must be editable. Otherwise nothing happens.
text- the substitution text