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


Java PsiExpressionCodeFragment类代码示例

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


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

示例1: TextWithImportsImpl

import com.intellij.psi.PsiExpressionCodeFragment; //导入依赖的package包/类
public TextWithImportsImpl (PsiExpression expression) {
  myKind = CodeFragmentKind.EXPRESSION;
  final String text = expression.getText();
  PsiFile containingFile = expression.getContainingFile();
  if(containingFile instanceof PsiExpressionCodeFragment) {
    myText = text;
    myImports = ((JavaCodeFragment)containingFile).importsToString();
    myFileType = StdFileTypes.JAVA;
  }
  else {
    Trinity<String, String, FileType> trinity = parseExternalForm(text);
    myText = trinity.first;
    myImports = trinity.second;
    myFileType = trinity.third;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:TextWithImportsImpl.java

示例2: TextWithImportsImpl

import com.intellij.psi.PsiExpressionCodeFragment; //导入依赖的package包/类
public TextWithImportsImpl(@NotNull PsiElement expression)
{
	myKind = CodeFragmentKind.EXPRESSION;
	final String text = expression.getText();
	PsiFile containingFile = expression.getContainingFile();
	if(containingFile instanceof PsiExpressionCodeFragment)
	{
		myText = text;
		myImports = ((JavaCodeFragment) containingFile).importsToString();
		myFileType = JavaFileType.INSTANCE;
	}
	else
	{
		Trinity<String, String, FileType> trinity = parseExternalForm(text);
		myText = trinity.first;
		myImports = trinity.second;
		myFileType = trinity.third;
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:TextWithImportsImpl.java

示例3: getDescriptorEvaluation

import com.intellij.psi.PsiExpressionCodeFragment; //导入依赖的package包/类
public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
  PsiElement evaluationCode = getEvaluationCode(context);
  if(evaluationCode instanceof PsiExpressionCodeFragment) {
    return ((PsiExpressionCodeFragment)evaluationCode).getExpression();
  }
  else {
    throw new EvaluateException(DebuggerBundle.message("error.cannot.create.expression.from.code.fragment"), null);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:EvaluationDescriptor.java

示例4: getTableCellEditorComponent

import com.intellij.psi.PsiExpressionCodeFragment; //导入依赖的package包/类
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  final Component editor = super.getTableCellEditorComponent(table, value, isSelected, row, column);
  final PsiType type = getRowType(table, row);
  if (type != null) {
    ((PsiExpressionCodeFragment)myCodeFragment).setExpectedType(type);
  }
  return editor;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:9,代码来源:JavaParameterTableModel.java

示例5: initEvaluatorAndChildrenExpression

import com.intellij.psi.PsiExpressionCodeFragment; //导入依赖的package包/类
protected Cache initEvaluatorAndChildrenExpression(final Project project)
{
	final Cache cache = new Cache();
	try
	{
		Pair<PsiElement, PsiType> psiClassAndType = DebuggerUtilsImpl.getPsiClassAndType(getClassName(), project);
		PsiElement context = psiClassAndType.first;
		if(context == null)
		{
			throw EvaluateExceptionUtil.CANNOT_FIND_SOURCE_CLASS;
		}
		CodeFragmentFactory factory = DebuggerUtilsEx.findAppropriateCodeFragmentFactory(myReferenceExpression, context);
		JavaCodeFragment codeFragment = factory.createCodeFragment(myReferenceExpression, overrideContext(context), project);
		codeFragment.setThisType(psiClassAndType.second);
		DebuggerUtils.checkSyntax(codeFragment);
		cache.myPsiChildrenExpression = codeFragment instanceof PsiExpressionCodeFragment ? ((PsiExpressionCodeFragment) codeFragment).getExpression() : null;

		try
		{
			cache.myEvaluator = factory.getEvaluatorBuilder().build(codeFragment, null);
		}
		catch(UnsupportedExpressionException ex)
		{
			ExpressionEvaluator eval = CompilingEvaluatorImpl.create(project, context, element -> codeFragment);
			if(eval != null)
			{
				cache.myEvaluator = eval;
			}
			throw ex;
		}
	}
	catch(EvaluateException e)
	{
		cache.myException = e;
	}

	myCache = new SoftReference<>(cache);
	return cache;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:40,代码来源:CachedEvaluator.java

示例6: getDescriptorEvaluation

import com.intellij.psi.PsiExpressionCodeFragment; //导入依赖的package包/类
public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException
{
	PsiElement evaluationCode = getEvaluationCode(context);
	if(evaluationCode instanceof PsiExpressionCodeFragment)
	{
		return ((PsiExpressionCodeFragment) evaluationCode).getExpression();
	}
	else
	{
		throw new EvaluateException(DebuggerBundle.message("error.cannot.create.expression.from.code.fragment"), null);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:13,代码来源:EvaluationDescriptor.java

示例7: createExpressionCodeFragment

import com.intellij.psi.PsiExpressionCodeFragment; //导入依赖的package包/类
@NotNull
@Override
public PsiExpressionCodeFragment createExpressionCodeFragment(@NotNull final String text, @Nullable final PsiElement context, @Nullable final PsiType expectedType, final boolean isPhysical)
{
	return new PsiExpressionCodeFragmentImpl(myProject, isPhysical, "fragment.java", text, expectedType, context);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:7,代码来源:JavaCodeFragmentFactoryImpl.java


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