Search in sources :

Example 1 with JResource

use of jadx.gui.treemodel.JResource in project jadx by skylot.

the class TabbedPane method makeContentPanel.

@Nullable
private ContentPanel makeContentPanel(JNode node) {
    if (node instanceof JResource) {
        JResource res = (JResource) node;
        ResourceFile resFile = res.getResFile();
        if (resFile != null) {
            if (resFile.getType() == ResourceType.IMG) {
                return new ImagePanel(this, res);
            }
        } else {
            return null;
        }
    }
    return new CodePanel(this, node);
}
Also used : ResourceFile(jadx.api.ResourceFile) JResource(jadx.gui.treemodel.JResource) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with JResource

use of jadx.gui.treemodel.JResource in project jadx by skylot.

the class MainWindow method treeClickAction.

private void treeClickAction() {
    try {
        Object obj = tree.getLastSelectedPathComponent();
        if (obj instanceof JResource) {
            JResource res = (JResource) obj;
            ResourceFile resFile = res.getResFile();
            if (resFile != null && JResource.isSupportedForView(resFile.getType())) {
                tabbedPane.showResource(res);
            }
        } else if (obj instanceof JNode) {
            JNode node = (JNode) obj;
            JClass cls = node.getRootClass();
            if (cls != null) {
                tabbedPane.codeJump(new Position(cls, node.getLine()));
            }
        }
    } catch (Exception e) {
        LOG.error("Content loading error", e);
    }
}
Also used : ResourceFile(jadx.api.ResourceFile) Position(jadx.gui.utils.Position) JResource(jadx.gui.treemodel.JResource) JClass(jadx.gui.treemodel.JClass) CacheObject(jadx.gui.utils.CacheObject) JNode(jadx.gui.treemodel.JNode) ExpandVetoException(javax.swing.tree.ExpandVetoException)

Aggregations

ResourceFile (jadx.api.ResourceFile)2 JResource (jadx.gui.treemodel.JResource)2 JClass (jadx.gui.treemodel.JClass)1 JNode (jadx.gui.treemodel.JNode)1 CacheObject (jadx.gui.utils.CacheObject)1 Position (jadx.gui.utils.Position)1 ExpandVetoException (javax.swing.tree.ExpandVetoException)1 Nullable (org.jetbrains.annotations.Nullable)1