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


Java EvaluationContext类代码示例

本文整理汇总了Java中com.intellij.debugger.engine.evaluation.EvaluationContext的典型用法代码示例。如果您正苦于以下问题:Java EvaluationContext类的具体用法?Java EvaluationContext怎么用?Java EvaluationContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EvaluationContext类属于com.intellij.debugger.engine.evaluation包,在下文中一共展示了EvaluationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluateCondition

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
@Override
public ThreeState evaluateCondition(@NotNull EvaluationContext context,
                                    @NotNull StackFrameProxyImpl frame,
                                    @NotNull Location location,
                                    @NotNull String expression) {
  for (PositionManager positionManager : myPositionManagers) {
    if (positionManager instanceof PositionManagerEx) {
      try {
        ThreeState result = ((PositionManagerEx)positionManager).evaluateCondition(context, frame, location, expression);
        if (result != ThreeState.UNSURE) {
          return result;
        }
      }
      catch (Throwable e) {
        LOG.error(e);
      }
    }
  }
  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CompoundPositionManager.java

示例2: calcLabel

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
@SuppressWarnings({"HardCodedStringLiteral"})
public String calcLabel(ValueDescriptor valueDescriptor, EvaluationContext evaluationContext, DescriptorLabelListener labelListener) {
  Value value = valueDescriptor.getValue();
  StringBuilder buf = new StringBuilder();

  if (value == null) {
    return "null";
  }
  else if (value instanceof CharValue) {
    PrimitiveRenderer.appendCharValue((CharValue)value, buf);
    buf.append(' ');
    appendHexValue((PrimitiveValue)value, buf);
    return buf.toString();
  }
  else {
    appendHexValue((PrimitiveValue)value, buf);
    return buf.toString();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:HexRenderer.java

示例3: calcValueIcon

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
public Icon calcValueIcon(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener) throws EvaluateException {
  final Value value = descriptor.getValue();
  if (value instanceof ObjectReference) {
    try {
      final ObjectReference objRef = (ObjectReference)value;
      final ReferenceType refType = objRef.referenceType();
      final Field valueField = refType.fieldByName("value");
      if (valueField != null) {
        final Value rgbValue = objRef.getValue(valueField);
        if (rgbValue instanceof IntegerValue) {
          @SuppressWarnings("UseJBColor")
          final Color color = new Color(((IntegerValue)rgbValue).value(), true);
          return new ColorIcon(16, 12, color, true);
        }
      }
    }
    catch (Exception e) {
      throw new EvaluateException(e.getMessage(), e);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ColorObjectRenderer.java

示例4: buildChildren

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
public void buildChildren(final Value value, final ChildrenBuilder builder, final EvaluationContext evaluationContext) {
  final NodeManager nodeManager = builder.getNodeManager();

  try {
    final ValueDescriptor parentDescriptor = builder.getParentDescriptor();
    final Value childrenValue = evaluateChildren(
      evaluationContext.createEvaluationContext(value), parentDescriptor
    );

    NodeRenderer renderer = getChildrenRenderer(childrenValue, parentDescriptor);
    renderer.buildChildren(childrenValue, builder, evaluationContext);
  }
  catch (final EvaluateException e) {
    List<DebuggerTreeNode> errorChildren = new ArrayList<DebuggerTreeNode>();
    errorChildren.add(nodeManager.createMessageNode(DebuggerBundle.message("error.unable.to.evaluate.expression") + " " + e.getMessage()));
    builder.setChildren(errorChildren);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ExpressionChildrenRenderer.java

示例5: defineClass

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
public static void defineClass(String name,
                               byte[] bytes,
                               EvaluationContext context,
                               DebugProcess process,
                               ClassLoaderReference classLoader) throws EvaluateException {
  try {
    VirtualMachineProxyImpl proxy = (VirtualMachineProxyImpl)process.getVirtualMachineProxy();
    Method defineMethod =
      ((ClassType)classLoader.referenceType()).concreteMethodByName("defineClass", "(Ljava/lang/String;[BII)Ljava/lang/Class;");
    StringReference nameObj = proxy.mirrorOf(name);
    DebuggerUtilsEx.keep(nameObj, context);
    process.invokeMethod(context, classLoader, defineMethod,
                         Arrays.asList(nameObj,
                                       mirrorOf(bytes, context, process),
                                       proxy.mirrorOf(0),
                                       proxy.mirrorOf(bytes.length)));
  }
  catch (Exception e) {
    throw new EvaluateException("Error during class " + name + " definition: " + e, e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ClassLoadingUtils.java

示例6: createURLArray

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
private static ArrayReference createURLArray(EvaluationContext context)
  throws EvaluateException, InvocationException, InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException {
  DebugProcess process = context.getDebugProcess();
  ArrayType arrayType = (ArrayType)process.findClass(context, "java.net.URL[]", context.getClassLoader());
  ArrayReference arrayRef = arrayType.newInstance(1);
  DebuggerUtilsEx.keep(arrayRef, context);
  ClassType classType = (ClassType)process.findClass(context, "java.net.URL", context.getClassLoader());
  VirtualMachineProxyImpl proxy = (VirtualMachineProxyImpl)process.getVirtualMachineProxy();
  StringReference url = proxy.mirrorOf("file:a");
  DebuggerUtilsEx.keep(url, context);
  ObjectReference reference = process.newInstance(context,
                                                  classType,
                                                  classType.concreteMethodByName(JVMNameUtil.CONSTRUCTOR_NAME, "(Ljava/lang/String;)V"),
                                                  Collections.singletonList(url));
  DebuggerUtilsEx.keep(reference, context);
  arrayRef.setValues(Collections.singletonList(reference));
  return arrayRef;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ClassLoadingUtils.java

示例7: buildChildren

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
public void buildChildren(final Value value, final ChildrenBuilder builder, final EvaluationContext evaluationContext) {
  final NodeManager nodeManager = builder.getNodeManager();

  try {
    final ValueDescriptor parentDescriptor = builder.getParentDescriptor();
    final Value childrenValue = evaluateChildren(
      evaluationContext.createEvaluationContext(value), parentDescriptor
    );

    NodeRenderer renderer = getLastChildrenRenderer(parentDescriptor);
    if (renderer == null || childrenValue == null || !renderer.isApplicable(childrenValue.type())) {
      renderer = DebugProcessImpl.getDefaultRenderer(childrenValue != null ? childrenValue.type() : null);
      parentDescriptor.putUserData(LAST_CHILDREN_RENDERER, renderer);
    }
    renderer.buildChildren(childrenValue, builder, evaluationContext);
  }
  catch (final EvaluateException e) {
    List<DebuggerTreeNode> errorChildren = new ArrayList<DebuggerTreeNode>();
    errorChildren.add(nodeManager.createMessageNode(DebuggerBundle.message("error.unable.to.evaluate.expression") + " " + e.getMessage()));
    builder.setChildren(errorChildren);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:ExpressionChildrenRenderer.java

示例8: evaluateCondition

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
@Override
public ThreeState evaluateCondition(@NotNull EvaluationContext context, @NotNull StackFrameProxyImpl frame, @NotNull Location location, @NotNull String expression)
{
	for(PositionManager positionManager : myPositionManagers)
	{
		if(positionManager instanceof PositionManagerEx)
		{
			try
			{
				ThreeState result = ((PositionManagerEx) positionManager).evaluateCondition(context, frame, location, expression);
				if(result != ThreeState.UNSURE)
				{
					return result;
				}
			}
			catch(Throwable e)
			{
				LOG.error(e);
			}
		}
	}
	return ThreeState.UNSURE;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:CompoundPositionManager.java

示例9: calcLabel

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
@Override
@SuppressWarnings({"HardCodedStringLiteral"})
public String calcLabel(ValueDescriptor valueDescriptor, EvaluationContext evaluationContext, DescriptorLabelListener labelListener)
{
	Value value = valueDescriptor.getValue();
	StringBuilder buf = new StringBuilder();

	if(value == null)
	{
		return "null";
	}
	else if(value instanceof CharValue)
	{
		PrimitiveRenderer.appendCharValue((CharValue) value, buf);
		buf.append(' ');
		appendHexValue((PrimitiveValue) value, buf);
		return buf.toString();
	}
	else
	{
		appendHexValue((PrimitiveValue) value, buf);
		return buf.toString();
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:25,代码来源:HexRenderer.java

示例10: buildChildren

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
@Override
public void buildChildren(Value value, ChildrenBuilder builder, EvaluationContext evaluationContext)
{
	NodeManager nodeManager = builder.getNodeManager();
	NodeDescriptorFactory descriptorFactory = builder.getDescriptorManager();

	List<DebuggerTreeNode> children = new ArrayList<>();
	int idx = 0;
	for(ChildInfo childInfo : myChildren)
	{
		UserExpressionData data = new UserExpressionData((ValueDescriptorImpl) builder.getParentDescriptor(), getClassName(), childInfo.myName, childInfo.myExpression);
		data.setEnumerationIndex(idx++);
		UserExpressionDescriptor descriptor = descriptorFactory.getUserExpressionDescriptor(builder.getParentDescriptor(), data);
		if(childInfo.myOnDemand)
		{
			descriptor.putUserData(OnDemandRenderer.ON_DEMAND_CALCULATED, false);
		}
		children.add(nodeManager.createNode(descriptor, evaluationContext));
	}
	builder.addChildren(children, !myAppendDefaultChildren);

	if(myAppendDefaultChildren)
	{
		DebugProcessImpl.getDefaultRenderer(value).buildChildren(value, builder, evaluationContext);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:EnumerationChildrenRenderer.java

示例11: calcValueIcon

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
@Override
public Icon calcValueIcon(final ValueDescriptor descriptor, final EvaluationContext evaluationContext, final DescriptorLabelListener listener) throws EvaluateException
{
	EvaluationContextImpl evalContext = ((EvaluationContextImpl) evaluationContext);
	DebugProcessImpl debugProcess = evalContext.getDebugProcess();

	if(DebuggerUtilsImpl.isRemote(debugProcess))
	{
		return null;
	}

	debugProcess.getManagerThread().schedule(new SuspendContextCommandImpl(evalContext.getSuspendContext())
	{
		@Override
		public void contextAction() throws Exception
		{
			String getterName = AllIcons.Debugger.Value.getIconHeight() <= 16 ? "iconToBytesPreviewNormal" : "iconToBytesPreviewRetina";
			descriptor.setValueIcon(ImageObjectRenderer.getIcon(evaluationContext, descriptor.getValue(), getterName));
			listener.labelChanged();
		}
	});
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:IconObjectRenderer.java

示例12: buildChildren

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
public void buildChildren(final Value value, final ChildrenBuilder builder, final EvaluationContext evaluationContext)
{
	final NodeManager nodeManager = builder.getNodeManager();

	try
	{
		final ValueDescriptor parentDescriptor = builder.getParentDescriptor();
		final Value childrenValue = evaluateChildren(evaluationContext.createEvaluationContext(value), parentDescriptor);

		NodeRenderer renderer = getChildrenRenderer(childrenValue, parentDescriptor);
		renderer.buildChildren(childrenValue, builder, evaluationContext);
	}
	catch(final EvaluateException e)
	{
		List<DebuggerTreeNode> errorChildren = new ArrayList<>();
		errorChildren.add(nodeManager.createMessageNode(DebuggerBundle.message("error.unable.to.evaluate.expression") + " " + e.getMessage()));
		builder.setChildren(errorChildren);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:ExpressionChildrenRenderer.java

示例13: getIcon

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
@Nullable
static ImageIcon getIcon(EvaluationContext evaluationContext, Value obj, String methodName)
{
	try
	{
		Value bytes = getImageBytes(evaluationContext, obj, methodName);
		byte[] data = readBytes(bytes);
		if(data != null)
		{
			return new ImageIcon(data);
		}
	}
	catch(Exception e)
	{
		LOG.info("Exception while getting image data", e);
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:ImageObjectRenderer.java

示例14: getImageBytes

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
private static Value getImageBytes(EvaluationContext evaluationContext, Value obj, String methodName) throws EvaluateException
{
	DebugProcess process = evaluationContext.getDebugProcess();
	EvaluationContext copyContext = evaluationContext.createEvaluationContext(obj);
	ClassType helperClass = ClassLoadingUtils.getHelperClass(ImageSerializer.class.getName(), copyContext, process);

	if(helperClass != null)
	{
		List<Method> methods = helperClass.methodsByName(methodName);
		if(!methods.isEmpty())
		{
			return process.invokeMethod(copyContext, helperClass, methods.get(0), Collections.singletonList(obj));
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:ImageObjectRenderer.java

示例15: evaluate

import com.intellij.debugger.engine.evaluation.EvaluationContext; //导入依赖的package包/类
@Nullable
Value evaluate(final EvaluationContext context) throws EvaluateException
{
	ExpressionEvaluator evaluator = myEvaluator;
	if(evaluator == null)
	{
		@SuppressWarnings("ConstantConditions") Location location = context.getFrameProxy().location();
		evaluator = myEvaluatorCache.get(location);
		if(evaluator == null && !StringUtil.isEmpty(myExpression))
		{
			evaluator = ApplicationManager.getApplication().runReadAction((ThrowableComputable<ExpressionEvaluator, EvaluateException>) () ->
			{
				SourcePosition sourcePosition = ContextUtil.getSourcePosition(context);
				PsiElement contextElement = ContextUtil.getContextElement(sourcePosition);
				return EvaluatorBuilderImpl.build(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, myExpression), contextElement, sourcePosition, context.getProject());
			});
			myEvaluatorCache.put(location, evaluator);
		}
	}
	if(evaluator != null)
	{
		return evaluator.evaluate(context);
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:StackCapturingLineBreakpoint.java


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