Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.text
Interface IFindReplaceTarget


public interface IFindReplaceTarget

Defines the target for finding and replacing strings.

The two main methods are findAndSelect and 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 IFindReplaceTarget, extension interfaces are used as a means of evolution. The following extension interfaces exist:

  • IFindReplaceTargetExtension since 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.
  • IFindReplaceTargetExtension3 since version 3.0 allowing clients to specify search queries as regular expressions.

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.

See Also:
IFindReplaceTargetExtension, IFindReplaceTargetExtension3

Method Summary
 boolean canPerformFind ()
          Returns whether a find operation can be performed.
 int findAndSelect (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.
  Point getSelection ()
          Returns the currently selected range of characters as a offset and length in widget coordinates.
  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

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

Returns:
whether a find operation can be performed

findAndSelect

int findAndSelect(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.

Replaced by IFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean).

Parameters:
widgetOffset - the widget offset at which searching starts
findString - the string which should be found
searchForward - true searches forward, false backwards
caseSensitive - true performs a case sensitive search, false an insensitive search
wholeWord - if true only occurrences 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

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

Returns:
the currently selected character range in widget coordinates

getSelectionText

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

Returns:
the currently selected characters

isEditable

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

Returns:
true if target can be modified

replaceSelection

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

Replaced by IFindReplaceTargetExtension3.replaceSelection(String, boolean).

Parameters:
text - the substitution text

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire