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();
}
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);
}
}
});
}
}
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);
}
}
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));
}
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);
}
Aggregations