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


Java DebuggerContext類代碼示例

本文整理匯總了Java中com.intellij.debugger.DebuggerContext的典型用法代碼示例。如果您正苦於以下問題:Java DebuggerContext類的具體用法?Java DebuggerContext怎麽用?Java DebuggerContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getDescriptorEvaluation

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
@Override
public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
  PsiElementFactory elementFactory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory();
  String fieldName;
  if(isStatic()) {
    String typeName = myField.declaringType().name().replace('$', '.');
    typeName = DebuggerTreeNodeExpression.normalize(typeName, PositionUtil.getContextElement(context), context.getProject());
    fieldName = typeName + "." + getName();
  }
  else {
    //noinspection HardCodedStringLiteral
    fieldName = isOuterLocalVariableValue()? StringUtil.trimStart(getName(), OUTER_LOCAL_VAR_FIELD_PREFIX) : "this." + getName();
  }
  try {
    return elementFactory.createExpressionFromText(fieldName, null);
  }
  catch (IncorrectOperationException e) {
    throw new EvaluateException(DebuggerBundle.message("error.invalid.field.name", getName()), e);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:FieldDescriptorImpl.java

示例2: getWrappedDescriptor

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
private static ValueDescriptor getWrappedDescriptor(Value ref, final Project project) {
  final Field field = ((ObjectReference)ref).referenceType().fieldByName("value");
  final Value wrapped = ((ObjectReference)ref).getValue(field);
  return new ValueDescriptorImpl(project, wrapped) {

    @Override
    public Value calcValue(EvaluationContextImpl evaluationContext) throws EvaluateException {
      return wrapped;
    }

    @Override
    public String calcValueName() {
      return field.name();
    }

    @Override
    public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
      return JavaPsiFacade.getElementFactory(context.getProject()).createExpressionFromText("this." + field.name(), null);
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:GroovyRefRenderer.java

示例3: getDescriptorEvaluation

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
  PsiElementFactory elementFactory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory();
  String fieldName;
  if(isStatic()) {
    String typeName = myField.declaringType().name().replace('$', '.');
    typeName = DebuggerTreeNodeExpression.normalize(typeName, PositionUtil.getContextElement(context), context.getProject());
    fieldName = typeName + "." + getName();
  }
  else {
    //noinspection HardCodedStringLiteral
    fieldName = isOuterLocalVariableValue()? StringUtil.trimStart(getName(), OUTER_LOCAL_VAR_FIELD_PREFIX) : "this." + getName();
  }
  try {
    return elementFactory.createExpressionFromText(fieldName, null);
  }
  catch (IncorrectOperationException e) {
    throw new EvaluateException(DebuggerBundle.message("error.invalid.field.name", getName()), e);
  }
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:20,代碼來源:FieldDescriptorImpl.java

示例4: getChildValueExpression

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
@Override
public PsiExpression getChildValueExpression(DebuggerTreeNode node, DebuggerContext context)
{
	LOG.assertTrue(node.getDescriptor() instanceof ArrayElementDescriptorImpl, node.getDescriptor().getClass().getName());
	ArrayElementDescriptorImpl descriptor = (ArrayElementDescriptorImpl) node.getDescriptor();

	PsiElementFactory elementFactory = JavaPsiFacade.getInstance(node.getProject()).getElementFactory();
	try
	{
		return elementFactory.createExpressionFromText("this[" + descriptor.getIndex() + "]", elementFactory.getArrayClass(LanguageLevel.HIGHEST));
	}
	catch(IncorrectOperationException e)
	{
		LOG.error(e);
		return null;
	}
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:18,代碼來源:ArrayRenderer.java

示例5: getChildValueExpression

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
public PsiExpression getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) throws EvaluateException
{
	Value expressionValue = getLastChildrenValue(node.getParent().getDescriptor());
	if(expressionValue == null)
	{
		throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("error.unable.to.evaluate.expression"));
	}

	NodeRenderer childrenRenderer = getChildrenRenderer(expressionValue, (ValueDescriptor) node.getParent().getDescriptor());

	PsiExpression childrenPsiExpression = myChildrenExpression.getPsiExpression(node.getProject());
	if(childrenPsiExpression == null)
	{
		return null;
	}
	return DebuggerTreeNodeExpression.substituteThis(childrenRenderer.getChildValueExpression(node, context), (PsiExpression) childrenPsiExpression.copy(), expressionValue);
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:18,代碼來源:ExpressionChildrenRenderer.java

示例6: getChildValueExpression

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
@Override
public PsiElement getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) throws EvaluateException
{
	FieldDescriptor fieldDescriptor = (FieldDescriptor) node.getDescriptor();

	PsiElementFactory elementFactory = JavaPsiFacade.getInstance(node.getProject()).getElementFactory();
	try
	{
		return elementFactory.createExpressionFromText(fieldDescriptor.getField().name(), DebuggerUtils.findClass(fieldDescriptor.getObject().referenceType().name(), context.getProject(),
				context.getDebugProcess().getSearchScope()));
	}
	catch(IncorrectOperationException e)
	{
		throw new EvaluateException(DebuggerBundle.message("error.invalid.field.name", fieldDescriptor.getField().name()), null);
	}
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:17,代碼來源:ClassRenderer.java

示例7: getFullValueDescriptor

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
public ValueDescriptorImpl getFullValueDescriptor()
{
	ValueDescriptorImpl descriptor = new ValueDescriptorImpl(myProject, myValue)
	{
		@Override
		public Value calcValue(EvaluationContextImpl evaluationContext) throws EvaluateException
		{
			return myValue;
		}

		@Override
		public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException
		{
			return null;
		}
	};
	descriptor.myFullValue = true;
	return descriptor;
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:20,代碼來源:ValueDescriptorImpl.java

示例8: getDescriptorEvaluation

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
@Override
public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException
{
	PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myProject).getElementFactory();
	String fieldName;
	if(isStatic())
	{
		String typeName = myField.declaringType().name().replace('$', '.');
		typeName = DebuggerTreeNodeExpression.normalize(typeName, PositionUtil.getContextElement(context), myProject);
		fieldName = typeName + "." + getName();
	}
	else
	{
		//noinspection HardCodedStringLiteral
		fieldName = isOuterLocalVariableValue() ? StringUtil.trimStart(getName(), OUTER_LOCAL_VAR_FIELD_PREFIX) : "this." + getName();
	}
	try
	{
		return elementFactory.createExpressionFromText(fieldName, null);
	}
	catch(IncorrectOperationException e)
	{
		throw new EvaluateException(DebuggerBundle.message("error.invalid.field.name", getName()), e);
	}
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:26,代碼來源:FieldDescriptorImpl.java

示例9: getChildValueExpression

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
public PsiExpression getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) {
  LOG.assertTrue(node.getDescriptor() instanceof ArrayElementDescriptorImpl, node.getDescriptor().getClass().getName());
  ArrayElementDescriptorImpl descriptor = (ArrayElementDescriptorImpl)node.getDescriptor();

  PsiElementFactory elementFactory = JavaPsiFacade.getInstance(node.getProject()).getElementFactory();
  try {
    LanguageLevel languageLevel = LanguageLevelProjectExtension.getInstance(node.getProject()).getLanguageLevel();
    return elementFactory.createExpressionFromText("this[" + descriptor.getIndex() + "]", elementFactory.getArrayClass(languageLevel));
  }
  catch (IncorrectOperationException e) {
    LOG.error(e);
    return null;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:ArrayRenderer.java

示例10: getChildValueExpression

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
public PsiExpression getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) throws EvaluateException {
  Value expressionValue = node.getParent().getDescriptor().getUserData(EXPRESSION_VALUE);
  if (expressionValue == null) {
    throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("error.unable.to.evaluate.expression"));
  }

  NodeRenderer childrenRenderer = getChildrenRenderer(expressionValue, (ValueDescriptor) node.getParent().getDescriptor());

  return DebuggerTreeNodeExpression.substituteThis(
    childrenRenderer.getChildValueExpression(node, context),
    (PsiExpression)myChildrenExpression.getPsiExpression(node.getProject()).copy(),
    expressionValue);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:ExpressionChildrenRenderer.java

示例11: getChildValueExpression

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
@Override
public PsiElement getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) throws EvaluateException {
  FieldDescriptor fieldDescriptor = (FieldDescriptor)node.getDescriptor();

  PsiElementFactory elementFactory = JavaPsiFacade.getInstance(node.getProject()).getElementFactory();
  try {
    return elementFactory.createExpressionFromText(fieldDescriptor.getField().name(), DebuggerUtils.findClass(
      fieldDescriptor.getObject().referenceType().name(), context.getProject(), context.getDebugProcess().getSearchScope())
    );
  }
  catch (IncorrectOperationException e) {
    throw new EvaluateException(DebuggerBundle.message("error.invalid.field.name", fieldDescriptor.getField().name()), null);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:ClassRenderer.java

示例12: actionPerformed

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
public void actionPerformed(AnActionEvent e) {
  DebuggerTreeNodeImpl selectedNode = (DebuggerTreeNodeImpl)((DebuggerUtilsEx)DebuggerUtils.getInstance()).getSelectedNode(e.getDataContext());
  if(selectedNode == null) return;
  
  if(!isPrimitiveArray(selectedNode)) return;

  final DebuggerContext debuggerContext = DebuggerUtils.getInstance().getDebuggerContext(e.getDataContext());
  if(debuggerContext == null || debuggerContext.getDebugProcess() == null) return;

  for(Enumeration children = selectedNode.children(); children.hasMoreElements(); ) {
    final DebuggerTreeNode child = (DebuggerTreeNode)children.nextElement();
    if(child.getDescriptor() instanceof ValueDescriptor) {
      debuggerContext.getDebugProcess().getManagerThread().invokeCommand(new SuspendContextCommand() {
        public SuspendContext getSuspendContext() {
          return debuggerContext.getSuspendContext();
        }

        public void action() {
          child.setRenderer(myRenderer);
        }

        public void commandCancelled() {
        }
      });
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:ShowAllAs.java

示例13: getDescriptorEvaluation

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
  PsiElementFactory elementFactory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory();
  try {
    return elementFactory.createExpressionFromText("this[" + myIndex + "]", null);
  }
  catch (IncorrectOperationException e) {
    throw new EvaluateException(e.getMessage(), e);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:ArrayElementDescriptorImpl.java

示例14: getDescriptorEvaluation

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
  PsiElementFactory elementFactory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory();
  try {
    return elementFactory.createExpressionFromText(getName(), PositionUtil.getContextElement(context));
  }
  catch (IncorrectOperationException e) {
    throw new EvaluateException(DebuggerBundle.message("error.invalid.local.variable.name", getName()), e);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:ArgumentValueDescriptorImpl.java

示例15: getDescriptorEvaluation

import com.intellij.debugger.DebuggerContext; //導入依賴的package包/類
public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
  PsiElementFactory elementFactory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory();
  try {
    return elementFactory.createExpressionFromText("this", null);
  }
  catch (IncorrectOperationException e) {
    throw new EvaluateException(e.getMessage(), e);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:ThisDescriptorImpl.java


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