Package ghidra.features.base.replace
Class SearchAndReplaceQuery
java.lang.Object
ghidra.features.base.replace.SearchAndReplaceQuery
Immutable class for storing all related query information for performing a search and
replace operation. It includes the search pattern, the search pattern text, the search lmiit,
and the types of program elements to search.
-
Constructor Summary
ConstructorsConstructorDescriptionSearchAndReplaceQuery
(String searchText, String replacementText, Set<SearchType> searchTypes, boolean isRegEx, boolean isCaseSensitive, boolean isWholeWord, int searchLimit) Constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsSearchType
(SearchType searchType) Returns true if the given SearchType is to be included in the search.void
findAll
(Program program, Accumulator<QuickFix> accumulator, TaskMonitor monitor) Method to initiate the search.Returns the replacement text that will replace matched elements.int
Returns the maximum number of search matches to be found before stopping early.Returns the searchPattern
used to search program elements.Returns the search text used to generate the pattern for this query.Returns a set of all the SearchTypes to be included in this query.
-
Constructor Details
-
SearchAndReplaceQuery
public SearchAndReplaceQuery(String searchText, String replacementText, Set<SearchType> searchTypes, boolean isRegEx, boolean isCaseSensitive, boolean isWholeWord, int searchLimit) Constructor- Parameters:
searchText
- the user entered search pattern text. It will be used to generate the actual Pattern based on the various options.replacementText
- the user entered replacement text.searchTypes
- the types of program elements to searchisRegEx
- true if the given search text is to be interpreted as a regular expression.isCaseSensitive
- true if the search text should be case sensitiveisWholeWord
- true, the search text should match the enter element in the case of a rename, or an entire word within a larger sentence in the case of a comment.searchLimit
- the maximum entries to find before terminating the search.
-
-
Method Details
-
findAll
public void findAll(Program program, Accumulator<QuickFix> accumulator, TaskMonitor monitor) throws CancelledException Method to initiate the search.- Parameters:
program
- the program to searchaccumulator
- the accumulator to store the generatedQuickFix
smonitor
- theTaskMonitor
- Throws:
CancelledException
- if the search is cancelled.
-
getSearchPattern
Returns the searchPattern
used to search program elements.- Returns:
- the search
Pattern
used to search program elements
-
containsSearchType
Returns true if the given SearchType is to be included in the search.- Parameters:
searchType
- the SearchType to check if it is included in the search- Returns:
- true if the given SearchType is to be included in the search.
-
getSearchText
Returns the search text used to generate the pattern for this query.- Returns:
- the search text used to generate the pattern for this query
-
getReplacementText
Returns the replacement text that will replace matched elements.- Returns:
- the replacement text that will replace matched elements
-
getSelectedSearchTypes
Returns a set of all the SearchTypes to be included in this query.- Returns:
- a set of all the SearchTypes to be included in this query
-
getSearchLimit
public int getSearchLimit()Returns the maximum number of search matches to be found before stopping early.- Returns:
- the maximum number of search matches to be found before stopping early.
-