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());
}
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;
}
}
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();
}
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;
}
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);
}
}
});
}
}
}
Aggregations