本文整理汇总了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;
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}