use of jadx.gui.utils.JumpPosition in project jadx by skylot.
the class TextSearchIndex method buildSearch.
public Flowable<JNode> buildSearch(String text, Set<SearchDialog.SearchOptions> options) throws SearchSettings.InvalidSearchTermException {
boolean ignoreCase = options.contains(IGNORE_CASE);
boolean useRegex = options.contains(USE_REGEX);
LOG.debug("Building search, ignoreCase: {}, useRegex: {}", ignoreCase, useRegex);
Flowable<JNode> result = Flowable.empty();
SearchSettings searchSettings = new SearchSettings(text, options.contains(IGNORE_CASE), options.contains(USE_REGEX));
if (options.contains(ACTIVE_TAB)) {
JumpPosition activeNode = mainWindow.getTabbedPane().getCurrentPosition();
if (activeNode != null) {
searchSettings.setActiveCls(activeNode.getNode().getRootClass());
}
if (searchSettings.getActiveCls() == null) {
return result;
}
}
if (!searchSettings.preCompile()) {
return result;
}
if (options.contains(COMMENT)) {
CommentsIndex commentsIndex = cache.getCommentsIndex();
result = Flowable.concat(result, commentsIndex.search(searchSettings));
if (text.isEmpty()) {
// other searches don't support empty string, so return immediately
return result;
}
}
if (options.contains(CLASS)) {
result = Flowable.concat(result, clsNamesIndex.search(searchSettings));
}
if (options.contains(METHOD)) {
result = Flowable.concat(result, mthSignaturesIndex.search(searchSettings));
}
if (options.contains(FIELD)) {
result = Flowable.concat(result, fldSignaturesIndex.search(searchSettings));
}
if (options.contains(CODE)) {
if (codeIndex.size() > 0) {
result = Flowable.concat(result, codeIndex.search(searchSettings));
}
if (!skippedClasses.isEmpty()) {
result = Flowable.concat(result, searchInSkippedClasses(searchSettings));
}
}
if (options.contains(RESOURCE)) {
result = Flowable.concat(result, resIndex.search(searchSettings));
}
return result;
}
use of jadx.gui.utils.JumpPosition in project jadx by skylot.
the class MainWindow method nodeClickAction.
private boolean nodeClickAction(@Nullable Object obj) {
if (obj == null) {
return false;
}
try {
if (obj instanceof JResource) {
JResource res = (JResource) obj;
ResourceFile resFile = res.getResFile();
if (resFile != null && JResource.isSupportedForView(resFile.getType())) {
return tabbedPane.showNode(res);
}
} else if (obj instanceof JNode) {
JNode node = (JNode) obj;
if (node.getRootClass() != null) {
tabbedPane.codeJump(new JumpPosition(node));
return true;
}
return tabbedPane.showNode(node);
}
} catch (Exception e) {
LOG.error("Content loading error", e);
}
return false;
}
use of jadx.gui.utils.JumpPosition in project jadx by skylot.
the class CodeArea method getDefPosForNodeAtOffset.
/**
* Search node by offset in {@code jCls} code and return its definition position
* (useful for jumps from usage)
*/
@Nullable
public JumpPosition getDefPosForNodeAtOffset(int offset) {
if (offset == -1) {
return null;
}
JavaNode foundNode = getJavaNodeAtOffset(offset);
if (foundNode == null) {
return null;
}
CodePosition pos = getDecompiler().getDefinitionPosition(foundNode);
if (pos == null) {
return null;
}
JNode jNode = convertJavaNode(foundNode);
return new JumpPosition(jNode.getRootClass(), pos);
}
Aggregations