@Override
	public void taskCompleted(Task task) {
		if (tool == null || navigatable == null) {
			return; // user either exited the tool, or closed the program
		}

		searchDialog.setStatusText("");
		SearchTask searchTask = (SearchTask) task;
		Navigatable searchNavigatable = ((SearchTask) task).getNavigatable();
		Program program = ((SearchTask) task).getProgram();
		if (searchNavigatable.getProgram() == null || searchNavigatable.isDisposed()) {
			return;
		}

		TextSearchResult result = searchTask.getSearchLocation();
		Searcher textSearcher = searchTask.getTextSearcher();
		SearchOptions searchOptions = textSearcher.getSearchOptions();
		if (result == null) {
			searchDialog.setStatusText("Not found");
		}
		else if (result.programLocation().equals(currentLocation)) {
			searchNext(searchTask.getProgram(), searchNavigatable, textSearcher);
		}
		else {
			searchDialog.setStatusText("");
			ProgramLocation loc = result.programLocation();
			if (goToService.goTo(searchNavigatable, loc, program)) {
				new SearchTextHighlightProvider(searchNavigatable, searchOptions, null, program,
					result);
			}
		}

		lastSearchedText = searchOptions.getText();
		if (task == currentTask) {
			currentTask = null;
		}
	}
The constructor for the SearchTextPlugin.

@param plugintool The tool required by this plugin.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java