public abstract class FindManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FindManager.MalformedReplacementStringException |
static interface |
FindManager.PromptResult
Possible return values for the
showPromptDialog(FindModel, String) method. |
static interface |
FindManager.PromptResultValue |
Modifier and Type | Field and Description |
---|---|
static Topic<FindModelListener> |
FIND_MODEL_TOPIC |
Constructor and Description |
---|
FindManager() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
canFindUsages(PsiElement element)
Checks if the Find Usages action is available for the specified element.
|
abstract void |
clearFindingNextUsageInFile()
Explicitly tell FindManager that "Find Next" and "Find Previous" actions should not use
find usages previous results.
|
abstract FindModel |
createReplaceInFileModel() |
abstract boolean |
findNextUsageInEditor(Editor editor)
Performs a "Find Next" operation after "Find Usages in File" or
"Highlight Usages in File".
|
abstract boolean |
findNextUsageInEditor(FileEditor editor)
Deprecated.
please use
findNextUsageInEditor(Editor) |
abstract boolean |
findPreviousUsageInEditor(Editor editor)
Performs a "Find Previous" operation after "Find Usages in File" or
"Highlight Usages in File".
|
abstract boolean |
findPreviousUsageInEditor(FileEditor editor)
Deprecated.
please use
findPreviousUsageInEditor(Editor) |
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 FindResult |
findString(java.lang.CharSequence text,
int offset,
FindModel model,
VirtualFile findContextFile)
Searches for the specified substring in the specified character sequence,
using the specified find settings.
|
abstract void |
findUsages(PsiElement element)
Performs the Find Usages operation for the specified element.
|
abstract void |
findUsages(PsiElement element,
boolean showDialog)
Shows the Find Usages dialog (if
showDialog is true} 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 void |
findUsagesInScope(PsiElement element,
SearchScope searchScope) |
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.
|
abstract FindModel |
getFindNextModel(Editor editor)
Gets the model containing the search settings to use for "Find Next" and
"Find Previous" operations specific for the editor given.
|
static FindManager |
getInstance(Project project)
Returns the find manager instance for the specified project.
|
abstract FindModel |
getPreviousFindModel() |
abstract java.lang.String |
getStringToReplace(java.lang.String foundString,
FindModel model,
int startOffset,
java.lang.CharSequence documentText)
Gets the string to replace with, given the specified found string and find/replace
settings.
|
abstract boolean |
selectNextOccurrenceWasPerformed()
Gets the flag indicating that 'Add Selection for Next Occurrence' action was performed recently,
so "Find Next" and "Find Previous" actions should work in its context.
|
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 void |
setPreviousFindModel(FindModel previousFindModel) |
abstract void |
setSelectNextOccurrenceWasPerformed()
Sets the flag indicating that 'Add Selection for Next Occurrence' action was performed recently,
so "Find Next" and "Find Previous" actions should work in its context.
|
abstract void |
showFindDialog(FindModel model,
java.lang.Runnable okHandler)
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 |
showMalformedReplacementPrompt(FindModel model,
java.lang.String title,
FindManager.MalformedReplacementStringException exception)
Shows a replace prompt dialog for the bad replace operation.
|
abstract int |
showPromptDialog(FindModel model,
java.lang.String title)
Shows a replace prompt dialog for the specified replace operation.
|
abstract void |
showSettingsAndFindUsages(NavigationItem [] targets) |
public static final Topic<FindModelListener> FIND_MODEL_TOPIC
public abstract FindModel createReplaceInFileModel()
public abstract FindModel getPreviousFindModel()
public abstract void setPreviousFindModel(FindModel previousFindModel)
public abstract void showSettingsAndFindUsages(NavigationItem [] targets)
public static FindManager getInstance(Project project)
project
- the project for which the manager is requested.public abstract void showFindDialog(FindModel model, java.lang.Runnable okHandler)
model
- the model containing the settings of a find or replace operation.okHandler
- Will be executed after doOkActionpublic abstract int showPromptDialog(FindModel model, java.lang.String title)
model
- the model containing the settings of the replace operation.title
- the title of the dialog to show.FindManager.PromptResult
interface.public abstract FindModel getFindInFileModel()
public abstract FindModel getFindInProjectModel()
public abstract FindResult findString(java.lang.CharSequence text, int offset, FindModel model)
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.public abstract FindResult findString(java.lang.CharSequence text, int offset, FindModel model, VirtualFile findContextFile)
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.public abstract int showMalformedReplacementPrompt(FindModel model, java.lang.String title, FindManager.MalformedReplacementStringException exception)
model
- the model containing the settings of the replace operation.title
- the title of the dialog to show.exception
- exception from getStringToReplace(String, FindModel, int, CharSequence)
FindManager.PromptResult
interface. May be only FindManager.PromptResult.CANCEL
or FindManager.PromptResult.SKIP
for bad replace operationpublic abstract java.lang.String getStringToReplace(java.lang.String foundString, FindModel model, int startOffset, java.lang.CharSequence documentText) throws FindManager.MalformedReplacementStringException
foundString
- the found string.model
- the search and replace settings, including the replace string.startOffset
- offset in the source text at which the string was found (matters for regex searches)documentText
- source text in which the string was found (matters for regex searches)FindManager.MalformedReplacementStringException
public abstract boolean findWasPerformed()
true
if the actions are available, false
if there is no previous search
operation to continue.public abstract void setFindWasPerformed()
public abstract boolean selectNextOccurrenceWasPerformed()
public abstract void setSelectNextOccurrenceWasPerformed()
public abstract void clearFindingNextUsageInFile()
public abstract void setFindNextModel(FindModel model)
model
- the model to use for the operations.public abstract FindModel getFindNextModel()
public abstract FindModel getFindNextModel(Editor editor)
getFindNextModel()
if there is find bar currently shown for the editor.editor
- editor, for which find model shall be retreived forpublic abstract boolean canFindUsages(PsiElement element)
element
- the element to check the availability for.true
if Find Usages is available, false
otherwise.FindUsagesProvider.canFindUsagesFor(PsiElement)
public abstract void findUsages(PsiElement element)
element
- the element to find the usages for.public abstract void findUsagesInScope(PsiElement element, SearchScope searchScope)
public abstract void findUsages(PsiElement element, boolean showDialog)
showDialog
is true} and performs the Find Usages operation for the
specified element.element
- the element to find the usages for.showDialog
- true if find usages settings dialog needs to be shown.public abstract void findUsagesInEditor(PsiElement element, FileEditor editor)
element
- the element for which the find is performed.editor
- the editor in which the find is performed.@Deprecated public abstract boolean findNextUsageInEditor(FileEditor editor)
findNextUsageInEditor(Editor)
public abstract boolean findNextUsageInEditor(Editor editor)
editor
- the editor in which the find is performed.true
if the operation was performed (not necessarily found anything),
false
if an error occurred during the operation.@Deprecated public abstract boolean findPreviousUsageInEditor(FileEditor editor)
findPreviousUsageInEditor(Editor)
public abstract boolean findPreviousUsageInEditor(Editor editor)
editor
- the editor in which the find is performed.true
if the operation was performed (not necessarily found anything),
false
if an error occurred during the operation.