Class SearchResults

java.lang.Object
docking.widgets.search.SearchResults
Direct Known Subclasses:
TextComponentSearchResults

public abstract class SearchResults extends Object
A collection of SearchLocations created when the user has performed a find operation on the FindDialog. The dialog will find all results and then use the results to move to the next and previous locations as requested. The user may also choose to show all results in a table.

The searcher uses a worker queue to manage activating and deactivating highlights, which may require reload operations on the originally searched text.

  • Constructor Details

    • SearchResults

      protected SearchResults(Worker worker)
  • Method Details

    • getName

      public abstract String getName()
      Returns the name of this set of search results. This is a short description, such as a filename or function name. This should be null for text components that do not change contents based on some external source of data, such as a file.
      Returns:
      the name or null
    • activate

      public abstract void activate()
      Activates this set of search results. This will restore highlights to the source of the search.
    • deactivate

      public abstract void deactivate()
      Deactivates this set of search results. This will clear this results' highlights from the source of the search.
    • setActiveLocation

      public abstract void setActiveLocation(SearchLocation location)
      Sets the active location, which will be highlighted differently than the other search matches. This method will ensure that this search results object is active (see activate(). This method will also move the cursor to the given location.
      Parameters:
      location - the location
    • getActiveLocation

      public abstract SearchLocation getActiveLocation()
      Returns the active search location or null. The active location is typically the search location that contains the user's cursor..
      Returns:
      the active search location or null. The active location is typically the search location that contains the user's cursor.
    • getLocations

      public abstract List<SearchLocation> getLocations()
      Returns all search locations in this set of search results
      Returns:
      the location
    • isEmpty

      public abstract boolean isEmpty()
    • dispose

      public abstract void dispose()
    • getFilename

      protected String getFilename(URL url)
    • cancelAllJobsOfType

      protected void cancelAllJobsOfType(SearchResults.FindJob job)
      Clears all jobs that have the same class as the given job. Clients can call this method before submitting the given job to clear any other instances of that job type before running.
      Parameters:
      job - the job
    • runActivationJob

      protected void runActivationJob(SearchResults.ActivationJob job)
      Runs the given activation job. This class will cancel any existing activation jobs with the assumption that only one activation should be taking place at any given time. This is useful since activations may be slow.
      Parameters:
      job - the job
    • runJob

      protected void runJob(SearchResults.FindJob job)
      Schedules the given job to run. This does not cancel any other pending work.
      Parameters:
      job - the job