本文整理汇总了Java中com.intellij.psi.PsiExpressionList.getExpressionTypes方法的典型用法代码示例。如果您正苦于以下问题:Java PsiExpressionList.getExpressionTypes方法的具体用法?Java PsiExpressionList.getExpressionTypes怎么用?Java PsiExpressionList.getExpressionTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiExpressionList
的用法示例。
在下文中一共展示了PsiExpressionList.getExpressionTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFlags
import com.intellij.psi.PsiExpressionList; //导入方法依赖的package包/类
@Override
public int getFlags(PsiElement elementInHost, PsiFile regexp) {
final PsiExpressionList list = PsiTreeUtil.getParentOfType(elementInHost, PsiExpressionList.class);
if (list != null && list.getExpressions().length == 2 && list.getExpressionTypes()[1] == PsiType.INT) {
final Object result = JavaConstantExpressionEvaluator.computeConstantExpression(list.getExpressions()[1], false);
if (result instanceof Integer) {
//noinspection MagicConstant
return ((Integer)result).intValue();
}
}
return 0;
}
示例2: getColor
import com.intellij.psi.PsiExpressionList; //导入方法依赖的package包/类
@Nullable
private static Color getColor(PsiExpressionList list)
{
try
{
final PsiExpression[] args = list.getExpressions();
final PsiType[] types = list.getExpressionTypes();
ColorConstructors type = getConstructorType(types);
if(type != null)
{
switch(type)
{
case INT:
return new Color(getInt(args[0]));
case INT_BOOL:
return new Color(getInt(args[0]), getBoolean(args[1]));
case INT_x3:
return new Color(getInt(args[0]), getInt(args[1]), getInt(args[2]));
case INT_x4:
return new Color(getInt(args[0]), getInt(args[1]), getInt(args[2]), getInt(args[3]));
case FLOAT_x3:
return new Color(getFloat(args[0]), getFloat(args[1]), getFloat(args[2]));
case FLOAT_x4:
return new Color(getFloat(args[0]), getFloat(args[1]), getFloat(args[2]), getFloat(args[3]));
}
}
}
catch(Exception ignore)
{
}
return null;
}
示例3: isApplicable
import com.intellij.psi.PsiExpressionList; //导入方法依赖的package包/类
@Override
protected boolean isApplicable(PsiMethod method, PsiElement place)
{
final PsiExpressionList argumentList = ((PsiMethodCallExpression) place).getArgumentList();
final MethodCandidateInfo candidateInfo = new MethodCandidateInfo(method, PsiSubstitutor.EMPTY, false, false, argumentList, null, argumentList.getExpressionTypes(), null);
PsiSubstitutor substitutorForMethod = candidateInfo.getSubstitutor();
if(PsiUtil.isApplicable(method, substitutorForMethod, argumentList))
{
final PsiType returnType = substitutorForMethod.substitute(method.getReturnType());
final PsiType expectedType = getExpectedType();
return expectedType == null || returnType == null || TypeConversionUtil.isAssignable(expectedType, returnType);
}
return false;
}