當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。