Class SearchAndReplaceHandler

java.lang.Object
ghidra.features.base.replace.SearchAndReplaceHandler
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
DatatypeCategorySearchAndReplaceHandler, DataTypesSearchAndReplaceHandler, ListingCommentsSearchAndReplaceHandler, MemoryBlockSearchAndReplaceHandler, ProgramTreeSearchAndReplaceHandler, SymbolsSearchAndReplaceHandler

public abstract class SearchAndReplaceHandler extends Object implements ExtensionPoint
Base class for discoverable SearchAndReplaceHandlers. A SearchAndReplaceHandler is responsible for searching one or more specific program elements (referred to as SearchType) for a given search pattern and generating the appropriate QuickFix.

Typically, one handler will handle related search elements for efficiency. For example, the DataTypesSearchAndReplaceHandler is responsible for datatype names, field names, field comments, etc. The idea is to only loop through all the datatypes once, regardless of what aspect of a datatype you are searching for.

  • Constructor Details

    • SearchAndReplaceHandler

      public SearchAndReplaceHandler()
  • Method Details

    • findAll

      public abstract void findAll(Program program, SearchAndReplaceQuery query, Accumulator<QuickFix> accumulator, TaskMonitor monitor) throws CancelledException
      Method to perform the search for the pattern and options as specified by the given SearchAndReplaceQuery. As matches are found, appropriate QuickFixs are added to the given accumulator.
      Parameters:
      program - the program being searched
      query - contains the search pattern, replacement pattern, and options related to the query.
      accumulator - the accumulator that resulting QuickFix items are added to as they are found.
      monitor - a TaskMonitor for reporting progress and checking if the search has been cancelled.
      Throws:
      CancelledException - thrown if the operation has been cancelled via the taskmonitor
    • getSearchAndReplaceTypes

      public Set<SearchType> getSearchAndReplaceTypes()
      Returns the set of SearchTypes this handler supports.
      Returns:
      the set of SearchTypes this handler supports.
    • addType

      protected void addType(SearchType type)