use of jadx.gui.treemodel.JResSearchNode in project jadx by skylot.
the class CommonSearchDialog method openSelectedItem.
protected void openSelectedItem() {
JNode node = getSelectedNode();
if (node == null) {
return;
}
JumpPosition jmpPos;
if (node instanceof JResSearchNode) {
jmpPos = new JumpPosition(((JResSearchNode) node).getResNode(), node.getLine(), node.getPos());
} else {
jmpPos = new JumpPosition(node.getRootClass(), node.getLine(), node.getPos());
}
tabbedPane.codeJump(jmpPos);
if (!mainWindow.getSettings().getKeepCommonDialogOpen()) {
dispose();
}
}
use of jadx.gui.treemodel.JResSearchNode in project jadx by skylot.
the class ResourceIndex method search.
private void search(final JResource resNode, FlowableEmitter<JResSearchNode> emitter, SearchSettings searchSettings) {
int line = 0;
int lastPos = 0;
int lastLineOccurred = -1;
JResSearchNode lastNode = null;
int searchStrLen = searchSettings.getSearchString().length();
String content;
try {
content = resNode.getContent();
} catch (Exception e) {
LOG.error("Error load resource node content", e);
return;
}
do {
searchSettings.setStartPos(lastPos);
int pos = searchSettings.find(content);
if (pos > -1) {
line += countLinesByPos(content, pos, lastPos);
lastPos = pos + searchStrLen;
String lineText = getLine(content, pos, lastPos);
if (lastLineOccurred != line) {
lastLineOccurred = line;
if (lastNode != null) {
emitter.onNext(lastNode);
}
lastNode = new JResSearchNode(resNode, lineText.trim(), line + 1, pos);
}
} else {
if (lastNode != null) {
// commit the final result node.
emitter.onNext(lastNode);
}
break;
}
} while (!emitter.isCancelled() && lastPos < content.length());
}
Aggregations