本文整理汇总了Java中com.intellij.debugger.engine.DebugProcessImpl.invokeMethod方法的典型用法代码示例。如果您正苦于以下问题:Java DebugProcessImpl.invokeMethod方法的具体用法?Java DebugProcessImpl.invokeMethod怎么用?Java DebugProcessImpl.invokeMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.debugger.engine.DebugProcessImpl
的用法示例。
在下文中一共展示了DebugProcessImpl.invokeMethod方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToWrapper
import com.intellij.debugger.engine.DebugProcessImpl; //导入方法依赖的package包/类
private static Value convertToWrapper(EvaluationContextImpl context, PrimitiveValue value, String wrapperTypeName) throws
EvaluateException {
final DebugProcessImpl process = context.getDebugProcess();
final ClassType wrapperClass = (ClassType)process.findClass(context, wrapperTypeName, null);
final String methodSignature = "(" + JVMNameUtil.getPrimitiveSignature(value.type().name()) + ")L" + wrapperTypeName.replace('.', '/') + ";";
List<Method> methods = wrapperClass.methodsByName("valueOf", methodSignature);
if (methods.size() == 0) { // older JDK version
methods = wrapperClass.methodsByName(JVMNameUtil.CONSTRUCTOR_NAME, methodSignature);
}
if (methods.size() == 0) {
throw new EvaluateException("Cannot construct wrapper object for value of type " + value.type() + ": Unable to find either valueOf() or constructor method");
}
return process.invokeMethod(context, wrapperClass, methods.get(0), Collections.singletonList(value));
}
示例2: createScaledBitmap
import com.intellij.debugger.engine.DebugProcessImpl; //导入方法依赖的package包/类
@Nullable
private static Value createScaledBitmap(@NotNull EvaluationContextImpl context,
@NotNull ObjectReference bitmap,
@NotNull Dimension currentDimensions) throws EvaluateException {
DebugProcessImpl debugProcess = context.getDebugProcess();
Method createScaledBitmapMethod = DebuggerUtils
.findMethod(bitmap.referenceType(), "createScaledBitmap", "(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;");
if (createScaledBitmapMethod == null) {
return null;
}
double s = Math.max(currentDimensions.getHeight(), currentDimensions.getWidth()) / MAX_DIMENSION;
VirtualMachineProxyImpl vm = context.getDebugProcess().getVirtualMachineProxy();
Value dstWidth = DebuggerUtilsEx.createValue(vm, "int", (int)(currentDimensions.getWidth() / s));
Value dstHeight = DebuggerUtilsEx.createValue(vm, "int", (int)(currentDimensions.getHeight() / s));
Value filter = DebuggerUtilsEx.createValue(vm, "boolean", Boolean.FALSE);
return debugProcess.invokeMethod(context, bitmap, createScaledBitmapMethod,
Arrays.asList(bitmap, dstWidth, dstHeight, filter));
}
示例3: convertToWrapper
import com.intellij.debugger.engine.DebugProcessImpl; //导入方法依赖的package包/类
private static Value convertToWrapper(EvaluationContextImpl context, PrimitiveValue value, String wrapperTypeName) throws
EvaluateException {
final DebugProcessImpl process = context.getDebugProcess();
final ClassType wrapperClass = (ClassType)process.findClass(context, wrapperTypeName, null);
final String methodSignature = "(" + JVMNameUtil.getPrimitiveSignature(value.type().name()) + ")L" + wrapperTypeName.replace('.', '/') + ";";
List<Method> methods = wrapperClass.methodsByName("valueOf", methodSignature);
if (methods.size() == 0) { // older JDK version
methods = wrapperClass.methodsByName("<init>", methodSignature);
}
if (methods.size() == 0) {
throw new EvaluateException("Cannot construct wrapper object for value of type " + value.type() + ": Unable to find either valueOf() or constructor method");
}
final Method factoryMethod = methods.get(0);
final ArrayList args = new ArrayList();
args.add(value);
return process.invokeMethod(context, wrapperClass, factoryMethod, args);
}
示例4: convertToPrimitive
import com.intellij.debugger.engine.DebugProcessImpl; //导入方法依赖的package包/类
private static Value convertToPrimitive(EvaluationContextImpl context, ObjectReference value, final String conversionMethodName,
String conversionMethodSignature) throws EvaluateException {
final DebugProcessImpl process = context.getDebugProcess();
final ClassType wrapperClass = (ClassType)value.referenceType();
final List<Method> methods = wrapperClass.methodsByName(conversionMethodName, conversionMethodSignature);
if (methods.size() == 0) {
throw new EvaluateException("Cannot convert to primitive value of type " + value.type() + ": Unable to find method " +
conversionMethodName + conversionMethodSignature);
}
return process.invokeMethod(context, value, methods.get(0), Collections.emptyList());
}
示例5: copyToBuffer
import com.intellij.debugger.engine.DebugProcessImpl; //导入方法依赖的package包/类
@Nullable
private static List<Value> copyToBuffer(EvaluationContextImpl evaluationContext, ObjectReference bitmap, Dimension size) throws EvaluateException {
DebugProcessImpl debugProcess = evaluationContext.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(evaluationContext, byteBufferType, wrapMethod, ImmutableList.of(byteArray));
Method copyToBufferMethod = DebuggerUtils.findMethod(bitmap.referenceType(), "copyPixelsToBuffer", "(Ljava/nio/Buffer;)V");
if (copyToBufferMethod == null) {
return null;
}
debugProcess.invokeMethod(evaluationContext, bitmap, copyToBufferMethod, ImmutableList.of(byteBufferRef));
return byteArray.getValues();
}
示例6: getBitmapConfig
import com.intellij.debugger.engine.DebugProcessImpl; //导入方法依赖的package包/类
@Nullable
private static Value getBitmapConfig(EvaluationContextImpl context, ObjectReference bitmap) throws EvaluateException {
DebugProcessImpl debugProcess = context.getDebugProcess();
Method getConfig = DebuggerUtils.findMethod(bitmap.referenceType(), "getConfig", "()Landroid/graphics/Bitmap$Config;");
if (getConfig == null) {
return null;
}
return debugProcess.invokeMethod(context, bitmap, getConfig, Collections.emptyList());
}
示例7: getBitmapFromDrawable
import com.intellij.debugger.engine.DebugProcessImpl; //导入方法依赖的package包/类
@Nullable
private static Value getBitmapFromDrawable(@NotNull EvaluationContextImpl context, @NotNull ObjectReference bitmap)
throws EvaluateException {
DebugProcessImpl debugProcess = context.getDebugProcess();
Method getBitmapMethod = DebuggerUtils
.findMethod(bitmap.referenceType(), "getBitmap", "()Landroid/graphics/Bitmap;");
if (getBitmapMethod == null) {
return null;
}
return debugProcess.invokeMethod(context, bitmap, getBitmapMethod, Collections.emptyList());
}
示例8: getImageDimension
import com.intellij.debugger.engine.DebugProcessImpl; //导入方法依赖的package包/类
@Nullable
private static Integer getImageDimension(EvaluationContextImpl context,
ObjectReference bitmap,
DebugProcessImpl debugProcess,
String methodName) throws EvaluateException {
Method method = DebuggerUtils.findMethod((bitmap).referenceType(), methodName, "()I");
if (method != null) {
Value widthValue = debugProcess.invokeMethod(context, bitmap, method, Collections.emptyList());
if (widthValue instanceof IntegerValue) {
return ((IntegerValue)widthValue).value();
}
}
return null;
}
示例9: convertToPrimitive
import com.intellij.debugger.engine.DebugProcessImpl; //导入方法依赖的package包/类
private static Value convertToPrimitive(EvaluationContextImpl context, ObjectReference value, final String conversionMethodName,
String conversionMethodSignature) throws EvaluateException {
final DebugProcessImpl process = context.getDebugProcess();
final ClassType wrapperClass = (ClassType)value.referenceType();
final List<Method> methods = wrapperClass.methodsByName(conversionMethodName, conversionMethodSignature);
if (methods.size() == 0) {
throw new EvaluateException("Cannot convert to primitive value of type " + value.type() + ": Unable to find method " +
conversionMethodName + conversionMethodSignature);
}
final Method method = methods.get(0);
return process.invokeMethod(context, value, method, new ArrayList());
}