public final class FindManagerImpl extends FindManager
FindManager.MalformedReplacementStringException, FindManager.PromptResult, FindManager.PromptResultValue
FIND_MODEL_TOPIC
Constructor and Description |
---|
FindManagerImpl(Project project) |
Modifier and Type | Method and Description |
---|---|
boolean |
canFindUsages(PsiElement element)
Checks if the Find Usages action is available for the specified element.
|
void |
clearFindingNextUsageInFile()
Explicitly tell FindManager that "Find Next" and "Find Previous" actions should not use
find usages previous results.
|
FindModel |
createReplaceInFileModel() |
boolean |
findNextUsageInEditor(Editor editor)
Performs a "Find Next" operation after "Find Usages in File" or
"Highlight Usages in File".
|
boolean |
findNextUsageInEditor(FileEditor fileEditor) |
boolean |
findPreviousUsageInEditor(Editor editor)
Performs a "Find Previous" operation after "Find Usages in File" or
"Highlight Usages in File".
|
boolean |
findPreviousUsageInEditor(FileEditor fileEditor) |
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.
|
FindResult |
findString(java.lang.CharSequence text,
int offset,
FindModel model,
VirtualFile file)
Searches for the specified substring in the specified character sequence,
using the specified find settings.
|
void |
findUsages(PsiElement element)
Performs the Find Usages operation for the specified element.
|
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. |
void |
findUsagesInEditor(PsiElement element,
FileEditor fileEditor)
Performs a "Find Usages in File" operation for the specified element.
|
void |
findUsagesInScope(PsiElement element,
SearchScope searchScope) |
boolean |
findWasPerformed()
Gets the flag indicating whether the "Find Next" and "Find Previous" actions are
available to continue a previously started search operation.
|
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.
|
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.
|
FindModel |
getFindNextModel()
Gets the model containing the search settings to use for "Find Next" and
"Find Previous" operations.
|
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.
|
FindUsagesManager |
getFindUsagesManager() |
FindModel |
getPreviousFindModel() |
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.
|
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.
|
void |
setFindNextModel(FindModel findNextModel)
Sets the model containing the search settings to use for "Find Next" and
"Find Previous" operations.
|
void |
setFindWasPerformed()
Sets the flag indicating that the "Find Next" and "Find Previous" actions are
available to continue a previously started search operation.
|
void |
setPreviousFindModel(FindModel previousFindModel) |
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.
|
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.
|
int |
showMalformedReplacementPrompt(FindModel model,
java.lang.String title,
FindManager.MalformedReplacementStringException exception)
Shows a replace prompt dialog for the bad replace operation.
|
int |
showPromptDialog(FindModel model,
java.lang.String title)
Shows a replace prompt dialog for the specified replace operation.
|
void |
showSettingsAndFindUsages(NavigationItem [] targets) |
getInstance
public FindManagerImpl(Project project)
public FindModel createReplaceInFileModel()
createReplaceInFileModel
in class FindManager
public int showPromptDialog(FindModel model, java.lang.String title)
FindManager
showPromptDialog
in class FindManager
model
- the model containing the settings of the replace operation.title
- the title of the dialog to show.FindManager.PromptResult
interface.public void showFindDialog(FindModel model, java.lang.Runnable okHandler)
FindManager
showFindDialog
in class FindManager
model
- the model containing the settings of a find or replace operation.okHandler
- Will be executed after doOkActionpublic FindModel getFindInFileModel()
FindManager
getFindInFileModel
in class FindManager
public FindModel getFindInProjectModel()
FindManager
getFindInProjectModel
in class FindManager
public boolean findWasPerformed()
FindManager
findWasPerformed
in class FindManager
true
if the actions are available, false
if there is no previous search
operation to continue.public void setFindWasPerformed()
FindManager
setFindWasPerformed
in class FindManager
public boolean selectNextOccurrenceWasPerformed()
FindManager
selectNextOccurrenceWasPerformed
in class FindManager
public void setSelectNextOccurrenceWasPerformed()
FindManager
setSelectNextOccurrenceWasPerformed
in class FindManager
public FindModel getFindNextModel()
FindManager
getFindNextModel
in class FindManager
public FindModel getFindNextModel(Editor editor)
FindManager
FindManager.getFindNextModel()
if there is find bar currently shown for the editor.getFindNextModel
in class FindManager
editor
- editor, for which find model shall be retreived forpublic void setFindNextModel(FindModel findNextModel)
FindManager
setFindNextModel
in class FindManager
findNextModel
- the model to use for the operations.public FindResult findString(java.lang.CharSequence text, int offset, FindModel model)
FindManager
findString
in class FindManager
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 FindResult findString(java.lang.CharSequence text, int offset, FindModel model, VirtualFile file)
FindManager
findString
in class FindManager
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 int showMalformedReplacementPrompt(FindModel model, java.lang.String title, FindManager.MalformedReplacementStringException exception)
FindManager
showMalformedReplacementPrompt
in class FindManager
model
- the model containing the settings of the replace operation.title
- the title of the dialog to show.exception
- exception from FindManager.getStringToReplace(String, FindModel, int, CharSequence)
FindManager.PromptResult
interface. May be only FindManager.PromptResult.CANCEL
or FindManager.PromptResult.SKIP
for bad replace operationpublic FindModel getPreviousFindModel()
getPreviousFindModel
in class FindManager
public void setPreviousFindModel(FindModel previousFindModel)
setPreviousFindModel
in class FindManager
public java.lang.String getStringToReplace(java.lang.String foundString, FindModel model, int startOffset, java.lang.CharSequence documentText) throws FindManager.MalformedReplacementStringException
FindManager
getStringToReplace
in class FindManager
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 boolean canFindUsages(PsiElement element)
FindManager
canFindUsages
in class FindManager
element
- the element to check the availability for.true
if Find Usages is available, false
otherwise.FindUsagesProvider.canFindUsagesFor(PsiElement)
public void findUsages(PsiElement element)
FindManager
findUsages
in class FindManager
element
- the element to find the usages for.public void findUsagesInScope(PsiElement element, SearchScope searchScope)
findUsagesInScope
in class FindManager
public void findUsages(PsiElement element, boolean showDialog)
FindManager
showDialog
is true} and performs the Find Usages operation for the
specified element.findUsages
in class FindManager
element
- the element to find the usages for.showDialog
- true if find usages settings dialog needs to be shown.public void showSettingsAndFindUsages(NavigationItem [] targets)
showSettingsAndFindUsages
in class FindManager
public void clearFindingNextUsageInFile()
FindManager
clearFindingNextUsageInFile
in class FindManager
public void findUsagesInEditor(PsiElement element, FileEditor fileEditor)
FindManager
findUsagesInEditor
in class FindManager
element
- the element for which the find is performed.fileEditor
- the editor in which the find is performed.public boolean findNextUsageInEditor(FileEditor fileEditor)
findNextUsageInEditor
in class FindManager
public boolean findNextUsageInEditor(Editor editor)
FindManager
findNextUsageInEditor
in class FindManager
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.public boolean findPreviousUsageInEditor(Editor editor)
FindManager
findPreviousUsageInEditor
in class FindManager
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.public boolean findPreviousUsageInEditor(FileEditor fileEditor)
findPreviousUsageInEditor
in class FindManager
public FindUsagesManager getFindUsagesManager()