Search in sources :

Example 1 with RenameVisitor

use of jadx.core.dex.visitors.rename.RenameVisitor in project jadx by skylot.

the class Jadx method getPreDecompilePassesList.

public static List<IDexTreeVisitor> getPreDecompilePassesList() {
    List<IDexTreeVisitor> passes = new ArrayList<>();
    passes.add(new SignatureProcessor());
    passes.add(new OverrideMethodVisitor());
    passes.add(new RenameVisitor());
    passes.add(new UsageInfoVisitor());
    passes.add(new ProcessAnonymous());
    passes.add(new ProcessMethodsForInline());
    return passes;
}
Also used : IDexTreeVisitor(jadx.core.dex.visitors.IDexTreeVisitor) SignatureProcessor(jadx.core.dex.visitors.SignatureProcessor) UsageInfoVisitor(jadx.core.dex.visitors.usage.UsageInfoVisitor) ProcessMethodsForInline(jadx.core.dex.visitors.ProcessMethodsForInline) ArrayList(java.util.ArrayList) ProcessAnonymous(jadx.core.dex.visitors.ProcessAnonymous) CodeRenameVisitor(jadx.core.dex.visitors.rename.CodeRenameVisitor) RenameVisitor(jadx.core.dex.visitors.rename.RenameVisitor) OverrideMethodVisitor(jadx.core.dex.visitors.OverrideMethodVisitor)

Example 2 with RenameVisitor

use of jadx.core.dex.visitors.rename.RenameVisitor in project jadx by skylot.

the class RenameDialog method refreshState.

private void refreshState() {
    RootNode rootNode = mainWindow.getWrapper().getDecompiler().getRoot();
    new RenameVisitor().init(rootNode);
    JNodeCache nodeCache = cache.getNodeCache();
    JavaNode javaNode = node.getJavaNode();
    List<JavaNode> toUpdate = new ArrayList<>();
    if (source != null && source != node) {
        toUpdate.add(source.getJavaNode());
    }
    if (javaNode != null) {
        toUpdate.add(javaNode);
        toUpdate.addAll(javaNode.getUseIn());
        if (node instanceof JMethod) {
            toUpdate.addAll(((JMethod) node).getJavaMethod().getOverrideRelatedMethods());
        }
    } else if (node instanceof JPackage) {
        processPackage(toUpdate);
    } else {
        throw new JadxRuntimeException("Unexpected node type: " + node);
    }
    Set<JClass> updatedTopClasses = toUpdate.stream().map(JavaNode::getTopParentClass).map(nodeCache::makeFrom).filter(Objects::nonNull).collect(Collectors.toSet());
    LOG.debug("Classes to update: {}", updatedTopClasses);
    refreshTabs(mainWindow.getTabbedPane(), updatedTopClasses);
    if (!updatedTopClasses.isEmpty()) {
        mainWindow.getBackgroundExecutor().execute("Refreshing", () -> refreshClasses(updatedTopClasses), (status) -> {
            if (status == TaskStatus.CANCEL_BY_MEMORY) {
                mainWindow.showHeapUsageBar();
                UiUtils.errorMessage(this, NLS.str("message.memoryLow"));
            }
            if (node instanceof JPackage) {
                mainWindow.getTreeRoot().update();
            }
            mainWindow.reloadTree();
        });
    }
}
Also used : RootNode(jadx.core.dex.nodes.RootNode) JClass(jadx.gui.treemodel.JClass) ArrayList(java.util.ArrayList) JPackage(jadx.gui.treemodel.JPackage) JadxRuntimeException(jadx.core.utils.exceptions.JadxRuntimeException) RenameVisitor(jadx.core.dex.visitors.rename.RenameVisitor) JNodeCache(jadx.gui.utils.JNodeCache) JMethod(jadx.gui.treemodel.JMethod) JavaNode(jadx.api.JavaNode)

Aggregations

RenameVisitor (jadx.core.dex.visitors.rename.RenameVisitor)2 ArrayList (java.util.ArrayList)2 JavaNode (jadx.api.JavaNode)1 RootNode (jadx.core.dex.nodes.RootNode)1 IDexTreeVisitor (jadx.core.dex.visitors.IDexTreeVisitor)1 OverrideMethodVisitor (jadx.core.dex.visitors.OverrideMethodVisitor)1 ProcessAnonymous (jadx.core.dex.visitors.ProcessAnonymous)1 ProcessMethodsForInline (jadx.core.dex.visitors.ProcessMethodsForInline)1 SignatureProcessor (jadx.core.dex.visitors.SignatureProcessor)1 CodeRenameVisitor (jadx.core.dex.visitors.rename.CodeRenameVisitor)1 UsageInfoVisitor (jadx.core.dex.visitors.usage.UsageInfoVisitor)1 JadxRuntimeException (jadx.core.utils.exceptions.JadxRuntimeException)1 JClass (jadx.gui.treemodel.JClass)1 JMethod (jadx.gui.treemodel.JMethod)1 JPackage (jadx.gui.treemodel.JPackage)1 JNodeCache (jadx.gui.utils.JNodeCache)1