Search in sources :

Example 1 with TextSearchIndex

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

the class BackgroundWorker method doInBackground.

@Override
protected Void doInBackground() throws Exception {
    try {
        System.gc();
        LOG.debug("Memory usage: Before decompile: {}", Utils.memoryInfo());
        runJob(cache.getDecompileJob());
        LOG.debug("Memory usage: Before index: {}", Utils.memoryInfo());
        runJob(cache.getIndexJob());
        LOG.debug("Memory usage: After index: {}", Utils.memoryInfo());
        System.gc();
        LOG.debug("Memory usage: After gc: {}", Utils.memoryInfo());
        TextSearchIndex searchIndex = cache.getTextIndex();
        if (searchIndex != null && searchIndex.getSkippedCount() > 0) {
            LOG.warn("Indexing of some classes skipped, count: {}, low memory: {}", searchIndex.getSkippedCount(), Utils.memoryInfo());
        }
    } catch (Exception e) {
        LOG.error("Exception in background worker", e);
    }
    return null;
}
Also used : TextSearchIndex(jadx.gui.utils.search.TextSearchIndex)

Example 2 with TextSearchIndex

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

the class IndexService method remove.

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

Example 3 with TextSearchIndex

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

the class IndexService method indexCls.

/**
 * Warning! Not ready for parallel execution. Use only in a single thread.
 */
public boolean indexCls(JavaClass cls) {
    try {
        TextSearchIndex index = cache.getTextIndex();
        if (index == null) {
            return false;
        }
        // get code from cache to avoid decompilation here
        String code = getCodeFromCache(cls);
        if (code == null) {
            return cls.isNoCode();
        }
        List<StringRef> lines = splitLines(code);
        CodeLinesInfo linesInfo = new CodeLinesInfo(cls);
        index.indexCode(cls, linesInfo, lines);
        index.indexNames(cls);
        indexSet.add(cls);
        return true;
    } catch (Exception e) {
        LOG.error("Index error in class: {}", cls.getFullName(), e);
        return false;
    }
}
Also used : TextSearchIndex(jadx.gui.utils.search.TextSearchIndex) StringRef(jadx.gui.utils.search.StringRef) CodeLinesInfo(jadx.gui.utils.CodeLinesInfo)

Example 4 with TextSearchIndex

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

the class IndexService method indexResources.

public void indexResources() {
    TextSearchIndex index = cache.getTextIndex();
    index.indexResource();
}
Also used : TextSearchIndex(jadx.gui.utils.search.TextSearchIndex)

Example 5 with TextSearchIndex

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

the class CommonSearchDialog method loadFinishedCommon.

void loadFinishedCommon() {
    setCursor(null);
    progressPane.setVisible(false);
    TextSearchIndex textIndex = cache.getTextIndex();
    if (textIndex == null) {
        warnLabel.setText(NLS.str("msg.index_not_initialized"));
        warnLabel.setVisible(true);
    }
}
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