本文整理汇总了Java中com.intellij.debugger.impl.DebuggerUtilsEx.createValue方法的典型用法代码示例。如果您正苦于以下问题:Java DebuggerUtilsEx.createValue方法的具体用法?Java DebuggerUtilsEx.createValue怎么用?Java DebuggerUtilsEx.createValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.debugger.impl.DebuggerUtilsEx
的用法示例。
在下文中一共展示了DebuggerUtilsEx.createValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Value value = (Value)myOperandEvaluator.evaluate(context);
if (value == null) {
return DebuggerUtilsEx.createValue(context.getDebugProcess().getVirtualMachineProxy(), PsiType.BOOLEAN.getPresentableText(), false);
}
if (!(value instanceof ObjectReference)) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.object.reference.expected"));
}
try {
ReferenceType refType = (ReferenceType)myTypeEvaluator.evaluate(context);
ClassObjectReference classObject = refType.classObject();
ClassType classRefType = (ClassType)classObject.referenceType();
//noinspection HardCodedStringLiteral
Method method = classRefType.concreteMethodByName("isAssignableFrom", "(Ljava/lang/Class;)Z");
List args = new LinkedList();
args.add(((ObjectReference)value).referenceType().classObject());
return context.getDebugProcess().invokeMethod(context, classObject, method, args);
}
catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug(e);
}
throw EvaluateExceptionUtil.createEvaluateException(e);
}
}
示例2: evaluate
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
if (myValue == null) {
return null;
}
VirtualMachineProxyImpl vm = context.getDebugProcess().getVirtualMachineProxy();
if (myValue instanceof Boolean) {
return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Boolean)myValue).booleanValue());
}
if (myValue instanceof Character) {
return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Character)myValue).charValue());
}
if (myValue instanceof Double) {
return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).doubleValue());
}
if (myValue instanceof Float) {
return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).floatValue());
}
if (myValue instanceof Number) {
return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).longValue());
}
if (myValue instanceof String) {
return vm.mirrorOf((String)myValue);
}
throw EvaluateExceptionUtil
.createEvaluateException(DebuggerBundle.message("evaluation.error.unknown.expression.type", myExpectedType));
}
示例3: createScaledBitmap
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的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));
}
示例4: evaluate
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Value value = (Value)myOperandEvaluator.evaluate(context);
if (value == null) {
if (myIsPrimitive) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.null", myCastType));
}
return null;
}
VirtualMachineProxyImpl vm = context.getDebugProcess().getVirtualMachineProxy();
if (DebuggerUtilsEx.isInteger(value)) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((PrimitiveValue)value).longValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.numeric", myCastType));
}
}
else if (DebuggerUtilsEx.isNumeric(value)) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((PrimitiveValue)value).doubleValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.numeric", myCastType));
}
}
else if (value instanceof BooleanValue) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((BooleanValue)value).booleanValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.boolean", myCastType));
}
}
else if (value instanceof CharValue) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((CharValue)value).charValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.char", myCastType));
}
}
return value;
}
示例5: evaluate
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Value value = (Value)myOperandEvaluator.evaluate(context);
if (value == null) {
if (myIsPrimitive) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.null", myCastType));
}
return null;
}
VirtualMachineProxyImpl vm = context.getDebugProcess().getVirtualMachineProxy();
if (DebuggerUtils.isInteger(value)) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((PrimitiveValue)value).longValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.numeric", myCastType));
}
}
else if (DebuggerUtils.isNumeric(value)) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((PrimitiveValue)value).doubleValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.numeric", myCastType));
}
}
else if (value instanceof BooleanValue) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((BooleanValue)value).booleanValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.boolean", myCastType));
}
}
else if (value instanceof CharValue) {
value = DebuggerUtilsEx.createValue(vm, myCastType, ((CharValue)value).charValue());
if (value == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.char", myCastType));
}
}
else if (value instanceof ObjectReference) {
Type type = value.type();
if (!DebuggerUtils.instanceOf(type, myCastType)) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.cast.object", type.name(), myCastType));
}
}
return value;
}