Search in sources :

Example 6 with TextSearchIndex

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

the class SearchDialog method performSearch.

private synchronized void performSearch() {
    resultsModel.clear();
    String text = searchField.getText();
    if (text == null || text.isEmpty() || options.isEmpty()) {
        resultsTable.updateTable();
        return;
    }
    cache.setLastSearch(text);
    TextSearchIndex index = cache.getTextIndex();
    if (index == null) {
        resultsTable.updateTable();
        return;
    }
    if (options.contains(SearchOptions.CLASS)) {
        resultsModel.addAll(index.searchClsName(text));
    }
    if (options.contains(SearchOptions.METHOD)) {
        resultsModel.addAll(index.searchMthName(text));
    }
    if (options.contains(SearchOptions.FIELD)) {
        resultsModel.addAll(index.searchFldName(text));
    }
    if (options.contains(SearchOptions.CODE)) {
        resultsModel.addAll(index.searchCode(text));
    }
    highlightText = text;
    resultsTable.updateTable();
}
Also used : TextSearchIndex(jadx.gui.utils.search.TextSearchIndex)

Example 7 with TextSearchIndex

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

the class IndexJob method runJob.

protected void runJob() {
    JNodeCache nodeCache = cache.getNodeCache();
    final TextSearchIndex index = new TextSearchIndex(nodeCache);
    final CodeUsageInfo usageInfo = new CodeUsageInfo(nodeCache);
    cache.setTextIndex(index);
    cache.setUsageInfo(usageInfo);
    for (final JavaClass cls : wrapper.getClasses()) {
        addTask(new Runnable() {

            @Override
            public void run() {
                try {
                    index.indexNames(cls);
                    CodeLinesInfo linesInfo = new CodeLinesInfo(cls);
                    List<StringRef> lines = splitLines(cls);
                    usageInfo.processClass(cls, linesInfo, lines);
                    if (Utils.isFreeMemoryAvailable()) {
                        index.indexCode(cls, linesInfo, lines);
                    } else {
                        index.classCodeIndexSkipped(cls);
                    }
                } catch (Exception e) {
                    LOG.error("Index error in class: {}", cls.getFullName(), e);
                }
            }
        });
    }
}
Also used : CodeUsageInfo(jadx.gui.utils.CodeUsageInfo) JavaClass(jadx.api.JavaClass) List(java.util.List) JNodeCache(jadx.gui.utils.JNodeCache) TextSearchIndex(jadx.gui.utils.search.TextSearchIndex) CodeLinesInfo(jadx.gui.utils.CodeLinesInfo)

Example 8 with TextSearchIndex

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

the class CommonSearchDialog method loadFinishedCommon.

private void loadFinishedCommon() {
    setCursor(null);
    resultsTable.setEnabled(true);
    progressPane.setVisible(false);
    TextSearchIndex textIndex = cache.getTextIndex();
    if (textIndex == null) {
        warnLabel.setText("Index not initialized, search will be disabled!");
        warnLabel.setVisible(true);
    }
}
Also used : TextSearchIndex(jadx.gui.utils.search.TextSearchIndex)

Example 9 with TextSearchIndex

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

the class MainWindow method resetCache.

protected void resetCache() {
    cacheObject.reset();
    cacheObject.setJRoot(treeRoot);
    cacheObject.setJadxSettings(settings);
    cacheObject.setIndexService(new IndexService(cacheObject));
    cacheObject.setTextIndex(new TextSearchIndex(this));
}
Also used : IndexService(jadx.gui.jobs.IndexService) TextSearchIndex(jadx.gui.utils.search.TextSearchIndex)

Example 10 with TextSearchIndex

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

the class IndexService method refreshIndex.

public synchronized void refreshIndex(JavaClass cls) {
    TextSearchIndex index = cache.getTextIndex();
    if (index == null) {
        return;
    }
    indexSet.remove(cls);
    index.remove(cls);
    indexCls(cls);
}
Also used : TextSearchIndex(jadx.gui.utils.search.TextSearchIndex)

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