Search in sources :

Example 11 with TextSearchIndex

use of jadx.gui.utils.search.TextSearchIndex in project jadx by skylot.

the class SearchDialog method prepareSearch.

private Flowable<JNode> prepareSearch(String text) {
    if (text == null || options.isEmpty()) {
        return Flowable.empty();
    }
    // allow empty text for comments search
    if (text.isEmpty() && !options.contains(SearchOptions.COMMENT)) {
        return Flowable.empty();
    }
    TextSearchIndex index = checkIndex();
    if (index == null) {
        return Flowable.empty();
    }
    LOG.debug("search event: {}", text);
    showSearchState();
    try {
        Flowable<JNode> result = index.buildSearch(text, options);
        if (searchField.getBackground() == SEARCHFIELD_ERROR_COLOR) {
            searchField.setBackground(searchFieldDefaultBgColor);
        }
        return result;
    } catch (SearchSettings.InvalidSearchTermException e) {
        searchField.setBackground(SEARCHFIELD_ERROR_COLOR);
        return Flowable.empty();
    }
}
Also used : SearchSettings(jadx.gui.utils.search.SearchSettings) TextSearchIndex(jadx.gui.utils.search.TextSearchIndex) JNode(jadx.gui.treemodel.JNode)

Aggregations

TextSearchIndex (jadx.gui.utils.search.TextSearchIndex)11 CodeLinesInfo (jadx.gui.utils.CodeLinesInfo)2 JavaClass (jadx.api.JavaClass)1 IndexService (jadx.gui.jobs.IndexService)1 JNode (jadx.gui.treemodel.JNode)1 CodeUsageInfo (jadx.gui.utils.CodeUsageInfo)1 JNodeCache (jadx.gui.utils.JNodeCache)1 SearchSettings (jadx.gui.utils.search.SearchSettings)1 StringRef (jadx.gui.utils.search.StringRef)1 List (java.util.List)1