use of jadx.api.CodePosition in project jadx by skylot.
the class CodeUsageInfo method processClass.
public void processClass(JavaClass javaClass, CodeLinesInfo linesInfo, List<StringRef> lines) {
Map<CodePosition, JavaNode> usage = javaClass.getUsageMap();
for (Map.Entry<CodePosition, JavaNode> entry : usage.entrySet()) {
CodePosition codePosition = entry.getKey();
JavaNode javaNode = entry.getValue();
addUsage(nodeCache.makeFrom(javaNode), javaClass, linesInfo, codePosition, lines);
}
}
use of jadx.api.CodePosition in project jadx by skylot.
the class CodeArea method getDefPosition.
static Position getDefPosition(JClass jCls, RSyntaxTextArea textArea, int offset) {
JavaNode node = getJavaNodeAtOffset(jCls, textArea, offset);
if (node == null) {
return null;
}
CodePosition pos = jCls.getCls().getDefinitionPosition(node);
if (pos == null) {
return null;
}
return new Position(pos);
}
use of jadx.api.CodePosition in project jadx by skylot.
the class CodeWriter method finish.
public void finish() {
removeFirstEmptyLine();
buf.trimToSize();
code = buf.toString();
buf = null;
Iterator<Map.Entry<CodePosition, Object>> it = annotations.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<CodePosition, Object> entry = it.next();
Object v = entry.getValue();
if (v instanceof DefinitionWrapper) {
LineAttrNode l = ((DefinitionWrapper) v).getNode();
l.setDecompiledLine(entry.getKey().getLine());
it.remove();
}
}
}
use of jadx.api.CodePosition in project jadx by skylot.
the class AnnotatedCodeWriter method attachDefinition.
@Override
public void attachDefinition(ILineAttributeNode obj) {
if (obj == null) {
return;
}
attachAnnotation(obj);
attachAnnotation(new DefinitionWrapper(obj), new CodePosition(line, offset, getLength()));
}
use of jadx.api.CodePosition in project jadx by skylot.
the class UsageDialog method processUsageClass.
private void processUsageClass(JavaNode usageNode) {
JavaClass cls = usageNode.getTopParentClass();
String code = cls.getCodeInfo().getCodeStr();
CodeLinesInfo linesInfo = new CodeLinesInfo(cls);
List<? extends JavaNode> targetNodes = getMethodWithOverride();
for (JavaNode javaNode : targetNodes) {
List<CodePosition> usage = cls.getUsageFor(javaNode);
for (CodePosition pos : usage) {
if (javaNode.getTopParentClass().equals(cls) && pos.getPos() == javaNode.getDefPos()) {
// skip declaration
continue;
}
StringRef line = getLineStrAt(code, pos.getPos());
if (line.startsWith("import ")) {
continue;
}
JavaNode javaNodeByLine = linesInfo.getJavaNodeByLine(pos.getLine());
JNode useAtNode = javaNodeByLine == null ? node : getNodeCache().makeFrom(javaNodeByLine);
usageList.add(new CodeNode(useAtNode, line, pos.getLine(), pos.getPos()));
}
}
}
Aggregations