本文整理汇总了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));
}
示例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));
}
示例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());
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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());
}
示例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());
}