com.intellij.find
Class FindManager

java.lang.Object
  extended by com.intellij.find.FindManager

public abstract class FindManager
extends java.lang.Object

Allows to invoke and control Find, Replace and Find Usages operations.


Nested Class Summary
static interface FindManager.PromptResult
          Possible return values for the showPromptDialog(FindModel, String) method.
 
Constructor Summary
FindManager()
           
 
Method Summary
abstract  boolean canFindUsages(PsiElement element)
          Checks if the Find Usages action is available for the specified element.
abstract  void findJoinpointsByPointcut(PsiPointcut pointcut)
          Finds the AspectJ joinpoints matching the specified pointcut.
abstract  boolean findNextUsageInEditor(FileEditor editor)
          Performs a "Find Next" operation after "Find Usages in File" or "Highlight Usages in File".
abstract  boolean findPreviousUsageInEditor(FileEditor editor)
          Performs a "Find Previous" operation after "Find Usages in File" or "Highlight Usages in File".
abstract  FindResult findString(java.lang.CharSequence text, int offset, FindModel model)
          Searches for the specified substring in the specified character sequence, using the specified find settings.
abstract  void findUsages(PsiElement element)
          Shows the Find Usages dialog and performs the Find Usages operation for the specified element.
abstract  void findUsagesInEditor(PsiElement element, FileEditor editor)
          Performs a "Find Usages in File" operation for the specified element.
abstract  boolean findWasPerformed()
          Gets the flag indicating whether the "Find Next" and "Find Previous" actions are available to continue a previously started search operation.
abstract  FindModel getFindInFileModel()
          Returns the settings of the last performed Find in File operation, or the default Find in File settings if no such operation was performed by the user.
abstract  FindModel getFindInProjectModel()
          Returns the settings of the last performed Find in Project operation, or the default Find in Project settings if no such operation was performed by the user.
abstract  FindModel getFindNextModel()
          Gets the model containing the search settings to use for "Find Next" and "Find Previous" operations.
static FindManager getInstance(Project project)
          Returns the find manager instance for the specified project.
abstract  java.lang.String getStringToReplace(java.lang.String foundString, FindModel model)
          Gets the string to replace with, given the specified found string and find/replace settings.
abstract  void setFindNextModel(FindModel model)
          Sets the model containing the search settings to use for "Find Next" and "Find Previous" operations.
abstract  void setFindWasPerformed()
          Sets the flag indicating that the "Find Next" and "Find Previous" actions are available to continue a previously started search operation.
abstract  boolean showFindDialog(FindModel model)
          Shows the Find, Replace or Find Usages dialog initializing it from the specified model and saves the settings entered by the user into the same model.
abstract  int showPromptDialog(FindModel model, java.lang.String title)
          Shows a replace prompt dialog for the specfied replace operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FindManager

public FindManager()
Method Detail

getInstance

public static FindManager getInstance(Project project)
Returns the find manager instance for the specified project.

Parameters:
project - the project for which the manager is requested.
Returns:
the manager instance.

showFindDialog

public abstract boolean showFindDialog(FindModel model)
Shows the Find, Replace or Find Usages dialog initializing it from the specified model and saves the settings entered by the user into the same model. Does not perform the actual find or replace operation.

Parameters:
model - the model containing the settings of a find or replace operation.
Returns:
true if the dialog was closed with OK, false if it was cancelled.

showPromptDialog

public abstract int showPromptDialog(FindModel model,
                                     java.lang.String title)
Shows a replace prompt dialog for the specfied replace operation.

Parameters:
model - the model containing the settings of the replace operation.
title - the title of the dialog to show.
Returns:
the exit code of the dialog, as defined by the FindManager.PromptResult interface.

getFindInFileModel

@NotNull
public abstract FindModel getFindInFileModel()
Returns the settings of the last performed Find in File operation, or the default Find in File settings if no such operation was performed by the user.

Returns:
the last Find in File settings.

getFindInProjectModel

@NotNull
public abstract FindModel getFindInProjectModel()
Returns the settings of the last performed Find in Project operation, or the default Find in Project settings if no such operation was performed by the user.

Returns:
the last Find in Project settings.

findString

@NotNull
public abstract FindResult findString(java.lang.CharSequence text,
                                              int offset,
                                              FindModel model)
Searches for the specified substring in the specified character sequence, using the specified find settings. Supports case sensitive and insensitive searches, forward and backward searches, regular expression searches and searches for whole words.

Parameters:
text - the text in which the search is performed.
offset - the start offset for the search.
model - the settings for the search, including the string to find.
Returns:
the result of the search.

getStringToReplace

public abstract java.lang.String getStringToReplace(java.lang.String foundString,
                                                    FindModel model)
Gets the string to replace with, given the specified found string and find/replace settings. Supports case-preserving and regular expression replaces.

Parameters:
foundString - the found string.
model - the search and replace settings, including the replace string.
Returns:
the string to replace the specified found string.

findWasPerformed

public abstract boolean findWasPerformed()
Gets the flag indicating whether the "Find Next" and "Find Previous" actions are available to continue a previously started search operation. (The operations are available if at least one search was performed in the current IDEA session.)

Returns:
true if the actions are available, false if there is no previous search operation to continue.

setFindWasPerformed

public abstract void setFindWasPerformed()
Sets the flag indicating that the "Find Next" and "Find Previous" actions are available to continue a previously started search operation.


setFindNextModel

public abstract void setFindNextModel(FindModel model)
Sets the model containing the search settings to use for "Find Next" and "Find Previous" operations.

Parameters:
model - the model to use for the operations.

getFindNextModel

public abstract FindModel getFindNextModel()
Gets the model containing the search settings to use for "Find Next" and "Find Previous" operations.

Returns:
the model to use for the operations.

canFindUsages

public abstract boolean canFindUsages(PsiElement element)
Checks if the Find Usages action is available for the specified element.

Parameters:
element - the element to check the availability for.
Returns:
true if Find Usages is available, false otherwise.
See Also:
FindUsagesProvider.canFindUsagesFor(com.intellij.psi.PsiElement)

findUsages

public abstract void findUsages(PsiElement element)
Shows the Find Usages dialog and performs the Find Usages operation for the specified element.

Parameters:
element - the element to find the usages for.

findJoinpointsByPointcut

public abstract void findJoinpointsByPointcut(PsiPointcut pointcut)
Finds the AspectJ joinpoints matching the specified pointcut. (This functionality is currently incomplete and should not be used.)

Parameters:
pointcut - the pointcut to find.

findUsagesInEditor

public abstract void findUsagesInEditor(PsiElement element,
                                        FileEditor editor)
Performs a "Find Usages in File" operation for the specified element.

Parameters:
element - the element for which the find is performed.
editor - the editor in which the find is performed.

findNextUsageInEditor

public abstract boolean findNextUsageInEditor(FileEditor editor)
Performs a "Find Next" operation after "Find Usages in File" or "Highlight Usages in File".

Parameters:
editor - the editor in which the find is performed.
Returns:
true if the operation was performed (not necessarily found anything), false if an error occurred during the operation.

findPreviousUsageInEditor

public abstract boolean findPreviousUsageInEditor(FileEditor editor)
Performs a "Find Previous" operation after "Find Usages in File" or "Highlight Usages in File".

Parameters:
editor - the editor in which the find is performed.
Returns:
true if the operation was performed (not necessarily found anything), false if an error occurred during the operation.