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


Java DebuggerUtilsEx.createValue方法代码示例

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

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

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

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

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


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