Eclipse Platform
2.0

org.eclipse.jface.text
Interface IFindReplaceTarget


public interface IFindReplaceTarget

Defines the interface for finding and replacing strings.


Method Summary
 boolean canPerformFind()
          Returns whether a find operation can be performed.
 int findAndSelect(int offset, String findString, boolean searchForward, boolean caseSensitive, boolean wholeWord)
          Finds and selects a string starting at the given offset using the specified search directives.
 Point getSelection()
          Returns the currently selected range of characters as a offset and length.
 String getSelectionText()
          Returns the currently selected characters as a string.
 boolean isEditable()
          Returns whether this target can be modified.
 void replaceSelection(String text)
          Replaces the currently selected range of characters with the given text.
 

Method Detail

canPerformFind

public boolean canPerformFind()
Returns whether a find operation can be performed.

Returns:
whether a find operation can be performed

findAndSelect

public int findAndSelect(int offset,
                         String findString,
                         boolean searchForward,
                         boolean caseSensitive,
                         boolean wholeWord)
Finds and selects a string starting at the given offset using the specified search directives.

Parameters:
offset - the offset at which searching starts
findString - the string which should be found
searchForward - true searches forward, false backwards
caseSensitive - true performes a case sensitve search, false an insensitive search
wholeWord - if true only occurences are reported in which the findString stands as a word by itself
Returns:
the position of the specified string, or -1 if the string has not been found

getSelection

public Point getSelection()
Returns the currently selected range of characters as a offset and length.

Returns:
the currently selected character range

getSelectionText

public String getSelectionText()
Returns the currently selected characters as a string.

Returns:
the currently selected characters

isEditable

public boolean isEditable()
Returns whether this target can be modified.

Returns:
true if target can be modified

replaceSelection

public void replaceSelection(String text)
Replaces the currently selected range of characters with the given text. This target must be editable. Otherwise nothing happens.

Parameters:
text - the substitution text

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.