use of com.intellij.debugger.SourcePosition in project smali by JesusFreke.
the class SmaliPositionManagerTest method testGetSourcePosition.
public void testGetSourcePosition() throws NoDataException {
myFixture.addFileToProject("my/pkg/blah.smali", testClass);
SmaliPositionManager positionManager = new SmaliPositionManager(new MockDebugProcess());
SourcePosition sourcePosition = positionManager.getSourcePosition("my.pkg.blah", "getRandomParentType", "(I)I", 0);
Assert.assertEquals(Opcode.CONST_4, ((SmaliInstruction) sourcePosition.getElementAt()).getOpcode());
Assert.assertEquals(0, ((SmaliInstruction) sourcePosition.getElementAt()).getOffset());
sourcePosition = positionManager.getSourcePosition("my.pkg.blah", "getRandomParentType", "(I)I", 10);
Assert.assertEquals(Opcode.INVOKE_VIRTUAL, ((SmaliInstruction) sourcePosition.getElementAt()).getOpcode());
Assert.assertEquals(20, ((SmaliInstruction) sourcePosition.getElementAt()).getOffset());
}
use of com.intellij.debugger.SourcePosition in project smali by JesusFreke.
the class SmaliMethodTest method checkSourcePosition.
private void checkSourcePosition(SmaliMethod smaliMethod, int codeOffset, Opcode opcode) {
SourcePosition sourcePosition = smaliMethod.getSourcePositionForCodeOffset(codeOffset);
Assert.assertNotNull(sourcePosition);
SmaliInstruction instruction = (SmaliInstruction) sourcePosition.getElementAt();
Assert.assertEquals(opcode, instruction.getOpcode());
Assert.assertEquals(codeOffset, instruction.getOffset());
}
use of com.intellij.debugger.SourcePosition in project intellij-community by JetBrains.
the class EditSourceAction method update.
public void update(AnActionEvent e) {
final Project project = e.getProject();
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
final Presentation presentation = e.getPresentation();
if (debuggerContext.getDebugProcess() != null) {
presentation.setEnabled(true);
debuggerContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
public void threadAction() {
final SourcePosition position = getSourcePosition(node, debuggerContext);
if (position == null) {
DebuggerInvocationUtil.swingInvokeLater(project, () -> presentation.setEnabled(false));
}
}
});
} else {
presentation.setEnabled(false);
}
e.getPresentation().setText(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE).getTemplatePresentation().getText());
}
use of com.intellij.debugger.SourcePosition in project intellij-community by JetBrains.
the class EditSourceAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
if (project == null) {
return;
}
final DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
if (selectedNode != null) {
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
DebugProcessImpl process = debuggerContext.getDebugProcess();
if (process != null) {
process.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
public void threadAction() {
final SourcePosition sourcePosition = getSourcePosition(selectedNode, debuggerContext);
if (sourcePosition != null) {
sourcePosition.navigate(true);
}
}
});
}
}
}
use of com.intellij.debugger.SourcePosition in project intellij-community by JetBrains.
the class GotoFrameSourceAction method doAction.
protected static void doAction(DataContext dataContext) {
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null)
return;
StackFrameDescriptorImpl stackFrameDescriptor = getStackFrameDescriptor(dataContext);
if (stackFrameDescriptor != null) {
//DebuggerContextUtil.setStackFrame(getContextManager(dataContext), stackFrameDescriptor.getFrameProxy());
SourcePosition sourcePosition = stackFrameDescriptor.getSourcePosition();
if (sourcePosition != null) {
sourcePosition.navigate(true);
}
}
}
Aggregations