当前位置: 首页>>代码示例>>Java>>正文


Java DebugProcessImpl.invokeMethod方法代码示例

本文整理汇总了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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BoxingEvaluator.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BitmapEvaluator.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:BoxingEvaluator.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:UnBoxingEvaluator.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:BitmapEvaluator.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:BitmapEvaluator.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BitmapEvaluator.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:BitmapEvaluator.java

示例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());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:UnBoxingEvaluator.java


注:本文中的com.intellij.debugger.engine.DebugProcessImpl.invokeMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。