Search in sources :

Example 31 with DebugProcessImpl

use of com.intellij.debugger.engine.DebugProcessImpl in project android by JetBrains.

the class BitmapEvaluatorProvider method getBitmapConfig.

@Nullable
private Value getBitmapConfig() throws EvaluateException {
    DebugProcessImpl debugProcess = myEvaluationContext.getDebugProcess();
    Method getConfig = DebuggerUtils.findMethod(myBitmap.referenceType(), "getConfig", "()Landroid/graphics/Bitmap$Config;");
    if (getConfig == null) {
        return null;
    }
    return debugProcess.invokeMethod(myEvaluationContext, myBitmap, getConfig, Collections.emptyList());
}
Also used : DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) Nullable(org.jetbrains.annotations.Nullable)

Example 32 with DebugProcessImpl

use of com.intellij.debugger.engine.DebugProcessImpl in project android by JetBrains.

the class BitmapEvaluatorProvider method getBitmapFromDrawable.

@Nullable
private Value getBitmapFromDrawable(@NotNull ObjectReference bitmapDrawable) {
    try {
        DebugProcessImpl debugProcess = myEvaluationContext.getDebugProcess();
        Method getBitmapMethod = DebuggerUtils.findMethod(bitmapDrawable.referenceType(), "getBitmap", "()Landroid/graphics/Bitmap;");
        if (getBitmapMethod == null) {
            return null;
        }
        return debugProcess.invokeMethod(myEvaluationContext, bitmapDrawable, getBitmapMethod, Collections.emptyList());
    } catch (EvaluateException ignored) {
        return null;
    }
}
Also used : EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) Nullable(org.jetbrains.annotations.Nullable)

Example 33 with DebugProcessImpl

use of com.intellij.debugger.engine.DebugProcessImpl in project android by JetBrains.

the class BitmapEvaluatorProvider method copyToBuffer.

@Nullable
private List<Value> copyToBuffer(@NotNull Dimension size) throws EvaluateException {
    DebugProcessImpl debugProcess = myEvaluationContext.getDebugProcess();
    VirtualMachineProxyImpl virtualMachineProxy = debugProcess.getVirtualMachineProxy();
    List<ReferenceType> classes = virtualMachineProxy.classesByName("byte[]");
    if (classes.size() != 1 || !(classes.get(0) instanceof ArrayType)) {
        return null;
    }
    ArrayType byteArrayType = (ArrayType) classes.get(0);
    classes = virtualMachineProxy.classesByName("java.nio.ByteBuffer");
    if (classes.size() != 1 || !(classes.get(0) instanceof ClassType)) {
        return null;
    }
    ClassType byteBufferType = (ClassType) classes.get(0);
    Method wrapMethod = DebuggerUtils.findMethod(byteBufferType, "wrap", "([B)Ljava/nio/ByteBuffer;");
    if (wrapMethod == null) {
        return null;
    }
    ArrayReference byteArray = byteArrayType.newInstance(size.width * size.height * 4);
    Value byteBufferRef = debugProcess.invokeMethod(myEvaluationContext, byteBufferType, wrapMethod, ImmutableList.of(byteArray));
    Method copyToBufferMethod = DebuggerUtils.findMethod(myBitmap.referenceType(), "copyPixelsToBuffer", "(Ljava/nio/Buffer;)V");
    if (copyToBufferMethod == null) {
        return null;
    }
    debugProcess.invokeMethod(myEvaluationContext, myBitmap, copyToBufferMethod, ImmutableList.of(byteBufferRef));
    return byteArray.getValues();
}
Also used : VirtualMachineProxyImpl(com.intellij.debugger.jdi.VirtualMachineProxyImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) Nullable(org.jetbrains.annotations.Nullable)

Example 34 with DebugProcessImpl

use of com.intellij.debugger.engine.DebugProcessImpl in project android by JetBrains.

the class BitmapEvaluatorProvider method getDimension.

@Override
@Nullable
public Dimension getDimension() throws EvaluateException {
    DebugProcessImpl debugProcess = myEvaluationContext.getDebugProcess();
    Integer w = getImageDimension(debugProcess, "getWidth");
    Integer h = getImageDimension(debugProcess, "getHeight");
    return (w != null & h != null) ? new Dimension(w, h) : null;
}
Also used : DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) Nullable(org.jetbrains.annotations.Nullable)

Example 35 with DebugProcessImpl

use of com.intellij.debugger.engine.DebugProcessImpl 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);
                    }
                }
            });
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) SourcePosition(com.intellij.debugger.SourcePosition) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) DebuggerContextCommandImpl(com.intellij.debugger.engine.events.DebuggerContextCommandImpl)

Aggregations

DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)55 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)20 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)15 Project (com.intellij.openapi.project.Project)15 Nullable (org.jetbrains.annotations.Nullable)11 DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)9 DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)9 DebuggerContextCommandImpl (com.intellij.debugger.engine.events.DebuggerContextCommandImpl)7 List (java.util.List)7 SourcePosition (com.intellij.debugger.SourcePosition)5 JavaValue (com.intellij.debugger.engine.JavaValue)5 StackFrameProxyImpl (com.intellij.debugger.jdi.StackFrameProxyImpl)5 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)5 VirtualMachineProxyImpl (com.intellij.debugger.jdi.VirtualMachineProxyImpl)5 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)4 NodeDescriptorImpl (com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)4 ThreadDescriptorImpl (com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl)4 XDebugSession (com.intellij.xdebugger.XDebugSession)4 ArrayList (java.util.ArrayList)4 NotNull (org.jetbrains.annotations.NotNull)4