Search in sources :

Example 1 with JumpPosition

use of jadx.gui.utils.JumpPosition in project jadx by skylot.

the class TabbedPane method codeJump.

public void codeJump(JumpPosition pos) {
    JumpPosition curPos = getCurrentPosition();
    if (curPos != null) {
        jumps.addPosition(curPos);
        jumps.addPosition(pos);
    }
    showCode(pos);
}
Also used : JumpPosition(jadx.gui.utils.JumpPosition)

Example 2 with JumpPosition

use of jadx.gui.utils.JumpPosition in project jadx by skylot.

the class CodeArea method navToDecl.

@SuppressWarnings("deprecation")
private void navToDecl(Point point, CodeLinkGenerator codeLinkGenerator) {
    int offs = viewToModel(point);
    JumpPosition jump = codeLinkGenerator.getJumpLinkAtOffset(CodeArea.this, offs);
    if (jump != null) {
        contentPanel.getTabbedPane().codeJump(jump);
    }
}
Also used : JumpPosition(jadx.gui.utils.JumpPosition) Point(java.awt.Point)

Example 3 with JumpPosition

use of jadx.gui.utils.JumpPosition in project jadx by skylot.

the class CodeLinkGenerator method isLinkAtOffset.

@Override
public LinkGeneratorResult isLinkAtOffset(RSyntaxTextArea textArea, int offset) {
    try {
        if (jNode.getCodeInfo() == null) {
            return null;
        }
        int sourceOffset = getLinkSourceOffset(textArea, offset);
        if (sourceOffset == -1) {
            return null;
        }
        JumpPosition defPos = getJumpBySourceOffset(textArea, sourceOffset);
        if (defPos == null) {
            return null;
        }
        return new LinkGeneratorResult() {

            @Override
            public HyperlinkEvent execute() {
                return new HyperlinkEvent(defPos, HyperlinkEvent.EventType.ACTIVATED, null, defPos.getNode().makeLongString());
            }

            @Override
            public int getSourceOffset() {
                return sourceOffset;
            }
        };
    } catch (Exception e) {
        LOG.error("isLinkAtOffset error", e);
        return null;
    }
}
Also used : LinkGeneratorResult(org.fife.ui.rsyntaxtextarea.LinkGeneratorResult) HyperlinkEvent(javax.swing.event.HyperlinkEvent) JumpPosition(jadx.gui.utils.JumpPosition) BadLocationException(javax.swing.text.BadLocationException)

Example 4 with JumpPosition

use of jadx.gui.utils.JumpPosition in project jadx by skylot.

the class TabbedPane method smaliJump.

public void smaliJump(JClass cls, int pos, boolean debugMode) {
    ContentPanel panel = getOpenTabs().get(cls);
    if (panel == null) {
        showCode(new JumpPosition(cls, 0, 1));
        panel = getOpenTabs().get(cls);
        if (panel == null) {
            throw new JadxRuntimeException("Failed to open panel for JClass: " + cls);
        }
    } else {
        selectTab(panel);
    }
    ClassCodeContentPanel codePane = ((ClassCodeContentPanel) panel);
    codePane.showSmaliPane();
    SmaliArea smaliArea = (SmaliArea) codePane.getSmaliCodeArea();
    if (debugMode) {
        smaliArea.scrollToDebugPos(pos);
    }
    smaliArea.scrollToPos(pos);
    smaliArea.requestFocus();
}
Also used : JumpPosition(jadx.gui.utils.JumpPosition) JadxRuntimeException(jadx.core.utils.exceptions.JadxRuntimeException) ClassCodeContentPanel(jadx.gui.ui.codearea.ClassCodeContentPanel) AbstractCodeContentPanel(jadx.gui.ui.codearea.AbstractCodeContentPanel) ClassCodeContentPanel(jadx.gui.ui.codearea.ClassCodeContentPanel) ContentPanel(jadx.gui.ui.panel.ContentPanel) SmaliArea(jadx.gui.ui.codearea.SmaliArea)

Example 5 with JumpPosition

use of jadx.gui.utils.JumpPosition 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();
    }
}
Also used : JumpPosition(jadx.gui.utils.JumpPosition) JNode(jadx.gui.treemodel.JNode) JResSearchNode(jadx.gui.treemodel.JResSearchNode)

Aggregations

JumpPosition (jadx.gui.utils.JumpPosition)8 JNode (jadx.gui.treemodel.JNode)4 CodePosition (jadx.api.CodePosition)1 JavaNode (jadx.api.JavaNode)1 ResourceFile (jadx.api.ResourceFile)1 JadxRuntimeException (jadx.core.utils.exceptions.JadxRuntimeException)1 JResSearchNode (jadx.gui.treemodel.JResSearchNode)1 JResource (jadx.gui.treemodel.JResource)1 AbstractCodeContentPanel (jadx.gui.ui.codearea.AbstractCodeContentPanel)1 ClassCodeContentPanel (jadx.gui.ui.codearea.ClassCodeContentPanel)1 SmaliArea (jadx.gui.ui.codearea.SmaliArea)1 ContentPanel (jadx.gui.ui.panel.ContentPanel)1 HeadlessException (java.awt.HeadlessException)1 Point (java.awt.Point)1 HyperlinkEvent (javax.swing.event.HyperlinkEvent)1 BadLocationException (javax.swing.text.BadLocationException)1 LinkGeneratorResult (org.fife.ui.rsyntaxtextarea.LinkGeneratorResult)1 Nullable (org.jetbrains.annotations.Nullable)1