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


Java TextWithImports类代码示例

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


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

示例1: createExpressionCodeFragment

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
protected PsiFile createExpressionCodeFragment(@NotNull Project project,
                                               @NotNull XExpression expression,
                                               @Nullable PsiElement context,
                                               boolean isPhysical) {
  TextWithImports text = TextWithImportsImpl.fromXExpression(expression);
  if (text != null && context != null) {
    CodeFragmentFactory factory = DebuggerUtilsEx.findAppropriateCodeFragmentFactory(text, context);
    JavaCodeFragment codeFragment = factory.createPresentationCodeFragment(text, context, project);
    codeFragment.forceResolveScope(GlobalSearchScope.allScope(project));

    final PsiClass contextClass = PsiTreeUtil.getNonStrictParentOfType(context, PsiClass.class);
    if (contextClass != null) {
      final PsiClassType contextType =
        JavaPsiFacade.getInstance(codeFragment.getProject()).getElementFactory().createType(contextClass);
      codeFragment.setThisType(contextType);
    }
    return codeFragment;
  }
  else {
    return super.createExpressionCodeFragment(project, expression, context, isPhysical);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JavaDebuggerEditorsProvider.java

示例2: createDescriptorByNode

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public void createDescriptorByNode(Object node, final ResultConsumer<Pair<NodeDescriptorImpl, String>> resultConsumer) {
  if (node instanceof DebuggerTreeNodeImpl) {
    final DebuggerTreeNodeImpl debuggerTreeNode = (DebuggerTreeNodeImpl)node;
    final DebuggerContextImpl context = DebuggerManagerEx.getInstanceEx(myProject).getContext();
    context.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(context) {
      @Override
      public void threadAction() {
        try {
          final TextWithImports evaluationText = DebuggerTreeNodeExpression.createEvaluationText(debuggerTreeNode, context);
          resultConsumer.onSuccess(Pair.create(debuggerTreeNode.getDescriptor(), evaluationText.getText()));
        }
        catch (EvaluateException e) {
          resultConsumer.onFailure(e);
        }
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DebuggerTreeCreatorImpl.java

示例3: createEvaluationText

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
public static TextWithImports createEvaluationText(final DebuggerTreeNodeImpl node, final DebuggerContextImpl context) throws EvaluateException {
  final EvaluateException[] ex = new EvaluateException[] {null};
  final TextWithImports textWithImports = PsiDocumentManager.getInstance(context.getProject()).commitAndRunReadAction(new Computable<TextWithImports>() {
    public TextWithImports compute() {
      try {
        final PsiExpression expressionText = getEvaluationExpression(node, context);
        if (expressionText != null) {
          return new TextWithImportsImpl(expressionText);
        }
      }
      catch (EvaluateException e) {
        ex[0] = e;
      }
      return null;
    }
  });
  if (ex[0] != null) {
    throw ex[0];
  }
  return textWithImports;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DebuggerTreeNodeExpression.java

示例4: getEditorText

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public TextWithImports getEditorText(PsiElement elementAtCaret) {
  String result = null;
  PsiElement element = findExpression(elementAtCaret);
  if (element == null) return null;
  if (element instanceof PsiVariable) {
    result = qualifyEnumConstant(element, ((PsiVariable)element).getName());
  }
  else if (element instanceof PsiMethod) {
    result = ((PsiMethod)element).getName() + "()";
  }
  else if (element instanceof PsiReferenceExpression) {
    PsiReferenceExpression reference = (PsiReferenceExpression)element;
    result = qualifyEnumConstant(reference.resolve(), element.getText());
  }
  else {
    result = element.getText();
  }
  return result != null? new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, result) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaEditorTextProviderImpl.java

示例5: getEditorText

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public TextWithImports getEditorText(PsiElement elementAtCaret) {
  String result = "";
  PsiElement element = findExpressionInner(elementAtCaret, true);
  if (element != null) {
    if (element instanceof GrReferenceExpression) {
      final GrReferenceExpression reference = (GrReferenceExpression)element;
      if (reference.getQualifier() == null) {
        final PsiElement resolved = reference.resolve();
        if (resolved instanceof PsiEnumConstant) {
          final PsiEnumConstant enumConstant = (PsiEnumConstant)resolved;
          final PsiClass enumClass = enumConstant.getContainingClass();
          if (enumClass != null) {
            result = enumClass.getName() + "." + enumConstant.getName();
          }
        }
      }
    }
    if (result.isEmpty()) {
      result = element.getText();
    }
  }
  return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GroovyEditorTextProvider.java

示例6: setNodeAsRoot

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
protected void setNodeAsRoot(final Object node) {
  if (node instanceof DebuggerTreeNodeImpl) {
    myValueHint.shiftLocation();
    final DebuggerTreeNodeImpl debuggerTreeNode = (DebuggerTreeNodeImpl)node;
    final DebuggerContextImpl context = (DebuggerManagerEx.getInstanceEx(myValueHint.getProject())).getContext();
    context.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(context) {
      public void threadAction() {
        try {
          final NodeDescriptorImpl descriptor = debuggerTreeNode.getDescriptor();
          final TextWithImports evaluationText = DebuggerTreeNodeExpression.createEvaluationText(debuggerTreeNode, context);
          final String title = evaluationText.getText();
          addToHistory(Pair.create(descriptor, title));
          myTree.setInspectDescriptor(descriptor);
          myValueHint.showTreePopup(myTree, context, title, ValueHintTreeComponent.this);
        }
        catch (final EvaluateException e1) {
          LOG.debug(e1);
        }
      }
    });
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:ValueHintTreeComponent.java

示例7: getEditorText

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public TextWithImports getEditorText(PsiElement elementAtCaret) {
  String result = "";
  PsiElement element = findExpressionInner(elementAtCaret, true);
  if (element != null) {
    if (element instanceof GrReferenceExpression) {
      final GrReferenceExpression reference = (GrReferenceExpression)element;
      if (reference.getQualifier() == null) {
        final PsiElement resolved = reference.resolve();
        if (resolved instanceof PsiEnumConstant) {
          final PsiEnumConstant enumConstant = (PsiEnumConstant)resolved;
          final PsiClass enumClass = enumConstant.getContainingClass();
          if (enumClass != null) {
            result = enumClass.getName() + "." + enumConstant.getName();
          }
        }
      }
    }
    if (result.length() == 0) {
      result = element.getText();
    }
  }
  return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, result);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:GroovyEditorTextProvider.java

示例8: createExpressionCodeFragment

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
protected PsiFile createExpressionCodeFragment(@NotNull Project project, @NotNull XExpression expression, @Nullable PsiElement context, boolean isPhysical)
{
	TextWithImports text = TextWithImportsImpl.fromXExpression(expression);
	if(text != null && context != null)
	{
		CodeFragmentFactory factory = DebuggerUtilsEx.findAppropriateCodeFragmentFactory(text, context);
		JavaCodeFragment codeFragment = factory.createPresentationCodeFragment(text, context, project);
		codeFragment.forceResolveScope(GlobalSearchScope.allScope(project));

		final PsiClass contextClass = PsiTreeUtil.getNonStrictParentOfType(context, PsiClass.class);
		if(contextClass != null)
		{
			final PsiClassType contextType = JavaPsiFacade.getInstance(codeFragment.getProject()).getElementFactory().createType(contextClass);
			codeFragment.setThisType(contextType);
		}
		return codeFragment;
	}
	else
	{
		return super.createExpressionCodeFragment(project, expression, context, isPhysical);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:JavaDebuggerEditorsProvider.java

示例9: readExternal

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public void readExternal(Element element) throws InvalidDataException
{
	super.readExternal(element);

	myChildren.clear();

	myAppendDefaultChildren = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, APPEND_DEFAULT_NAME));

	List<Element> children = element.getChildren(CHILDREN_EXPRESSION);
	for(Element item : children)
	{
		String name = item.getAttributeValue(CHILD_NAME);
		TextWithImports text = DebuggerUtils.getInstance().readTextWithImports(item.getChildren().get(0));
		boolean onDemand = Boolean.parseBoolean(item.getAttributeValue(CHILD_ONDEMAND));

		myChildren.add(new ChildInfo(name, text, onDemand));
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:EnumerationChildrenRenderer.java

示例10: readExternal

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
public void readExternal(Element element) throws InvalidDataException
{
	super.readExternal(element);
	DefaultJDOMExternalizer.readExternal(this, element);

	TextWithImports childrenExpression = DebuggerUtils.getInstance().readTextWithImports(element, "CHILDREN_EXPRESSION");
	if(childrenExpression != null)
	{
		setChildrenExpression(childrenExpression);
	}

	TextWithImports childrenExpandable = DebuggerUtils.getInstance().readTextWithImports(element, "CHILDREN_EXPANDABLE");
	if(childrenExpandable != null)
	{
		myChildrenExpandable.setReferenceExpression(childrenExpandable);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:ExpressionChildrenRenderer.java

示例11: cacheOrGet

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Nullable
static ExpressionEvaluator cacheOrGet(String propertyName,
		EventRequest request,
		PsiElement context,
		TextWithImports text,
		EvaluatingComputable<ExpressionEvaluator> supplier) throws EvaluateException
{
	EvaluatorCache cache = (EvaluatorCache) request.getProperty(propertyName);
	if(cache != null && Objects.equals(cache.myContext, context) && Objects.equals(cache.myTextWithImports, text))
	{
		return cache.myEvaluator;
	}
	ExpressionEvaluator evaluator = supplier.compute();
	request.putProperty(propertyName, new EvaluatorCache(context, text, evaluator));
	return evaluator;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:Breakpoint.java

示例12: createExpressionEvaluator

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
private static ExpressionEvaluator createExpressionEvaluator(Project project,
		PsiElement contextPsiElement,
		SourcePosition contextSourcePosition,
		TextWithImports text,
		Function<PsiElement, PsiCodeFragment> fragmentFactory) throws EvaluateException
{
	try
	{
		return EvaluatorBuilderImpl.build(text, contextPsiElement, contextSourcePosition, project);
	}
	catch(UnsupportedExpressionException ex)
	{
		ExpressionEvaluator eval = CompilingEvaluatorImpl.create(project, contextPsiElement, fragmentFactory);
		if(eval != null)
		{
			return eval;
		}
		throw ex;
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:Breakpoint.java

示例13: getColumnClass

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@NotNull
@Override
public Class getColumnClass(int columnIndex)
{
	switch(columnIndex)
	{
		case NAME_TABLE_COLUMN:
			return String.class;
		case EXPRESSION_TABLE_COLUMN:
			return TextWithImports.class;
		case ONDEMAND_TABLE_COLUMN:
			return Boolean.class;
		default:
			return super.getColumnClass(columnIndex);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:CompoundRendererConfigurable.java

示例14: setValueAt

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex)
{
	if(rowIndex >= getRowCount())
	{
		return;
	}
	final EnumerationChildrenRenderer.ChildInfo row = myData.get(rowIndex);
	switch(columnIndex)
	{
		case NAME_TABLE_COLUMN:
			row.myName = (String) aValue;
			break;
		case EXPRESSION_TABLE_COLUMN:
			row.myExpression = (TextWithImports) aValue;
			break;
		case ONDEMAND_TABLE_COLUMN:
			row.myOnDemand = (Boolean) aValue;
			break;
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:CompoundRendererConfigurable.java

示例15: readTextWithImports

import com.intellij.debugger.engine.evaluation.TextWithImports; //导入依赖的package包/类
@Override
@SuppressWarnings({"HardCodedStringLiteral"})
public TextWithImports readTextWithImports(Element element)
{
	LOG.assertTrue("TextWithImports".equals(element.getName()));

	String text = element.getAttributeValue("text");
	if("expression".equals(element.getAttributeValue("type")))
	{
		return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, text);
	}
	else
	{
		return new TextWithImportsImpl(CodeFragmentKind.CODE_BLOCK, text);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:DebuggerUtilsImpl.java


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