當前位置: 首頁>>代碼示例>>Java>>正文


Java EvaluationContextImpl.getDebugProcess方法代碼示例

本文整理匯總了Java中com.intellij.debugger.engine.evaluation.EvaluationContextImpl.getDebugProcess方法的典型用法代碼示例。如果您正苦於以下問題:Java EvaluationContextImpl.getDebugProcess方法的具體用法?Java EvaluationContextImpl.getDebugProcess怎麽用?Java EvaluationContextImpl.getDebugProcess使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.debugger.engine.evaluation.EvaluationContextImpl的用法示例。


在下文中一共展示了EvaluationContextImpl.getDebugProcess方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: convertToWrapper

import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; //導入方法依賴的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.evaluation.EvaluationContextImpl; //導入方法依賴的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: convertToPrimitive

import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; //導入方法依賴的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

示例4: evaluate

import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; //導入方法依賴的package包/類
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
  DebugProcessImpl debugProcess = context.getDebugProcess();
  Object obj = myClassTypeEvaluator.evaluate(context);
  if (!(obj instanceof ClassType)) {
    throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.evaluate.class.type"));
  }
  ClassType classType = (ClassType)obj;
  // find constructor
  Method method = DebuggerUtils.findMethod(classType, JVMNameUtil.CONSTRUCTOR_NAME, myConstructorSignature.getName(debugProcess));
  if (method == null) {
    throw EvaluateExceptionUtil.createEvaluateException(
      DebuggerBundle.message("evaluation.error.cannot.resolve.constructor", myConstructorSignature.getDisplayName(debugProcess)));
  }
  // evaluate arguments
  List<Object> arguments;
  if (myParamsEvaluators != null) {
    arguments = new ArrayList<Object>(myParamsEvaluators.length);
    for (Evaluator evaluator : myParamsEvaluators) {
      arguments.add(evaluator.evaluate(context));
    }
  }
  else {
    arguments = Collections.emptyList();
  }
  ObjectReference objRef;
  try {
    objRef = debugProcess.newInstance(context, classType, method, arguments);
  }
  catch (EvaluateException e) {
    throw EvaluateExceptionUtil.createEvaluateException(e);
  }
  return objRef;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:34,代碼來源:NewClassInstanceEvaluator.java

示例5: evaluate

import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; //導入方法依賴的package包/類
/**
 * @return ReferenceType in the target VM, with the given fully qualified name
 */
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
  DebugProcessImpl debugProcess = context.getDebugProcess();
  String typeName = myTypeName.getName(debugProcess);
  final ReferenceType type = debugProcess.findClass(context, typeName, context.getClassLoader());
  if (type == null) {
    throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("error.class.not.loaded", typeName));
  }
  return type;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:TypeEvaluator.java

示例6: copyToBuffer

import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; //導入方法依賴的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

示例7: getDimension

import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; //導入方法依賴的package包/類
@Nullable
private static Dimension getDimension(@NotNull EvaluationContextImpl context, @NotNull Value bitmap) throws EvaluateException {
  DebugProcessImpl debugProcess = context.getDebugProcess();

  Integer w = getImageDimension(context, (ObjectReference)bitmap, debugProcess, "getWidth");
  Integer h = getImageDimension(context, (ObjectReference)bitmap, debugProcess, "getHeight");

  return (w != null & h != null) ? new Dimension(w, h) : null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:BitmapEvaluator.java

示例8: getBitmapConfig

import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; //導入方法依賴的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

示例9: getBitmapFromDrawable

import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; //導入方法依賴的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


注:本文中的com.intellij.debugger.engine.evaluation.EvaluationContextImpl.getDebugProcess方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。